...
|
...
|
@@ -12,7 +12,7 @@ function AllGoodsSelect() { |
|
|
// 购物车商品唯一key
|
|
|
item.indexKey = `${item.product_sku}_${index++}`;
|
|
|
|
|
|
if (item.buy_number - item.storage_number > 0 ) {
|
|
|
if (item.buy_number - item.storage_number > 0) {
|
|
|
lowStorage = true;
|
|
|
} else if (item.goods_type !== 'gift' && item.selected !== 'Y') {
|
|
|
isSelectAll = false;
|
...
|
...
|
@@ -26,11 +26,11 @@ function AllGoodsSelect() { |
|
|
|
|
|
this.hasLowStorage = function() {
|
|
|
return lowStorage;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
this.getAllGoodsList = function() {
|
|
|
return goodsList;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
return this;
|
|
|
}
|
...
|
...
|
@@ -48,9 +48,10 @@ function _processPromotion(promotionList, isSub) { |
|
|
statuString = '去凑单';
|
|
|
break;
|
|
|
case 10:
|
|
|
if (promotion.promotion_type == 'Gift') { //Cashreduce, Degressdiscount, Cheapestfree, Discount,Gift,Needpaygift,SpecifiedAmount
|
|
|
// Cashreduce, Degressdiscount, Cheapestfree, Discount,Gift,Needpaygift,SpecifiedAmount
|
|
|
if (promotion.promotion_type === 'Gift') {
|
|
|
statuString = '领赠品';
|
|
|
} else if (promotion.promotion_type == 'Needpaygift') {
|
|
|
} else if (promotion.promotion_type === 'Needpaygift') {
|
|
|
statuString = '去换购';
|
|
|
}
|
|
|
break;
|
...
|
...
|
@@ -104,9 +105,10 @@ function _processGiftList(list, isGift) { |
|
|
return false;
|
|
|
}
|
|
|
|
|
|
let statusCount10 = 0;//已满足
|
|
|
let statusCount20 = 0;//已售罄
|
|
|
let statusCount10 = 0;// 已满足
|
|
|
let statusCount20 = 0;// 已售罄
|
|
|
let promotionArr = [];
|
|
|
|
|
|
list.map(item => {
|
|
|
switch (+item.status) {
|
|
|
case 10:
|
...
|
...
|
@@ -165,10 +167,11 @@ const formatOrdinaryCartData = (data, needAllGoods) => { |
|
|
|
|
|
// 商品池
|
|
|
let goodsPoolList = data.goods_pool_list;
|
|
|
|
|
|
if (goodsPoolList && goodsPoolList.length) {
|
|
|
goodsPoolList.map(item => {
|
|
|
if (item.pool_batch_no && item.pool_id) {
|
|
|
//套餐商品参数转换
|
|
|
// 套餐商品参数转换
|
|
|
item.int_pool_buy_number = parseInt(item.pool_buy_number, 10);
|
|
|
item.int_pool_storage_number = parseInt(item.pool_storage_number, 10);
|
|
|
}
|
...
|
...
|
@@ -179,11 +182,11 @@ const formatOrdinaryCartData = (data, needAllGoods) => { |
|
|
item.promotionMapId = pid++;
|
|
|
|
|
|
if (item.sub_pool && item.sub_pool.length) {
|
|
|
item.sub_pool.map(spItem => {
|
|
|
item.sub_pool.map(spItem => {
|
|
|
spItem.goods_list && allGoodsSelect.check(spItem.goods_list);
|
|
|
spItem.promotion_list = _processPromotion(spItem.promotion_list, true);
|
|
|
spItem.promotionMapId = pid++;
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
@@ -193,6 +196,7 @@ const formatOrdinaryCartData = (data, needAllGoods) => { |
|
|
|
|
|
// 商品列表
|
|
|
let goodsList = data.goods_list;
|
|
|
|
|
|
if (goodsList && goodsList.length) {
|
|
|
isEmptyCart = false;
|
|
|
allGoodsSelect.check(goodsList);
|
...
|
...
|
@@ -208,7 +212,7 @@ const formatOrdinaryCartData = (data, needAllGoods) => { |
|
|
priceGiftItem && gGiftAndPriceGiftList.push(priceGiftItem);
|
|
|
ordinaryCart.gGiftAndPriceGiftList = gGiftAndPriceGiftList;
|
|
|
|
|
|
//失效商品
|
|
|
// 失效商品
|
|
|
ordinaryCart.invalidGoodsList = [...(data.off_shelves_goods_list || []), ...(data.sold_out_goods_list || [])];
|
|
|
if (ordinaryCart.invalidGoodsList.length) {
|
|
|
isEmptyCart = false;
|
...
|
...
|
@@ -226,10 +230,9 @@ const formatOrdinaryCartData = (data, needAllGoods) => { |
|
|
|
|
|
return {
|
|
|
isEmptyCart,
|
|
|
// eslint-disable-next-line
|
|
|
...ordinaryCart
|
|
|
};
|
|
|
}
|
|
|
};
|
|
|
|
|
|
const changeGoodsListData = (list, selected) => {
|
|
|
let glist = [];
|
...
|
...
|
@@ -253,7 +256,7 @@ const changeGoodsListData = (list, selected) => { |
|
|
});
|
|
|
|
|
|
return glist;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
export default {
|
|
|
formatOrdinaryCartData,
|
...
|
...
|
|