...
|
...
|
@@ -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);
|
|
|
};
|
|
|
|
...
|
...
|
@@ -295,15 +295,33 @@ const filterCartData = (result, uid) => { |
|
|
});
|
|
|
}
|
|
|
|
|
|
let freeShippingTip = '';
|
|
|
|
|
|
if (_.has(result, 'data.ordinary_cart_data.promotion_info')) {
|
|
|
let promotions = result.data.ordinary_cart_data.promotion_info;
|
|
|
|
|
|
_.each(promotions, p => {
|
|
|
|
|
|
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,
|
|
|
checkAll: totalNum === (selectedAdvanceNum + selectedOrdinaryNum),
|
|
|
totalMoney: totalAdvanceMoney + totalOrdinaryMoney,
|
|
|
freeShippingTip: freeShippingTip,
|
|
|
noStorage
|
|
|
});
|
|
|
};
|
...
|
...
|
|