Authored by yyq

price desc

... ... @@ -10,12 +10,15 @@ const cache = global.yoho.cache;
const logger = global.yoho.logger;
const helpers = global.yoho.helpers;
const _ = require('lodash');
const $ = require('cheerio');
const SearchServiceModel = require('./search-api');
const GuangServiceModel = require('../../guang/models/guang-service');
const productProcess = require('../../../utils/product-process');
const uuid = require('uuid');
const specialDescCache = {};
function _cacheGet(key) {
return cache.get(key).then((data) => {
if (data) {
... ... @@ -236,6 +239,36 @@ module.exports = class extends global.yoho.BaseModel {
});
}
/**
* 特别说明
*/
getSpecialDesc(skn) {
let now = new Date().getTime();
if (specialDescCache.time && now - specialDescCache.time < ONE_HOUR * 1000) {
return Promise.resolve(specialDescCache.value);
}
return this.get({
data: {
method: 'app.product.intro',
product_skn: skn,
app_version: '5.6.0'
},
param: {cache: true}
}).then(result => {
result = _.isString(result) ? result : '';
result = $.load(result);
result = result('.price-description > .price-desc-detail');
specialDescCache.time = now;
specialDescCache.value = result.html() || '';
return specialDescCache.value;
});
}
// 根据mid_sort从redis获取分类下的hot关键词
_getRecommendHotKeywords(midSort, skn) { // eslint-disable-line
return redis.all([['get', `global:yoho:seo:hot:keywords:${midSort}:page`]]).then(res => {
... ...
... ... @@ -46,7 +46,8 @@ function _getProductIntroAsync(productId, productSkn) {
sizeInfo: this.productAPI.sizeInfoAsync(productSkn),
productComfort: this.productAPI.getProductComfortAsync(productId),
productModelTry: this.productAPI.getProductModelTryAsync(productSkn),
banner: this.productAPI.getProductBannerAsync(productId)
banner: this.productAPI.getProductBannerAsync(productId),
specialDesc: this.productAPI.getSpecialDesc(productSkn)
});
return result;
... ... @@ -911,6 +912,9 @@ function _getIntroInfo(productSkn, maxSortId, additionalData) {
// 商品详情页介绍
result.details = _getDetailDataBySizeInfo(sizeInfo);
// 特别说明
result.specialDesc = additionalData.specialDesc;
return result;
}
... ... @@ -1576,6 +1580,7 @@ function showMainAsync(req, data) {
// 最近浏览,最多5条记录
result.detail.latestWalk = 5;
return result;
}).bind(this)().catch(console.log);
}
... ...
... ... @@ -37,6 +37,7 @@
{{> product/introduction}}
{{> product/comment}}
{{> product/consult}}
{{> product/special-desc}}
</div>
</div>
... ...
{{#if specialDesc}}
<div class="special-desc info-block getnav">
<p class="block-title">
<span class="title-head"> <span class="title cur">特别说明</span> </span>
</p>
<div class="special-desc-content">
{{{specialDesc}}}
</div>
</div>
{{/if}}
... ...
... ... @@ -1765,6 +1765,31 @@
}
}
.special-desc {
margin-top: 82px;
.special-desc-content {
font-size: 14px;
line-height: 1.5;
font-weight: 300;
margin-top: -10px;
> p {
margin-bottom: 14px;
}
.price-item-name {
color: #000;
padding-top: 6px;
font-weight: normal;
}
.price-summary {
margin-top: 28px;
}
}
}
.after-service {
text-align: center;
margin-top: 30px;
... ...