...
|
...
|
@@ -36,6 +36,7 @@ const BLANK_STR = ' '; |
|
|
const BUNDLE_PRODUCE = 2; // 量贩
|
|
|
const BUNDLE_PACKAGE = 1; // 套餐
|
|
|
const tdk = require('../../../utils/getTDK');
|
|
|
const Helpers = global.yoho.helpers;
|
|
|
|
|
|
const _getProductAdditionInfoAsync = (data) => {
|
|
|
return co(function * () {
|
...
|
...
|
@@ -1009,6 +1010,19 @@ const _getIntroInfo = (productSkn, maxSortId, additionalData)=> { |
|
|
return result;
|
|
|
};
|
|
|
|
|
|
// 返回6条推荐关键词页面
|
|
|
const getKeywordsInfo = (keywords) => {
|
|
|
let res = [];
|
|
|
|
|
|
_.forEach(_.slice(_.shuffle(keywords), 0, 12), val => {
|
|
|
res.push({
|
|
|
url: Helpers.urlFormat(`/chanpin/${val.id}.html`),
|
|
|
keyword: val.keyword
|
|
|
});
|
|
|
});
|
|
|
return res;
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取seo信息
|
|
|
*
|
...
|
...
|
@@ -1103,6 +1117,9 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
// sku商品信息,尺寸信息
|
|
|
let skuData = _getSkuDataByProductBaseInfo(origin);
|
|
|
|
|
|
result.name = propOrigin('product_name');
|
|
|
result.skn = propOrigin('product_skn');
|
|
|
result.productId = propOrigin('product_id');
|
...
|
...
|
@@ -1145,6 +1162,17 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => { |
|
|
requestApi.bundle = productAPI.getBundleAsync(result.skn); // 量贩
|
|
|
}
|
|
|
|
|
|
// 找相似
|
|
|
if (skuData.totalStorageNum === 0) {
|
|
|
requestApi.alike = productAPI.getLikeAsync(result.skn);
|
|
|
}
|
|
|
|
|
|
// 相关推荐词
|
|
|
requestApi.recommendKeywords = productAPI.getRecommendKeywords(result.smallSortId);
|
|
|
|
|
|
// 店铺推荐直出(seo需要)
|
|
|
requestApi.shopRecommend = productAPI.getShopRecommendAsync(result.skn);
|
|
|
|
|
|
let requestData = yield Promise.props(requestApi);
|
|
|
|
|
|
let additionalData = requestData.addition;
|
...
|
...
|
@@ -1153,6 +1181,20 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => { |
|
|
let coupon = requestData.coupon;
|
|
|
let limitedInfo = requestData.limited;
|
|
|
let bundle = requestData.bundle;
|
|
|
let recommendKeywords = JSON.parse(requestData.recommendKeywords);
|
|
|
|
|
|
// 处理相似商品
|
|
|
result.alike = _.map(_.get(requestData, 'alike.data.product_list', ''), val =>{
|
|
|
return Object.assign({url: Helpers.getUrlBySkc(val.product_skn)}, val);
|
|
|
});
|
|
|
|
|
|
// 推荐关键词页面
|
|
|
result.recommendKeywords = getKeywordsInfo(recommendKeywords);
|
|
|
|
|
|
// 处理店铺推荐
|
|
|
result.shopRecommend = _.map(_.get(requestData, 'shopRecommend.data.product_list', ''), val =>{
|
|
|
return Object.assign({url: Helpers.getUrlBySkc(val.product_skn)}, val);
|
|
|
});
|
|
|
|
|
|
// 商品标签
|
|
|
result.tags = _getTagsDataByProductInfo(origin);
|
...
|
...
|
@@ -1240,9 +1282,6 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => { |
|
|
result.presale = 'Y';
|
|
|
}
|
|
|
|
|
|
// sku商品信息,尺寸信息
|
|
|
let skuData = _getSkuDataByProductBaseInfo(origin);
|
|
|
|
|
|
result.img = skuData.defaultImage;
|
|
|
result.colors = skuData.skuGoods;
|
|
|
let totalStorageNum = skuData.totalStorageNum;
|
...
|
...
|
@@ -1722,7 +1761,6 @@ const getPackage = co(function * (skn) { |
|
|
return resData;
|
|
|
});
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
getShareOrderListAsync: commentService.getShareOrderListAsync, // 获取评论列表
|
|
|
indexConsultAsync: consultService.indexAsync, // 获取咨询列表
|
...
|
...
|
|