Authored by 王水玲

sale

... ... @@ -132,8 +132,9 @@ exports.search = (req, res) => {
let params = Object.assign({}, req.query);
saleModel.getSearchData(params).then((result) => {
result.layout = false;
res.render('product', {
layout: false,
params: params,
goods: result
});
... ...
... ... @@ -44,12 +44,19 @@ const processTime = (time) => {
*/
const processSpecial = (list) => {
const formatData = [];
let flag = true;
list = list || [];
list = camelCase(list);
if (list.length === 1) {
flag = false;
}
_.forEach(list, (data) => {
data.specialUrl = `/product/specialDetail?id=${data.id}`;
if (flag === true) {
data.specialUrl = `/product/specialDetail?id=${data.id}`;
}
_.merge(data, processTime(data.leftTime));
... ... @@ -251,27 +258,6 @@ const processSearch = (list, options) => {
};
/**
* 折扣专场详情数据处理
*/
const processSpecialDetail = (data) => {
let activityData = {};
data[0] = data[0] || {};
data[0] = camelCase(data[0]);
_.merge(data[0], processTime(data[0].leftTime));
return activityData = {
title: data[0].title,
activity: {
coverUrl: data[0].coverUrl,
time: data[0].time,
leftTime: data[0].leftTime
}
};
};
/**
* 断码区分类数据处理
*/
const processBreakingSort = (list) => {
... ... @@ -311,6 +297,9 @@ exports.getSearchData = (params) => {
});
};
/**
* 获取资源位数据
*/
const getResources = (page) => {
const contentCode = {
sale: '7c2b77093421efa8ae9302c91460db73',
... ... @@ -330,6 +319,9 @@ const getResources = (page) => {
});
};
/**
* 获取断码区分类数据
*/
const getBreakingSort = (yhChannel) => {
return api.get('', sign.apiSign({
method: 'app.sale.getBreakingSort',
... ... @@ -344,6 +336,10 @@ const getBreakingSort = (yhChannel) => {
});
};
const getSpecial = (params) => {
}
/**
* 获取商品数据
*/
... ... @@ -363,8 +359,6 @@ exports.getSearchData = (params) => {
/**
* 获取sale首页数据
* @param {[object]} params
* @return {[object]}
*/
exports.getSaleData = () => {
return getResources('sale');
... ... @@ -414,6 +408,8 @@ exports.getSpecialData = (params) => {
* @return {[object]}
*/
exports.getSpecialDetailData = (id) => {
let res = {};
return api.get('', sign.apiSign({
method: 'app.activity.get',
sort: 2,
... ... @@ -421,7 +417,15 @@ exports.getSpecialDetailData = (id) => {
id: id
})).then((result) => {
if (result && result.code === 200) {
return processSpecialDetail(result.data);
res = processSpecial(result.data);
return {
title: res[0].title,
activity: {
coverUrl: res[0].coverUrl,
time: res[0].time,
leftTime: res[0].leftTime
}
};
} else {
return Promise.reject('error');
}
... ...
... ... @@ -7,7 +7,7 @@
{{/content}}
{{# activity}}
<img src="{{image coverUrl 640 200}}"/>
<p class="activity-time" data-time-ms="{{leftTime}}"><i class="iconfont time-ico">&#xe603;</i><span>{{time}}</span></p>
<p class="activity-time" data-time-ms="{{leftTime}}"><i class="iconfont time-ico">&#xe603;</i><span></span></p>
{{/ activity}}
</div>
<ul id="list-nav" class="list-nav clearfix">
... ...
{{#productList}} {{!-- 剔除值为false的项 --}}
{{#if .}} {{!-- 剔除值为false的项 --}}
<div class="good-info" data-id="{{productSkn}}" data-bp-id="guang_goodList_{{productName}}_false">
<div class="tag-container clearfix">
{{# tags}}
... ... @@ -47,4 +47,4 @@
{{/if}}
</div>
</div>
{{/productList}}
\ No newline at end of file
{{/if}}
\ No newline at end of file
... ...