Authored by 陈峰

套餐优化bug

@@ -241,7 +241,6 @@ let getProductData = (data) => { @@ -241,7 +241,6 @@ let getProductData = (data) => {
241 productList: productProcess.processProductList(bundleData && bundleData.productList) 241 productList: productProcess.processProductList(bundleData && bundleData.productList)
242 }; 242 };
243 } 243 }
244 -  
245 /* 量贩 */ 244 /* 量贩 */
246 if (bundleData && _.get(bundleData, 'bundleInfo.discountType', null) === 2) { 245 if (bundleData && _.get(bundleData, 'bundleInfo.discountType', null) === 2) {
247 finalResult.discountBuy = { 246 finalResult.discountBuy = {
@@ -502,9 +501,11 @@ let getNewProductAsyncData = (data) => { @@ -502,9 +501,11 @@ let getNewProductAsyncData = (data) => {
502 } 501 }
503 finalResult.isStudent = data.isStudent; 502 finalResult.isStudent = data.isStudent;
504 503
  504 + let discountBuy = _.find(bundleData, bund => _.get(bund, 'bundleInfo.discountType') === 2);
  505 +
505 /* 量贩 */ 506 /* 量贩 */
506 - if (bundleData && _.get(bundleData, 'bundleInfo.discountType', null) === 2) {  
507 - let minBuyNum = _.get(bundleData, 'bundleInfo.bundleCount', 1); 507 + if (bundleData && discountBuy) {
  508 + let minBuyNum = discountBuy.bundleInfo.bundleCount;
508 let isNotEnough = true; 509 let isNotEnough = true;
509 510
510 // 是否满足量贩购买要求:剩余商品数量大于量贩最小购买量 511 // 是否满足量贩购买要求:剩余商品数量大于量贩最小购买量
@@ -523,8 +524,8 @@ let getNewProductAsyncData = (data) => { @@ -523,8 +524,8 @@ let getNewProductAsyncData = (data) => {
523 524
524 finalResult.discountBuy = { 525 finalResult.discountBuy = {
525 num: minBuyNum, 526 num: minBuyNum,
526 - promotionPhrase: _.get(bundleData, 'bundleInfo.promotionPhrase', ''),  
527 - discount: _.get(bundleData, 'bundleInfo.discount', '') 527 + promotionPhrase: discountBuy.bundleInfo.promotionPhrase,
  528 + discount: discountBuy.bundleInfo.discount
528 }; 529 };
529 } 530 }
530 return finalResult; 531 return finalResult;
@@ -333,8 +333,10 @@ const newDetail = { @@ -333,8 +333,10 @@ const newDetail = {
333 let bundleDatas = _.get(info[5], 'data', []); 333 let bundleDatas = _.get(info[5], 'data', []);
334 334
335 /* 量贩 */ 335 /* 量贩 */
336 - if (_.some(bundleDatas, data => data.discountType === 2)) {  
337 - tool.processDiscount(finalResult, _.find(bundleDatas, data => data.discountType === 2)); 336 + if (_.some(bundleDatas, data => _.get(data, 'bundleInfo.discountType') === 2)) {
  337 + let discountBuy = _.find(bundleDatas, bund => _.get(bund, 'bundleInfo.discountType') === 2);
  338 +
  339 + tool.processDiscount(finalResult, discountBuy);
338 } else { /* 套装 */ 340 } else { /* 套装 */
339 finalResult.bundleDatas = _.map(bundleDatas, (data, index) => { 341 finalResult.bundleDatas = _.map(bundleDatas, (data, index) => {
340 return tool.processBundle(data, skn, productId, ++index); 342 return tool.processBundle(data, skn, productId, ++index);