...
|
...
|
@@ -129,6 +129,10 @@ const formatCartGoods = (goodData, isAdvanceCart, isValid, inValidLow) => { |
|
|
result.inValidLow = inValidLow;
|
|
|
}
|
|
|
|
|
|
if (inValidLow && goodData.storage_number > 0) {
|
|
|
result.reAddToCart = true;
|
|
|
}
|
|
|
|
|
|
// gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
|
|
|
if (!goodData.goods_type) {
|
|
|
result.inValid = true;
|
...
|
...
|
@@ -156,6 +160,29 @@ const formatCartGoods = (goodData, isAdvanceCart, isValid, inValidLow) => { |
|
|
result.link = helpers.urlFormat(`/product/${goodData.product_skn}.html`); // 商品url改版
|
|
|
return result;
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 失效商品池数据处理
|
|
|
* @param {*} pool
|
|
|
*/
|
|
|
const formatValidPool = (pool) => {
|
|
|
let poolTemp = {
|
|
|
poolBuyNumber: pool.pool_buy_number,
|
|
|
poolId: pool.pool_id,
|
|
|
poolStorageNumber: pool.pool_storage_number,
|
|
|
poolTitle: pool.pool_title,
|
|
|
selected: pool.selected,
|
|
|
showCheckbox: false,
|
|
|
isBundle: true
|
|
|
};
|
|
|
|
|
|
poolTemp.goods = _.get(pool, 'goods_list', []).map(good => {
|
|
|
return formatCartGoods(good, false, false, true);
|
|
|
});
|
|
|
|
|
|
return poolTemp;
|
|
|
};
|
|
|
|
|
|
const procPriceGiftData = (data, promotionType) => {
|
|
|
let result = {};
|
|
|
let arrays = _.get(data, 'arrays', []);
|
...
|
...
|
@@ -256,7 +283,13 @@ const procCartData = (data, isAdvanceCart) => { |
|
|
return {
|
|
|
isBrand: pool.pool_type <= 1,
|
|
|
isPromotion: pool.pool_type === 2,
|
|
|
isBundle: pool.pool_type === 3,
|
|
|
poolTitle: pool.pool_title,
|
|
|
poolBuyNumber: pool.pool_buy_number,
|
|
|
poolId: pool.pool_id, // 套餐 activity_id
|
|
|
poolBatchNo: pool.pool_batch_no, // 套餐批次
|
|
|
selected: pool.selected === 'Y', // 套餐是否选中
|
|
|
poolStorageNumber: pool.pool_storage_number, // 库存数量
|
|
|
goods: _.get(pool, 'goods_list', []).map(good => {
|
|
|
return formatCartGoods(good, isAdvanceCart);
|
|
|
}),
|
...
|
...
|
@@ -285,6 +318,11 @@ const procCartData = (data, isAdvanceCart) => { |
|
|
return formatCartGoods(good, isAdvanceCart, false, true);
|
|
|
});
|
|
|
|
|
|
// 失效的商品池
|
|
|
result.notValidPool = _.get(data, 'sold_out_goods_pool', []).map(pool => {
|
|
|
return formatValidPool(pool);
|
|
|
});
|
|
|
|
|
|
// 下架的商品列表
|
|
|
result.offShelveGoods = _.get(data, 'off_shelves_goods_list', []).map(good => {
|
|
|
return formatCartGoods(good, isAdvanceCart, false);
|
...
|
...
|
@@ -347,7 +385,9 @@ const procCartData = (data, isAdvanceCart) => { |
|
|
result.count = data.shopping_cart_data.selected_goods_count;
|
|
|
result.isAllSelected = (goodCount <= data.shopping_cart_data.selected_goods_count) && (data.shopping_cart_data.selected_goods_count > 0);// eslint-disable-line
|
|
|
result.sumPrice = transPrice(data.shopping_cart_data.last_order_amount);
|
|
|
result.hasNoSaleGoods = result.notValidGoods.length || result.offShelveGoods.length;
|
|
|
result.hasNoSaleGoods = result.notValidGoods.length ||
|
|
|
result.offShelveGoods.length ||
|
|
|
result.notValidPool.length;
|
|
|
|
|
|
return result;
|
|
|
};
|
...
|
...
|
|