...
|
...
|
@@ -35,6 +35,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 * () {
|
...
|
...
|
@@ -1007,6 +1008,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信息
|
|
|
*
|
...
|
...
|
@@ -1101,6 +1115,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');
|
...
|
...
|
@@ -1143,6 +1160,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;
|
...
|
...
|
@@ -1151,6 +1179,20 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => { |
|
|
let coupon = requestData.coupon;
|
|
|
let limitedInfo = requestData.limited;
|
|
|
let bundle = requestData.bundle;
|
|
|
let recommendKeywords = requestData.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);
|
...
|
...
|
@@ -1238,9 +1280,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;
|
...
|
...
|
@@ -1719,7 +1758,6 @@ const getPackage = co(function * (skn) { |
|
|
return resData;
|
|
|
});
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
getShareOrderListAsync: commentService.getShareOrderListAsync, // 获取评论列表
|
|
|
indexConsultAsync: consultService.indexAsync, // 获取咨询列表
|
...
|
...
|
|