Authored by 陈峰

套餐优化bug

... ... @@ -241,7 +241,6 @@ let getProductData = (data) => {
productList: productProcess.processProductList(bundleData && bundleData.productList)
};
}
/* 量贩 */
if (bundleData && _.get(bundleData, 'bundleInfo.discountType', null) === 2) {
finalResult.discountBuy = {
... ... @@ -502,9 +501,11 @@ let getNewProductAsyncData = (data) => {
}
finalResult.isStudent = data.isStudent;
let discountBuy = _.find(bundleData, bund => _.get(bund, 'bundleInfo.discountType') === 2);
/* 量贩 */
if (bundleData && _.get(bundleData, 'bundleInfo.discountType', null) === 2) {
let minBuyNum = _.get(bundleData, 'bundleInfo.bundleCount', 1);
if (bundleData && discountBuy) {
let minBuyNum = discountBuy.bundleInfo.bundleCount;
let isNotEnough = true;
// 是否满足量贩购买要求:剩余商品数量大于量贩最小购买量
... ... @@ -523,8 +524,8 @@ let getNewProductAsyncData = (data) => {
finalResult.discountBuy = {
num: minBuyNum,
promotionPhrase: _.get(bundleData, 'bundleInfo.promotionPhrase', ''),
discount: _.get(bundleData, 'bundleInfo.discount', '')
promotionPhrase: discountBuy.bundleInfo.promotionPhrase,
discount: discountBuy.bundleInfo.discount
};
}
return finalResult;
... ...
... ... @@ -333,8 +333,10 @@ const newDetail = {
let bundleDatas = _.get(info[5], 'data', []);
/* 量贩 */
if (_.some(bundleDatas, data => data.discountType === 2)) {
tool.processDiscount(finalResult, _.find(bundleDatas, data => data.discountType === 2));
if (_.some(bundleDatas, data => _.get(data, 'bundleInfo.discountType') === 2)) {
let discountBuy = _.find(bundleDatas, bund => _.get(bund, 'bundleInfo.discountType') === 2);
tool.processDiscount(finalResult, discountBuy);
} else { /* 套装 */
finalResult.bundleDatas = _.map(bundleDatas, (data, index) => {
return tool.processBundle(data, skn, productId, ++index);
... ...