...
|
...
|
@@ -4,6 +4,8 @@ |
|
|
'use strict';
|
|
|
const _ = require('lodash');
|
|
|
const commentModel = require('./consult-comment');
|
|
|
const bundle = require('./bundle');
|
|
|
const productProcess = require(`${utils}/product-process`);
|
|
|
|
|
|
|
|
|
const api = global.yoho.API;
|
...
|
...
|
@@ -205,6 +207,23 @@ const tool = { |
|
|
});
|
|
|
}
|
|
|
return feedbacks;
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 套餐数据处理
|
|
|
* @param bundleData
|
|
|
* @param skn
|
|
|
* @returns {{}}
|
|
|
*/
|
|
|
processBundle(bundleData, skn) {
|
|
|
return {
|
|
|
title: '优惠套装',
|
|
|
href: helpers.urlFormat('/product/bundle/detail', {skn: skn}),
|
|
|
description: '立省¥' +
|
|
|
(parseInt(_.get(bundleData, 'bundleInfo.salesPrice', 0), 10) -
|
|
|
parseInt(_.get(bundleData, 'bundleInfo.discountPrice', 0), 10)) + '元',
|
|
|
productList: productProcess.processProductList(bundleData && bundleData.productList)
|
|
|
};
|
|
|
}
|
|
|
};
|
|
|
|
...
|
...
|
@@ -253,7 +272,8 @@ const newDetail = { |
|
|
}), // 1 评论信息
|
|
|
commentModel.getCommonConsult(), // 2 默认咨询信息
|
|
|
commentModel.getConsults(productId, 1, 2), // 3 咨询列表
|
|
|
this.queryPromotion(skn) // 4 促销活动
|
|
|
this.queryPromotion(skn), // 4 促销活动
|
|
|
bundle.getBundleBySkn(skn)
|
|
|
]).then(info => {
|
|
|
let finalResult = {
|
|
|
promotion: null,
|
...
|
...
|
@@ -272,6 +292,20 @@ const newDetail = { |
|
|
userConsult: info[3]
|
|
|
}, productId);
|
|
|
|
|
|
let bundleData = _.get(info[5], 'data', null);
|
|
|
|
|
|
/* 套装 */
|
|
|
if (bundleData && _.get(bundleData, 'bundleInfo.discountType', null) === 1) {
|
|
|
finalResult.bundleData = tool.processBundle(bundleData, skn);
|
|
|
}
|
|
|
|
|
|
/* 量贩 */
|
|
|
if (bundleData && _.get(bundleData, 'bundleInfo.discountType', null) === 2) {
|
|
|
finalResult.discountBuy = {
|
|
|
num: _.get(bundleData, 'bundleInfo.bundleCount', 1),
|
|
|
promotionPhrase: _.get(bundleData, 'bundleInfo.promotionPhrase', '')
|
|
|
};
|
|
|
}
|
|
|
return finalResult;
|
|
|
});
|
|
|
},
|
...
|
...
|
|