...
|
...
|
@@ -9,6 +9,7 @@ |
|
|
const Promise = require('bluebird');
|
|
|
const co = Promise.coroutine;
|
|
|
const moment = require('moment');
|
|
|
const url = require('url');
|
|
|
const _ = require('lodash');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
|
...
|
...
|
@@ -729,7 +730,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => { |
|
|
}
|
|
|
|
|
|
// 分享相关,产品的链接
|
|
|
result.weixinUrl = helpers.urlFormat(origin.productUrl, {}, 'item');
|
|
|
result.weixinUrl = origin.productUrl;
|
|
|
result.shareTitle = result.name;
|
|
|
result.shareImg = 'http:' + result.img; // 分享图片必须使用http
|
|
|
result.shareDesc = result.phrase;
|
...
|
...
|
@@ -755,31 +756,31 @@ const _detailDataPkg = (origin, uid, vipLevel) => { |
|
|
if (domainBrand.type && domainBrand.shopId) {
|
|
|
switch (parseInt(domainBrand.type, 10)) {
|
|
|
case 1:
|
|
|
{
|
|
|
{
|
|
|
// 多品店不显示
|
|
|
banner = [];
|
|
|
break;
|
|
|
}
|
|
|
banner = [];
|
|
|
break;
|
|
|
}
|
|
|
case 2:
|
|
|
{
|
|
|
{
|
|
|
// 单品店显示新版的店铺banner
|
|
|
let basisData = yield shopService.basisTemplateAsync(domainBrand.shopId);
|
|
|
let basisData = yield shopService.basisTemplateAsync(domainBrand.shopId);
|
|
|
|
|
|
banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
|
|
|
break;
|
|
|
}
|
|
|
banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
|
|
|
break;
|
|
|
}
|
|
|
default:
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
statGoodsInfo.imageUrl = result.img;
|
|
|
statGoodsInfo.productUrl = result.weixinUrl;
|
|
|
statGoodsInfo.imageUrl = 'http:' + result.img;
|
|
|
statGoodsInfo.productUrl = 'http:' + helpers.urlFormat(url.parse(origin.productUrl).pathname, {}, 'item');
|
|
|
statGoodsInfo.smallSortId = result.smallSortId;
|
|
|
statGoodsInfo.soldOut = parseInt(soldOut);
|
|
|
statGoodsInfo.soldOut = soldOut ? 1 : 0;
|
|
|
|
|
|
return {
|
|
|
goodsInfo: result,
|
...
|
...
|
@@ -1338,7 +1339,8 @@ const showMainAsync = (data) => { |
|
|
let currentUserProductInfo = _.partial(_detailDataPkg, _, data.uid, data.vipLevel);
|
|
|
|
|
|
// 获取商品信息
|
|
|
let productInfo = yield productAPI.getProductAsync(data.pid, data.uid, data.isStudent, data.vipLevel).then(currentUserProductInfo);
|
|
|
let productInfo = yield productAPI.getProductAsync(data.pid, data.uid, data.isStudent, data.vipLevel)
|
|
|
.then(currentUserProductInfo);
|
|
|
|
|
|
if (_.isEmpty(productInfo) || _.isEmpty(productInfo.goodsInfo)) {
|
|
|
return Promise.reject({
|
...
|
...
|
@@ -1348,7 +1350,8 @@ const showMainAsync = (data) => { |
|
|
|
|
|
let requestData = yield Promise.all([
|
|
|
_getSortNavAsync(productInfo.goodsInfo.smallSortId, data.gender),
|
|
|
HeaderModel.requestHeaderData(data.channel)
|
|
|
HeaderModel.requestHeaderData(data.channel),
|
|
|
productAPI.isSupportReturnedSale(productInfo.goodsInfo.skn)
|
|
|
]);
|
|
|
|
|
|
// 分类导航 ,seo
|
...
|
...
|
@@ -1372,6 +1375,10 @@ const showMainAsync = (data) => { |
|
|
productInfo.statGoodsInfo
|
|
|
);
|
|
|
|
|
|
// 是否支持退换货,true 支持,false 不支持
|
|
|
result.detail.supportSaleReturnedService =
|
|
|
_.get(requestData, `[2].data.${productInfo.goodsInfo.skn}`, 'N') === 'N';
|
|
|
|
|
|
// 导航
|
|
|
result.detail.pathNav = _.concat(
|
|
|
homeService.getHomeChannelNav(data.channel),
|
...
|
...
|
|