Toggle navigation
Toggle navigation
This project
Loading...
Sign in
chenchao
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
梁志锋
9 years ago
Commit
ced483f9eebbd995509c6a984eb95cc3558fe006
2 parents
3a2c7af6
5a8ed297
Merge branch 'develop' of
http://git.dev.yoho.cn/web/yohobuy
into develop
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
121 additions
and
87 deletions
library/Plugin/Helpers.php
static/js/cart/cart.js
static/js/cart/good.js
static/js/cart/select-coupon.js
static/sass/cart/_order-ensure.scss
static/sass/cart/_select-coupon.scss
template/m.yohobuy.com/actions/cart/index/order-ensure.phtml
template/m.yohobuy.com/actions/cart/index/select-coupon.phtml
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
library/Plugin/Helpers.php
View file @
ced483f
...
...
@@ -567,41 +567,41 @@ class Helpers
{
$arr
=
array
();
$oneGoods
=
array
();
foreach
(
$cartGoods
as
$key
=>
$value
)
{
$oneGoods
[
'id'
]
=
$value
[
'product_sku'
];
$oneGoods
[
'skn'
]
=
$value
[
'product_skn'
];
$oneGoods
[
'name'
]
=
$value
[
'product_name'
];
$oneGoods
[
'thumb'
]
=
!
empty
(
$value
[
'goods_images'
])
?
Images
::
getImageUrl
(
$value
[
'goods_images'
],
90
,
100
)
:
''
;
$oneGoods
[
'color'
]
=
$value
[
'color_name'
];
$oneGoods
[
'size'
]
=
$value
[
'size_name'
];
$oneGoods
=
array
();
foreach
(
$cartGoods
as
$key
=>
$value
)
{
$oneGoods
[
'id'
]
=
$value
[
'product_sku'
];
$oneGoods
[
'skn'
]
=
$value
[
'product_skn'
];
$oneGoods
[
'name'
]
=
$value
[
'product_name'
];
$oneGoods
[
'thumb'
]
=
!
empty
(
$value
[
'goods_images'
])
?
Images
::
getImageUrl
(
$value
[
'goods_images'
],
90
,
100
)
:
''
;
$oneGoods
[
'color'
]
=
$value
[
'color_name'
];
$oneGoods
[
'size'
]
=
$value
[
'size_name'
];
$oneGoods
[
'isSelected'
]
=
$value
[
'selected'
]
===
'Y'
;
$oneGoods
[
'price'
]
=
self
::
transPrice
(
$value
[
'sales_price'
]);
$oneGoods
[
'count'
]
=
$value
[
'buy_number'
];
$oneGoods
[
'price'
]
=
self
::
transPrice
(
$value
[
'sales_price'
]);
$oneGoods
[
'count'
]
=
$value
[
'buy_number'
];
if
(
$isValid
)
{
$oneGoods
[
'lowStocks'
]
=
(
$value
[
'buy_number'
]
>
$value
[
'storage_number'
]);
}
//gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
if
(
!
isset
(
$value
[
'goods_type'
]))
{
$oneGoods
[
'isSoldOut'
]
=
true
;
}
elseif
(
$value
[
'goods_type'
]
==
'gift'
&&
!
isset
(
$value
[
'isAdvanceBuy'
]))
{
$oneGoods
[
'isGift'
]
=
true
;
}
elseif
(
$value
[
'goods_type'
]
==
'price_gift'
)
{
$oneGoods
[
'isAdvanceBuy'
]
=
true
;
}
// 上市期
if
(
!
empty
(
$value
[
'expect_arrival_time'
]))
{
$oneGoods
[
'appearDate'
]
=
$value
[
'expect_arrival_time'
];
}
// 商品链接
if
(
isset
(
$value
[
'cn_alphabet'
])
)
{
$oneGoods
[
'url'
]
=
self
::
url
(
'/product/pro_'
.
$value
[
'product_id'
]
.
'_'
.
$value
[
'goods_id'
]
.
'/'
.
$value
[
'cn_alphabet'
]
.
'.html'
);
}
$arr
[
$key
]
=
$oneGoods
;
}
//gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
if
(
!
isset
(
$value
[
'goods_type'
]))
{
$oneGoods
[
'isSoldOut'
]
=
true
;
}
elseif
(
$value
[
'goods_type'
]
==
'gift'
&&
!
isset
(
$value
[
'isAdvanceBuy'
]))
{
$oneGoods
[
'isGift'
]
=
true
;
}
elseif
(
$value
[
'goods_type'
]
==
'price_gift'
)
{
$oneGoods
[
'isAdvanceBuy'
]
=
true
;
}
// 上市期
if
(
!
empty
(
$value
[
'expect_arrival_time'
]))
{
$oneGoods
[
'appearDate'
]
=
$value
[
'expect_arrival_time'
];
}
// 商品链接
if
(
isset
(
$value
[
'cn_alphabet'
]))
{
$oneGoods
[
'url'
]
=
self
::
url
(
'/product/pro_'
.
$value
[
'product_id'
]
.
'_'
.
$value
[
'goods_id'
]
.
'/'
.
$value
[
'cn_alphabet'
]
.
'.html'
);
}
$arr
[
$key
]
=
$oneGoods
;
}
return
$arr
;
}
...
...
@@ -617,30 +617,30 @@ class Helpers
{
$arr
=
array
();
$gift
=
array
();
$oneGoods
=
array
();
foreach
(
$advanceGoods
as
$value
)
{
$gift
=
array
();
$gift
[
'promotionId'
]
=
$value
[
'promotion_id'
];
$gift
[
'promotionTitle'
]
=
$value
[
'promotion_title'
];
foreach
(
$value
[
'goods_list'
]
as
$single
)
{
$oneGoods
[
'id'
]
=
$single
[
'product_skn'
];
$oneGoods
[
'name'
]
=
$single
[
'product_name'
];
$oneGoods
[
'thumb'
]
=
!
empty
(
$single
[
'goods_images'
])
?
Images
::
getImageUrl
(
$single
[
'goods_images'
],
120
,
160
)
:
''
;
$oneGoods
[
'appearDate'
]
=
'12月'
;
// 目前app接口没有返回该数据
$oneGoods
[
'price'
]
=
self
::
transPrice
(
$single
[
'last_price'
]);
$oneGoods
[
'marketPrice'
]
=
self
::
transPrice
(
$single
[
'market_price'
]);
$oneGoods
[
'count'
]
=
$single
[
'storage_number'
];
$gift
[
'goods'
][]
=
$oneGoods
;
}
$arr
[]
=
$gift
;
// 计算加价购商品数目
$count
+=
$value
[
'max_select_number'
];
}
$gift
=
array
();
$oneGoods
=
array
();
foreach
(
$advanceGoods
as
$value
)
{
$gift
=
array
();
$gift
[
'promotionId'
]
=
$value
[
'promotion_id'
];
$gift
[
'promotionTitle'
]
=
$value
[
'promotion_title'
];
foreach
(
$value
[
'goods_list'
]
as
$single
)
{
$oneGoods
[
'id'
]
=
$single
[
'product_skn'
];
$oneGoods
[
'name'
]
=
$single
[
'product_name'
];
$oneGoods
[
'thumb'
]
=
!
empty
(
$single
[
'goods_images'
])
?
Images
::
getImageUrl
(
$single
[
'goods_images'
],
120
,
160
)
:
''
;
$oneGoods
[
'appearDate'
]
=
'12月'
;
// 目前app接口没有返回该数据
$oneGoods
[
'price'
]
=
self
::
transPrice
(
$single
[
'last_price'
]);
$oneGoods
[
'marketPrice'
]
=
self
::
transPrice
(
$single
[
'market_price'
]);
$oneGoods
[
'count'
]
=
$single
[
'storage_number'
];
$gift
[
'goods'
][]
=
$oneGoods
;
}
$arr
[]
=
$gift
;
// 计算加价购商品数目
$count
+=
$value
[
'max_select_number'
];
}
return
$arr
;
}
...
...
static/js/cart/cart.js
View file @
ced483f
...
...
@@ -8,7 +8,8 @@ var $ = require('jquery'),
lazyLoad
=
require
(
'yoho.lazyload'
),
Hammer
=
require
(
'yoho.hammer'
);
var
chosePanel
=
require
(
'./chose-panel'
);
var
chosePanel
=
require
(
'./chose-panel'
),
tip
=
require
(
'../plugin/tip'
);
var
$cartContent
=
$
(
'.cart-content'
);
...
...
@@ -46,7 +47,11 @@ if ($('.cart-nav').length > 0) {
}
$
(
'.btn-balance'
).
on
(
'touchend'
,
function
()
{
window
.
location
.
href
=
'/cart/index/orderEnsure?cartType='
+
cartType
;
if
(
$
(
'.balance span'
).
hasClass
(
'icon-cb-checked'
)){
window
.
location
.
href
=
'/cart/index/orderEnsure?cartType='
+
cartType
;
}
else
{
tip
.
show
(
'请先勾选商品~'
);
}
});
$
(
'.chose'
).
on
(
'touchend'
,
function
()
{
...
...
static/js/cart/good.js
View file @
ced483f
...
...
@@ -52,7 +52,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
this
.
selected
=
properties
.
selected
;
}
goodInfo
.
goods_type
=
getCartType
()
;
goodInfo
.
goods_type
=
cartType
;
goodInfo
.
selected
=
isSelected
?
'N'
:
'Y'
;
goodInfo
.
product_sku
=
id
;
goodInfo
.
buy_number
=
$good
.
find
(
'.count'
).
eq
(
0
).
text
().
trim
().
replace
(
'×'
,
''
);
...
...
static/js/cart/select-coupon.js
View file @
ced483f
...
...
@@ -16,9 +16,10 @@ var page = 1,
isGetData
;
var
conponTmpl
=
Handlebars
.
compile
(
$
(
'#tmpl-coupon'
).
html
()),
conponNotAvaliableTmpl
=
Handlebars
.
compile
(
$
(
'#tmpl-coupon-not-avaliable'
).
html
()),
$newCoupon
=
$
(
'#new-coupon'
);
// conponNotAvaliableTmpl = Handlebars.compile($('#tmpl-coupon-not-avaliable').html()),
ellipsis
.
init
();
$newCoupon
.
on
(
'submit'
,
function
()
{
...
...
@@ -54,6 +55,12 @@ $('#coupon-list').on('touchend', '.employ-main', function() {
orderInfo
(
'couponValue'
,
$this
.
data
(
'coupon-value'
));
});
$
(
'body'
).
on
(
'touchend'
,
'.not-use'
,
function
()
{
orderInfo
(
'couponCode'
,
null
);
orderInfo
(
'couponValue'
,
null
);
});
$newCoupon
.
find
(
'input'
).
on
(
'input'
,
function
()
{
if
(
$
(
this
).
val
()
!==
''
)
{
$newCoupon
.
find
(
'.submit'
).
css
(
'background'
,
'#444'
);
...
...
@@ -109,15 +116,17 @@ function getCouponHandle(coupons) {
}
});
if
(
notAvailableCoupons
.
length
)
{
$
(
'.not-avaliable-coupon-line'
).
show
();
}
$
(
'#coupon-list'
).
append
(
conponTmpl
({
coupons
:
coupons
}));
$
(
'#coupon-list-not'
).
append
(
conponNotAvaliableTmpl
({
notAvailableCoupons
:
notAvailableCoupons
}));
// 产品说,暂时不做不可使用的优惠券
// if (notAvailableCoupons.length) {
// $('.not-avaliable-coupon-line').show();
// }
// $('#coupon-list-not').append(conponNotAvaliableTmpl({
// notAvailableCoupons: notAvailableCoupons
// }));
window
.
rePosFooter
();
}
...
...
static/sass/cart/_order-ensure.scss
View file @
ced483f
...
...
@@ -89,6 +89,10 @@
margin-left
:
20rem
/
$pxConvertRem
;
}
}
.name
{
max-width
:
pxToRem
(
400px
);
}
}
.sale-invoice
{
...
...
static/sass/cart/_select-coupon.scss
View file @
ced483f
...
...
@@ -46,6 +46,17 @@
height
:
0
;
}
.not-use
{
display
:
block
;
width
:
pxToRem
(
560px
);
margin
:
pxToRem
(
30px
)
auto
;
text-align
:
center
;
font-size
:
pxToRem
(
32px
);
line-height
:
2
.5
;
border
:
1px
solid
#444
;
@include
border-radius
(
4px
);
}
.not-avaliable-coupon-line
{
position
:
relative
;
margin-top
:
pxToRem
(
30px
);
...
...
template/m.yohobuy.com/actions/cart/index/order-ensure.phtml
View file @
ced483f
...
...
@@ -45,11 +45,9 @@
<a
href=
"/cart/index/selectCoupon"
>
<span
class=
"title"
>优惠券</span>
{
{#
coupon
}
}
{
{#if
count
}
}
<span
class=
"coupon-count"
>
{
{count
}
}张可用
</span>
{
{/if
}
}
<span
class=
"coupon-count"
>
{
{count
}
}张可用
</span>
{
{#if
value
}
}
<span
class=
"used coupon-use"
>
...
...
template/m.yohobuy.com/actions/cart/index/select-coupon.phtml
View file @
ced483f
...
...
@@ -20,6 +20,7 @@
</a>
\
{
{/
notAvailable
}
}
\
{
{/coupons
}
}
<a
class=
"not-use"
href=
"/cart/index/orderEnsure"
>不使用任何优惠券</a>
</script>
<script
id=
"tmpl-coupon-not-avaliable"
type=
"text/tmpl"
>
\
{
{#
notAvailableCoupons
}
}
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
ced483f
...
...
@@ -84,7 +84,7 @@ class CartModel
$result
[
'isEmptyCart'
]
=
true
;
break
;
}
// 普通购物车空,则显示预售购物车
if
(
$ordinaryCount
===
'0'
)
{
$result
[
'cartNav'
]
=
false
;
...
...
@@ -100,14 +100,14 @@ class CartModel
$result
[
'cartNav'
]
=
true
;
$result
[
'cartType'
]
=
'ordinary'
;
}
/* 普通购物车 */
$result
[
'commonGoodsCount'
]
=
$ordinaryCount
;
$result
[
'commonCart'
]
=
self
::
procCartData
(
$cart
[
'ordinary_cart_data'
],
$onlyGift
,
$onlyAdvanceBuy
);
/* 预售购物车 */
$result
[
'presellGoodsCount'
]
=
$advanceCount
;
$result
[
'preSellCart'
]
=
self
::
procCartData
(
$cart
[
'advance_cart_data'
],
$onlyGift
,
$onlyAdvanceBuy
);
}
while
(
false
);
return
$result
;
...
...
@@ -416,7 +416,7 @@ class CartModel
foreach
(
$payReturn
[
'goods_list'
]
as
$single
)
{
$oneGoods
=
array
();
$oneGoods
[
'id'
]
=
$single
[
'product_sku'
];
// TODO 未确定用哪个
$oneGoods
[
'thumb'
]
=
Images
::
getImageUrl
(
$single
[
'goods_images'
],
120
,
1
2
0
);
$oneGoods
[
'thumb'
]
=
Images
::
getImageUrl
(
$single
[
'goods_images'
],
120
,
1
6
0
);
$oneGoods
[
'name'
]
=
$single
[
'product_name'
];
$oneGoods
[
'color'
]
=
$single
[
'color_name'
];
$oneGoods
[
'size'
]
=
$single
[
'size_name'
];
...
...
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
View file @
ced483f
...
...
@@ -153,8 +153,9 @@ class DetailModel
// 商品信息
if
(
!
empty
(
$baseInfo
[
'goodsList'
]))
{
$colorGroup
=
array
();
$size
List
=
array
();
$size
Group
=
array
();
$goodsGroup
=
array
();
$sizeList
=
array
();
$thumbImageList
=
array
();
$colorStorageGroup
=
array
();
// 颜色分组的库存总数集合, 多个之间用/分隔
$sizeStorageStr
=
''
;
// 尺码库存总数集合, 多个之间用/分隔
...
...
@@ -177,7 +178,7 @@ class DetailModel
// 商品的尺码列表
if
(
isset
(
$value
[
'goodsSizeBoList'
]))
{
foreach
(
$value
[
'goodsSizeBoList'
]
as
$size
)
{
$sizeList
[]
=
array
(
$sizeList
[
$value
[
'colorId'
]
][
]
=
array
(
'id'
=>
$size
[
'id'
],
'skuId'
=>
$size
[
'goodsSizeSkuId'
],
'goodsId'
=>
$size
[
'goodsId'
],
...
...
@@ -189,22 +190,21 @@ class DetailModel
$sizeStorageStr
.=
$size
[
'goodsSizeStorageNum'
]
.
'/'
;
$colorStorageGroup
[
$size
[
'sizeName'
]
][
$value
[
'colorName'
]
]
=
$size
[
'goodsSizeStorageNum'
];
}
// 颜色分组
$colorGroup
[]
=
array
(
'id'
=>
$value
[
'colorId'
],
'skcId'
=>
$value
[
'productSkc'
],
'name'
=>
$value
[
'colorName'
],
'goodsName'
=>
$value
[
'goodsName'
],
'colorNum'
=>
$colorStorageNum
,
'sizeNumStr'
=>
rtrim
(
$sizeStorageStr
,
'/'
),
);
}
// 颜色分组
$colorGroup
[]
=
array
(
'id'
=>
$value
[
'colorId'
],
'skcId'
=>
$value
[
'productSkc'
],
'name'
=>
$value
[
'colorName'
],
'goodsName'
=>
$value
[
'goodsName'
],
'colorNum'
=>
$colorStorageNum
,
'sizeNumStr'
=>
rtrim
(
$sizeStorageStr
,
'/'
),
);
// 缩略图
$thumbImageList
[]
=
array
(
'img'
=>
Helpers
::
getImageUrl
(
$value
[
'colorImage'
],
60
,
60
)
);
// 统计尺码对应的各个颜色的库存量
foreach
(
$sizeList
as
&
$sizeArr
)
{
$sizeArr
[
'colorNumStr'
]
=
implode
(
'/'
,
array_values
(
$colorStorageGroup
[
$sizeArr
[
'name'
]
])
);
}
...
...
@@ -212,6 +212,11 @@ class DetailModel
// 商品库存总数
$totalStorageNum
+=
$colorStorageNum
;
}
// 统计尺码对应的各个颜色的库存量
foreach
(
$colorGroup
as
$value
)
{
$sizeGroup
[][
'size'
]
=
$sizeList
[
$value
[
'colorId'
]
];
}
// 商品图: 多个
if
(
isset
(
$goodsGroup
[
1
]))
{
...
...
@@ -247,7 +252,7 @@ class DetailModel
$result
[
'cartInfo'
][
'salePrice'
]
=
isset
(
$result
[
'goodsPrice'
][
'currentPrice'
])
?
$result
[
'goodsPrice'
][
'currentPrice'
]
:
''
;
$result
[
'cartInfo'
][
'totalNum'
]
=
$totalStorageNum
;
$result
[
'cartInfo'
][
'colors'
]
=
$colorGroup
;
$result
[
'cartInfo'
][
'sizes'
]
=
$size
List
;
$result
[
'cartInfo'
][
'sizes'
]
=
$size
Group
;
}
// 非卖品
elseif
(
$notForSale
)
{
...
...
@@ -469,6 +474,7 @@ class DetailModel
'</p>'
=>
''
,
'<img src='
=>
"<img class=
\"
lazy
\"
src=
\"
data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==
\"
data-original="
,
'<img border="0" src='
=>
"<img border=
\"
0
\"
class=
\"
lazy
\"
src=
\"
data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==
\"
data-original="
,
'.jpg'
=>
'.jpg?imageMogr2/thumbnail/750x/quality/90'
,
)),
);
}
...
...
Please
register
or
login
to post a comment