...
|
...
|
@@ -98,17 +98,20 @@ const formatCartGoods = (goodData, isAdvanceCart, isValid = true, inValidLow = f |
|
|
count: goodData.buy_number,
|
|
|
promotion_id: _.toNumber(goodData.promotion_id) === 0 ? '' : goodData.promotion_id
|
|
|
};
|
|
|
goodData.storage_number = _.parseInt(goodData.storage_number);
|
|
|
goodData.min_buy_number = _.parseInt(goodData.min_buy_number);
|
|
|
goodData.buy_number = _.parseInt(goodData.buy_number);
|
|
|
|
|
|
if (goodData.min_buy_number && goodData.min_buy_number > 1) {
|
|
|
result.minNumber = parseInt(goodData.min_buy_number, 10);
|
|
|
if (goodData.min_buy_number && goodData.min_buy_number > 0) {
|
|
|
result.minNumber = goodData.min_buy_number;
|
|
|
}
|
|
|
result.maxNumber = parseInt(goodData.storage_number, 10);
|
|
|
result.minSelectNum = parseInt(goodData.buy_number, 10) <= parseInt(goodData.min_buy_number, 10) || parseInt(goodData.buy_number, 10) === 1;
|
|
|
result.maxSelectNum = parseInt(goodData.buy_number, 10) >= parseInt(goodData.storage_number, 10) && goodData.goods_type === 'ordinary';
|
|
|
result.maxNumber = goodData.storage_number;
|
|
|
result.minSelectNum = goodData.buy_number <= goodData.min_buy_number || goodData.buy_number === 1;
|
|
|
result.maxSelectNum = goodData.buy_number >= goodData.storage_number && goodData.goods_type === 'ordinary';
|
|
|
|
|
|
if (isValid) {
|
|
|
// 库存不足
|
|
|
result.lowStocks = (goodData.buy_number > goodData.storage_number);
|
|
|
result.lowStocks = goodData.buy_number > goodData.storage_number;
|
|
|
} else { // 失效商品
|
|
|
result.inValid = true;
|
|
|
result.inValidLow = inValidLow;
|
...
|
...
|
@@ -217,7 +220,7 @@ const procGoodsDetail = (productData, num) => { |
|
|
}
|
|
|
data.num = 1;
|
|
|
if (num) {
|
|
|
data.num = parseInt(num, 10);
|
|
|
data.num = _.parseInt(num);
|
|
|
}
|
|
|
|
|
|
// 商品选择
|
...
|
...
|
@@ -252,7 +255,7 @@ const procGoodsDetail = (productData, num) => { |
|
|
goodsId: val.goods_id,
|
|
|
colorId: val.color_id,
|
|
|
name: one.size_name,
|
|
|
sizeNum: parseInt(one.storage_number, 10),
|
|
|
sizeNum: _.parseInt(one.storage_number, 10),
|
|
|
sizeInfo: one.size_info ? one.size_info : ''
|
|
|
});
|
|
|
|
...
|
...
|
@@ -263,9 +266,9 @@ const procGoodsDetail = (productData, num) => { |
|
|
sizeInfo: one.size_info ? one.size_info : ''
|
|
|
} : allSizeList[sizeName];
|
|
|
|
|
|
colorNum += parseInt(one.storage_number, 10);
|
|
|
colorNum += _.parseInt(one.storage_number, 10);
|
|
|
|
|
|
colorStorageGroup[val.product_skc][sizeName] = parseInt(one.storage_number, 10);
|
|
|
colorStorageGroup[val.product_skc][sizeName] = _.parseInt(one.storage_number, 10);
|
|
|
});
|
|
|
|
|
|
// 颜色分组
|
...
|
...
|
@@ -320,7 +323,7 @@ const procGoodsDetail = (productData, num) => { |
|
|
id: colorArr.id,
|
|
|
skcId: colorArr.skcId,
|
|
|
name: colorArr.name,
|
|
|
colorNum: _.has(colorStorageGroup, `${colorArr.skcId}.${sName}`) ? parseInt(colorStorageGroup[colorArr.skcId][sName], 10) : 0,
|
|
|
colorNum: _.has(colorStorageGroup, `${colorArr.skcId}.${sName}`) ? _.parseInt(colorStorageGroup[colorArr.skcId][sName], 10) : 0,
|
|
|
goodsName: colorArr.goodsName
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -454,7 +457,7 @@ const procCartData = (data, onlyGift = false, onlyAdvanceBuy = false, isAdvanceC |
|
|
let goodCount = _.sum(result.goods
|
|
|
.filter(good => good.lowStocks === false)
|
|
|
.map(good => {
|
|
|
return parseInt(good.count, 10);
|
|
|
return _.parseInt(good.count, 10);
|
|
|
})) + // 普通商品
|
|
|
|
|
|
_.sum(result.goodPools
|
...
|
...
|
@@ -464,13 +467,13 @@ const procCartData = (data, onlyGift = false, onlyAdvanceBuy = false, isAdvanceC |
|
|
return _.sum(_.get(subPool, 'goods', [])// 子促销池中的商品
|
|
|
.filter(good => good.lowStocks === false)
|
|
|
.map(good => {
|
|
|
return parseInt(good.count, 10);
|
|
|
return _.parseInt(good.count, 10);
|
|
|
}));
|
|
|
})) +
|
|
|
_.sum(_.get(goodPool, 'goods', []) // 大促销池中的商品
|
|
|
.filter(good => good.lowStocks === false)
|
|
|
.map(good => {
|
|
|
return parseInt(good.count, 10);
|
|
|
return _.parseInt(good.count, 10);
|
|
|
}));
|
|
|
}));
|
|
|
|
...
|
...
|
|