Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-blk
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
xuqi
9 years ago
Commit
82225afac800804433607c7a3749fc54a1a7d6f8
1 parent
547f3070
shopping cart data with sold out goods
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
32 deletions
apps/shopping/models/cart.js
apps/shopping/views/partial/cart/cart-list-body.hbs
public/js/help/help.page.js
apps/shopping/models/cart.js
View file @
82225af
...
...
@@ -273,9 +273,14 @@ const filterCartData = (result, uid) => {
if
(
result
.
data
&&
result
.
data
.
ordinary_cart_data
)
{
ordinaryCartData
=
result
.
data
.
ordinary_cart_data
;
totalOrdinaryMoney
=
ordinaryCartData
.
shopping_cart_data
.
last_order_amount
;
ordinaryGoods
=
_
.
concat
(
ordinaryGoods
,
ordinaryCartData
.
goods_list
);
invalidGoods
=
_
.
concat
(
invalidGoods
,
ordinaryCartData
.
off_shelves_goods_list
);
ordinarySoldOutGoods
=
_
.
concat
(
ordinarySoldOutGoods
,
ordinaryCartData
.
sold_out_goods_list
);
ordinarySoldOutGoods
=
ordinaryCartData
.
sold_out_goods_list
;
// 库存不足商品
let
soldOutWithoutStorage
=
_
.
filter
(
ordinarySoldOutGoods
,
{
storage_number
:
'0'
});
// 库存为0的商品失效
let
soldOutWithStorage
=
_
.
reject
(
ordinarySoldOutGoods
,
{
storage_number
:
'0'
});
// 库存不为0的商品归为普通商品并显示库存不足
ordinaryGoods
=
_
.
concat
(
ordinaryGoods
,
ordinaryCartData
.
goods_list
,
soldOutWithStorage
);
// 正常商品
invalidGoods
=
_
.
concat
(
invalidGoods
,
ordinaryCartData
.
off_shelves_goods_list
,
soldOutWithoutStorage
);
// 失效商品
_
.
forEach
(
ordinaryGoods
,
function
(
good
)
{
buyNumber
=
parseInt
(
good
.
buy_number
,
10
);
...
...
@@ -299,8 +304,7 @@ const filterCartData = (result, uid) => {
hasGoods
:
advancedGoods
.
length
||
ordinaryGoods
.
length
||
invalidGoods
.
length
,
preSalePros
:
(
advancedSoldOutGoods
.
length
||
advancedGoods
.
length
)
?
_
.
concat
(
advancedGoods
,
advancedSoldOutGoods
)
:
[],
commonPros
:
(
ordinarySoldOutGoods
.
length
||
ordinaryGoods
.
length
)
?
_
.
concat
(
ordinaryGoods
,
ordinarySoldOutGoods
)
:
[],
commonPros
:
ordinaryGoods
,
invalidPros
:
invalidGoods
,
selectedNum
:
selectedAdvanceNum
+
selectedOrdinaryNum
,
checkAll
:
totalNum
===
(
selectedAdvanceNum
+
selectedOrdinaryNum
),
...
...
apps/shopping/views/partial/cart/cart-list-body.hbs
View file @
82225af
...
...
@@ -118,33 +118,33 @@
<li
class=
"chk"
data-product_info=
'{"goods_type": "invalid", "buy_number":
{{
buy_number
}}
, "selected": "
{{
selected
}}
", "product_sku": "
{{
product_sku
}}
", "promotion_id": 0}'
>
<span
class=
"iconfont warning"
>

</span>
</li>
<li>
<a
href=
"javascript:void(0)"
>
<img
src=
"
{{
image
goods_images
100
134
}}
"
alt=
"
{{
product_name
}}
"
>
</a>
</li>
<li
class=
"pro-info"
>
<div
class=
"pro-name"
><a
href=
"javascript:void(0)"
>
{{
product_name
}}
</a></div>
<div>
{{#if
color_name
}}
<span
class=
"mr20"
>
颜色:
{{
color_name
}}
</span>
{{/if}}
{{#if
size_name
}}
<span>
尺寸:
{{
size_name
}}
</span>
{{/if}}
</div>
</li>
<li
class=
"price-num"
>
<span
class=
"price sale-price"
>
¥
{{
round
sales_price
2
}}
</span>
{{>
cart
/
stepper
}}
</li>
<li
class=
"total-price-action"
>
<span
class=
"price item-total-price"
>
¥
{{
round
(
multiple
sales_price
buy_number
)
2
}}
</span>
<div
class=
"actions"
>
<div
class=
"remove-item action"
data-product_id=
{{
product_id
}}
>
<span
class=
"iconfont"
>

</span>
删
除
</div>
<div
class=
"send-to-favorite action"
data-product_id=
{{
product_id
}}
>
移入收藏夹</div
>
</div>
</li>
<li>
<a
href=
"javascript:void(0)"
>
<img
src=
"
{{
image
goods_images
100
134
}}
"
alt=
"
{{
product_name
}}
"
>
</a>
</li>
<li
class=
"pro-info"
>
<div
class=
"pro-name"
><a
href=
"javascript:void(0)"
>
{{
product_name
}}
</a></div>
<div>
{{#if
color_name
}}
<span
class=
"mr20"
>
颜色:
{{
color_name
}}
</span>
{{/if}}
{{#if
size_name
}}
<span>
尺寸:
{{
size_name
}}
</span>
{{/if}}
</div>
</li>
<li
class=
"price-num"
>
<span
class=
"price sale-price"
>
¥
{{
round
sales_price
2
}}
</span>
{{>
cart
/
stepper
}}
</li>
<li
class=
"total-price-action"
>
<span
class=
"price item-total-price"
>
¥
{{
round
(
multiple
sales_price
buy_number
)
2
}}
</span>
<div
class=
"actions"
>
<div
class=
"remove-item action"
data-product_id=
{{
product_id
}}
>
<span
class=
"iconfont"
>

</span>
删
除
</div>
<div
class=
"send-to-favorite action"
data-product_id=
{{
product_id
}}
>
移入收藏夹</div
>
</div>
</li>
</ul>
{{/
each
}}
</div>
...
...
public/js/help/help.page.js
View file @
82225af
...
...
@@ -11,6 +11,7 @@ var parentID = queryId.substr(0, 1);// 一级分类id
require
(
'../common/header'
);
require
(
'../common/return-top'
);
/**
* 目录切换
*/
...
...
Please
register
or
login
to post a comment