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
姜枫
9 years ago
Commit
5f3c633101684e1cf4f4e1f4ea9a3a58b5e67ec7
1 parent
ef2bc930
add vip shipping cost
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
42 deletions
apps/me/controllers/order.js
apps/shopping/models/cart.js
apps/me/controllers/order.js
View file @
5f3c633
...
...
@@ -8,6 +8,9 @@
const
mcHandler
=
require
(
'../models/menu-crumb-handler'
);
const
orderModel
=
require
(
'../models/order'
);
const
_
=
require
(
'lodash'
);
const
crypto
=
global
.
yoho
.
crypto
;
const
config
=
global
.
yoho
.
config
;
/**
* 我的订单
...
...
@@ -41,7 +44,9 @@ const detail = (req, res, next) => {
const
pageData
=
result
[
0
];
const
thumb
=
result
[
1
];
console
.
log
(
pageData
);
if
(
_
.
has
(
pageData
,
'orderDetail.orderCode'
))
{
pageData
.
orderDetail
.
orderCodeM
=
crypto
.
encryption
(
config
.
crypto
.
common
,
pageData
.
orderDetail
.
orderCode
);
}
res
.
display
(
'index'
,
{
isMe
:
true
,
...
...
apps/shopping/models/cart.js
View file @
5f3c633
...
...
@@ -132,40 +132,40 @@ const toggleSelectGoods = (params) => {
_
.
merge
(
params
,
{
method
});
/*
let resultData;
let skus = JSON.parse(params.product_sku_list).map(sku => return sku.product_sku);
const skusLen = skus.length;
_.merge(params, {method});
return getCartData(params.shopping_key, params.uid).then(function(result) {
// 检查库存量
resultData = result.data;
_.find(
_.concat(resultData.ordinary_cart_data.goods_list, resultData.advance_cart_data.goods_list),
(goodItem) => {
if (skusLen == 1 && goodItem.product_sku === skus[0] &&
(parseInt(goodItem.buy_number, 10) > parseInt(goodItem.storage_number, 10))) {
// 单个商品
return {
code: '1000',
message: '您勾选的商品库存不足'
};
} else {
if((parseInt(goodItem.buy_number, 10) > parseInt(goodItem.storage_number, 10))) {
// 全选
return api.get('', params).then(result => {
return _.merge(result, {
code: '1001',
message: '您全选的商品中存在库存不足商品,已帮您自动取消勾选'
})
});
}
}
});
});
*/
let resultData;
let skus = JSON.parse(params.product_sku_list).map(sku => return sku.product_sku);
const skusLen = skus.length;
_.merge(params, {method});
return getCartData(params.shopping_key, params.uid).then(function(result) {
// 检查库存量
resultData = result.data;
_.find(
_.concat(resultData.ordinary_cart_data.goods_list, resultData.advance_cart_data.goods_list),
(goodItem) => {
if (skusLen == 1 && goodItem.product_sku === skus[0] &&
(parseInt(goodItem.buy_number, 10) > parseInt(goodItem.storage_number, 10))) {
// 单个商品
return {
code: '1000',
message: '您勾选的商品库存不足'
};
} else {
if((parseInt(goodItem.buy_number, 10) > parseInt(goodItem.storage_number, 10))) {
// 全选
return api.get('', params).then(result => {
return _.merge(result, {
code: '1001',
message: '您全选的商品中存在库存不足商品,已帮您自动取消勾选'
})
});
}
}
});
});
*/
return
api
.
get
(
''
,
params
);
};
...
...
@@ -300,19 +300,22 @@ const filterCartData = (result, uid) => {
if
(
_
.
has
(
result
,
'data.ordinary_cart_data.promotion_info'
))
{
let
promotions
=
result
.
data
.
ordinary_cart_data
.
promotion_info
;
let
promotion
=
_
.
find
(
promotions
,
p
=>
{
return
p
.
promotion_type
===
'FreeShippingCost'
;
});
_
.
each
(
promotions
,
p
=>
{
if
(
promotion
)
{
freeShippingTip
=
promotion
.
promotion_title
;
}
if
(
p
.
promotion_type
===
'VipFreeShippingCost'
)
{
freeShippingTip
=
p
.
promotion_title
;
}
if
(
p
.
promotion_type
===
'FreeShippingCost'
)
{
freeShippingTip
=
p
.
promotion_title
;
}
});
}
return
_
.
merge
(
resData
,
{
hasGoods
:
advancedGoods
.
length
||
ordinaryGoods
.
length
||
invalidGoods
.
length
,
preSalePros
:
(
advancedSoldOutGoods
.
length
||
advancedGoods
.
length
)
?
_
.
concat
(
advancedGoods
,
advancedSoldOutGoods
)
:
[],
_
.
concat
(
advancedGoods
,
advancedSoldOutGoods
)
:
[],
commonPros
:
ordinaryGoods
,
invalidPros
:
invalidGoods
,
selectedNum
:
selectedAdvanceNum
+
selectedOrdinaryNum
,
...
...
Please
register
or
login
to post a comment