Authored by yyq

global detail

... ... @@ -32,8 +32,8 @@ exports.list = (req, res, next) => {
exports.detail = (req, res, next) => {
globalModel.getGlobalProductDetailData(req.params[0], req.yoho.channelNum,
req.yoho.channel).then(result => {
res.render('global/detail', Object.assign({
page: 'detail'
}, result));
}).catch(next);
res.render('global/detail', Object.assign({
page: 'detail'
}, result));
}).catch(next);
};
... ...
... ... @@ -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 || ''
... ...
<div class="global-detail-page yoho-page">
<div class="global-detail-page product-detail-page yoho-page">
{{>product/brand-banner}}
<div class="center-content product-detail-page">
<div class="main">
<div class="center-content">
{{> common/path-nav}}
<div class="main clearfix">
{{# goodsInfo}}
<div class="pull-left imgs clearfix">
<div class="pull-left img">
... ... @@ -24,7 +26,6 @@
</div>
</div>
<div id="thumbs" class="pull-right thumbs">
{{log goods_list}}
{{# goods_list}}
<div class="thumb-wrap{{#unless focus}} hide{{/unless}}">
{{#if focus}}
... ... @@ -50,7 +51,37 @@
<div class="line"></div>
{{> product/price-list}}
<p class="market-price">
{{# formart_orign_price}}
<span class="price-row">
<span class="title"><s></s>价:</span>
<span class="price has-other-price">{{.}}</span>
</span><br>
{{/ formart_orign_price}}
{{# formart_final_price}}
<span class="price-row">
<span class="title">当前价:</span>
<span class="price">{{.}}</span>
</span>
{{/ formart_final_price}}
{{#if promotion}}
<span class="desc">
<span class="promotion">{{promotion}}</span>
</span>
{{/if}}
</p>
<p class="foreign-price">
{{# format_market_price}}
<span class="title">原 价:</span>
<span class="price">{{.}}</span>
{{/ format_market_price}}
{{# format_sales_price}}
<span class="title">当前价:</span>
<span class="price">{{.}}</span>
{{/ format_sales_price}}
</p>
<div class="line"></div>
... ... @@ -78,9 +109,21 @@
</div>
</div>
<div class="extra-tip">
<a href="#">全球购物须知</a>
<ul class="global-buy-tips">
{{# illustrate_contents}}
<li>
{{title}} >
<div class="hover-tip">{{content}}</div>
</li>
{{/ illustrate_contents}}
</ul>
</div>
</div>
{{/ goodsInfo}}
</div>
<div class="global-detail-wrap">{{{detailHtml}}}</div>
</div>
... ...
... ... @@ -10,10 +10,12 @@
<a class="home" href="{{homeUrl}}" title="{{brandName}}">
<span class="iconfont">&#xe61a;</span>
</a>
<span id="brand-favour" class="brand-fav{{#if isCollect}} coled{{/if}}" data-id="{{brandId}}">
<i class="iconfont">&#xe641;</i>
<span class="fav-num"></span>
</span>
{{#if brandId}}
<span id="brand-favour" class="brand-fav{{#if isCollect}} coled{{/if}}" data-id="{{brandId}}">
<i class="iconfont">&#xe641;</i>
<span class="fav-num"></span>
</span>
{{/if}}
</div>
</div>
{{/if}}
... ...
... ... @@ -74,3 +74,4 @@
<span class="date">{{arrivalDate}}</span>
</div>
{{/if}}
</p>
... ...
... ... @@ -14,6 +14,54 @@
}
}
.main .foreign-price {
> * {
color: #b0b0b0;
font-weight: 300;
}
.price {
font-size: 13px;
margin-right: 20px;
}
}
.extra-tip {
font-size: 13px;
> a {
color: #f00;
text-decoration: underline;
}
.global-buy-tips {
padding-top: 20px;
> li {
float: left;
margin-right: 60px;
cursor: default;
&:hover > .hover-tip {
display: block;
}
}
.hover-tip {
width: 220px;
line-height: 1.5;
padding: 10px;
color: #666;
font-size: 12px;
background-color: #fff;
border: 1px solid #ddd;
margin-top: 6px;
display: none;
position: absolute;
}
}
}
.global-detail-wrap {
padding: 30px 0;
}
... ...