|
@@ -229,8 +229,10 @@ const filterCartData = (result, uid) => { |
|
@@ -229,8 +229,10 @@ const filterCartData = (result, uid) => { |
229
|
let invalidGoods = [];
|
229
|
let invalidGoods = [];
|
230
|
|
230
|
|
231
|
// 库存不足商品
|
231
|
// 库存不足商品
|
232
|
- // 售罄商品当作失效商品处理
|
|
|
233
|
- let soldOutGoods = [];
|
232
|
+ // 售罄商品当作一般商品处理
|
|
|
233
|
+ // sold_out_goods_list
|
|
|
234
|
+ let advancedSoldOutGoods = [];
|
|
|
235
|
+ let ordinarySoldOutGoods = [];
|
234
|
|
236
|
|
235
|
// 商品总数量
|
237
|
// 商品总数量
|
236
|
let buyNumber;
|
238
|
let buyNumber;
|
|
@@ -249,7 +251,7 @@ const filterCartData = (result, uid) => { |
|
@@ -249,7 +251,7 @@ const filterCartData = (result, uid) => { |
249
|
totalAdvanceMoney = advancedCartData.shopping_cart_data.last_order_amount;
|
251
|
totalAdvanceMoney = advancedCartData.shopping_cart_data.last_order_amount;
|
250
|
advancedGoods = _.concat(advancedGoods, advancedCartData.goods_list);
|
252
|
advancedGoods = _.concat(advancedGoods, advancedCartData.goods_list);
|
251
|
invalidGoods = _.concat(invalidGoods, advancedCartData.off_shelves_goods_list);
|
253
|
invalidGoods = _.concat(invalidGoods, advancedCartData.off_shelves_goods_list);
|
252
|
- soldOutGoods = _.concat(soldOutGoods, advancedCartData.sold_out_goods_list);
|
254
|
+ advancedSoldOutGoods = _.concat(advancedSoldOutGoods, advancedCartData.sold_out_goods_list);
|
253
|
|
255
|
|
254
|
_.forEach(advancedGoods, function(good) {
|
256
|
_.forEach(advancedGoods, function(good) {
|
255
|
buyNumber = parseInt(good.buy_number, 10);
|
257
|
buyNumber = parseInt(good.buy_number, 10);
|
|
@@ -273,7 +275,7 @@ const filterCartData = (result, uid) => { |
|
@@ -273,7 +275,7 @@ const filterCartData = (result, uid) => { |
273
|
totalOrdinaryMoney = ordinaryCartData.shopping_cart_data.last_order_amount;
|
275
|
totalOrdinaryMoney = ordinaryCartData.shopping_cart_data.last_order_amount;
|
274
|
ordinaryGoods = _.concat(ordinaryGoods, ordinaryCartData.goods_list);
|
276
|
ordinaryGoods = _.concat(ordinaryGoods, ordinaryCartData.goods_list);
|
275
|
invalidGoods = _.concat(invalidGoods, ordinaryCartData.off_shelves_goods_list);
|
277
|
invalidGoods = _.concat(invalidGoods, ordinaryCartData.off_shelves_goods_list);
|
276
|
- soldOutGoods = _.concat(soldOutGoods, ordinaryCartData.sold_out_goods_list);
|
278
|
+ ordinarySoldOutGoods = _.concat(ordinarySoldOutGoods, ordinaryCartData.sold_out_goods_list);
|
277
|
|
279
|
|
278
|
_.forEach(ordinaryGoods, function(good) {
|
280
|
_.forEach(ordinaryGoods, function(good) {
|
279
|
buyNumber = parseInt(good.buy_number, 10);
|
281
|
buyNumber = parseInt(good.buy_number, 10);
|
|
@@ -294,9 +296,11 @@ const filterCartData = (result, uid) => { |
|
@@ -294,9 +296,11 @@ const filterCartData = (result, uid) => { |
294
|
|
296
|
|
295
|
return _.merge(resData, {
|
297
|
return _.merge(resData, {
|
296
|
hasGoods: advancedGoods.length || ordinaryGoods.length || invalidGoods.length,
|
298
|
hasGoods: advancedGoods.length || ordinaryGoods.length || invalidGoods.length,
|
297
|
- preSalePros: advancedGoods.length ? _.groupBy(advancedGoods, 'brand_id') : [],
|
|
|
298
|
- commonPros: ordinaryGoods.length ? _.groupBy(ordinaryGoods, 'brand_id') : [],
|
|
|
299
|
- invalidPros: _.concat(invalidGoods, soldOutGoods),
|
299
|
+ preSalePros: (advancedSoldOutGoods.length || advancedGoods.length) ?
|
|
|
300
|
+ _.groupBy(_.concat(advancedGoods, advancedSoldOutGoods), 'brand_id') : [],
|
|
|
301
|
+ commonPros: (ordinarySoldOutGoods.length || ordinaryGoods.length) ?
|
|
|
302
|
+ _.groupBy(_.concat(ordinaryGoods, ordinarySoldOutGoods), 'brand_id') : [],
|
|
|
303
|
+ invalidPros: invalidGoods,
|
300
|
selectedNum: selectedAdvanceNum + selectedOrdinaryNum,
|
304
|
selectedNum: selectedAdvanceNum + selectedOrdinaryNum,
|
301
|
checkAll: totalNum === (selectedAdvanceNum + selectedOrdinaryNum),
|
305
|
checkAll: totalNum === (selectedAdvanceNum + selectedOrdinaryNum),
|
302
|
totalMoney: totalAdvanceMoney + totalOrdinaryMoney,
|
306
|
totalMoney: totalAdvanceMoney + totalOrdinaryMoney,
|