Authored by 郭成尧

奥莱品类页

... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-05-21 10:59:20
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-07 18:10:14
* @Last Modified time: 2016-06-08 13:37:17
*/
'use strict';
... ... @@ -25,7 +25,6 @@ exports.getProductPic = (req, res) => {
*/
exports.index = (req, res) => {
let params = Object.assign({
saleType: 2,
order: 's_t_asc,s_s_asc'
}, req.query);
... ...
... ... @@ -6,7 +6,6 @@
'use strict';
const mRoot = '../models';
const outlets = require(`${mRoot}/outlets`);
// 开发用模拟数据
... ... @@ -50,7 +49,7 @@ exports.index = (req, res) => {
exports.channel = (req, res) => {
let resData = {
module: 'product',
page: 'outlets',
page: 'outlets'
};
// 首页模拟数据
... ... @@ -91,3 +90,34 @@ exports.special = (req, res) => {
res.render('error', resData);
});
};
/**
* 商品列表页
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.list = (req, res) => {
let params = Object.assign({
saleType: '4',
order: 's_t_asc,s_s_asc'
}, req.query);
let channel = req.query.channel || req.cookies._Channel || 'boys';
params.uid = req.user.uid || 0;
let responseData = {
module: 'product',
page: 'outlets'
};
outlets.getOutletsCategoryData(params, channel).then((result) => {
responseData.resultShow = JSON.stringify(result, null, 4);
res.render('sale/other', Object.assign(responseData, result));
}).catch(() => {
responseData.pageErr = true;
res.render('error', responseData);
});
};
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-06-02 15:11:15
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-07 17:50:53
* @Last Modified time: 2016-06-08 13:35:17
*/
'use strict';
... ... @@ -23,7 +23,7 @@ const publicHandler = require('./public-handler');
* @return {[type]} [description]
*/
exports.getSaleOthersData = (params, channel) => {
console.log('ok');
return api.all([
// headerModel.requestHeaderData(channel),
saleApi.getSaleGoodsList(params),
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-05-30 16:20:03
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-07 16:08:05
* @Last Modified time: 2016-06-08 14:19:17
*/
'use strict';
... ... @@ -168,3 +168,28 @@ exports.getOutletsSpecialData = (params, channel) => {
return specialData;
});
};
/**
* 获取奥莱分类页面数据
* @param {[type]} params [description]
* @param {[type]} channel [description]
* @return {[type]} [description]
*/
exports.getOutletsCategoryData = (params, channel) => {
return api.all([
headerModel.requestHeaderData('outlets')
]).then(result => {
let finalResult = result[0];
return api.all([
list.getSaleOthersData(params, channel),
saleApi.getSaleBannerList(channelCode.index)
]).then(listResult => {
finalResult.saleList = listResult[0];
if (listResult[1].code === 200) {
finalResult.saleList.topBanner = publicHandler.handleBannerData(listResult[1].data);
}
return finalResult;
});
});
};
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-06-02 15:50:47
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-07 16:26:14
* @Last Modified time: 2016-06-08 14:06:58
*/
'use strict';
... ... @@ -498,6 +498,33 @@ exports.handleSaleFilterData = (origin, params) => {
};
/**
* 处理首页 banner 数据
* @param {[type]} origin [description]
* @return {[type]} [description]
*/
exports.handleBannerData = (origin) => {
var dest = {};
dest.list = [];
_.forEach(origin, function(value) {
if (value.template_name === 'focus') {
_.forEach(value.data, function(subValue) {
let banner = {};
banner.bannerHeight = 450;
banner.href = subValue.url;
banner.img = subValue.src;
dest.list.push(banner);
});
}
});
return dest;
};
/**
* 筛选类链接处理的对外接口
* @type {[type]}
*/
... ...
... ... @@ -32,8 +32,10 @@ router.get('/sale/goods', sale.getGoodsList); // ajax 获取商品列表
// 奥特莱斯routers
router.get('/outlets/index', outlets.index);
router.get('/outlets/special/detail', outlets.special);
router.get('/outlets/list', outlets.list); // 奥莱品类页
router.get('/outlets/:channel', outlets.channel);
// 商品列表页
router.get('/list', list.index); // 商品列表页
... ...
<pre>{{resultShow}}</pre>
{{!-- <pre>{{resultShow}}</pre> --}}
<div class="outlets-special-page product-page yoho-page">
{{> common/main-banner}}
<div class="center-content clearfix">
... ...
... ... @@ -10,7 +10,7 @@
</a>
<div class="item-text">
<a href="{{url}}">
{{name}}
{{productName}}
<p class="price">
<span class="sale-price">{{salesPrice}}</span>
<span class="market-price">{{marketPrice}}</span>
... ...