...
|
...
|
@@ -7,6 +7,10 @@ |
|
|
'use strict';
|
|
|
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
const helpers = global.yoho.helpers;
|
|
|
|
|
|
const homeService = require('./home-service');
|
|
|
const globalApi = require('./global-api');
|
|
|
const headerModel = require('../../../doraemon/models/header');
|
|
|
const searchHandler = require('./search-handler');
|
...
|
...
|
@@ -60,6 +64,38 @@ const getGlobalProductDetailData = (skn, channelNum, channel) => { |
|
|
if (+result.detail.code === 200) {
|
|
|
detailInfo = _.get(result, 'detail.data', {});
|
|
|
|
|
|
let brandInfo = detailInfo.brand_info || {};
|
|
|
|
|
|
resData.banner = {
|
|
|
bgColor: '#000',
|
|
|
homeUrl: helpers.urlFormat('/product/global/list', {brand: brandInfo.brand_id}),
|
|
|
brandName: brandInfo.brand_name,
|
|
|
logo: brandInfo.brand_ico
|
|
|
};
|
|
|
|
|
|
resData.pathNav = _.concat(
|
|
|
homeService.getHomeChannelNav(channel),
|
|
|
[
|
|
|
{name: '全球购', href: helpers.urlFormat('/product/global/list')},
|
|
|
{name: detailInfo.product_name || ''}
|
|
|
]
|
|
|
);
|
|
|
|
|
|
if (detailInfo.orign_price - detailInfo.final_price === 0) {
|
|
|
_.unset(detailInfo, 'formart_orign_price');
|
|
|
} else {
|
|
|
detailInfo.promotion = ((detailInfo.final_price / detailInfo.orign_price) * 10).toFixed(1);
|
|
|
|
|
|
// 只显示大于1折小于9折的折扣
|
|
|
if (detailInfo.promotion <= 1.0 || detailInfo.promotion >= 9.0) {
|
|
|
detailInfo.promotion = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (detailInfo.market_price - detailInfo.sales_price === 0) {
|
|
|
_.unset(detailInfo, 'format_market_price');
|
|
|
}
|
|
|
|
|
|
if (!_.isEmpty(detailInfo.goods_list)) {
|
|
|
let colors = [];
|
|
|
|
...
|
...
|
@@ -108,7 +144,6 @@ const getGlobalProductDetailData = (skn, channelNum, channel) => { |
|
|
html = html.replace(/<script.*?>.*?<\/script>/ig, '');
|
|
|
}
|
|
|
|
|
|
// console.log(result.detail.code);
|
|
|
Object.assign(resData, result.header, {
|
|
|
goodsInfo: detailInfo,
|
|
|
detailHtml: html || ''
|
...
|
...
|
|