...
|
...
|
@@ -27,6 +27,31 @@ const saleLogger = (err, res) => { |
|
|
res.send('error');
|
|
|
};
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 公共数据处理
|
|
|
* @param {[object]} req
|
|
|
* @param {[string]} title 标题
|
|
|
* @param {[string]} page js文件page名称
|
|
|
* @return {[type]}
|
|
|
*/
|
|
|
const processPublicData = (req, title, page) => {
|
|
|
let data = {};
|
|
|
let channel = req.query.channel || req.cookies._Channel || 'boys';
|
|
|
let headerData = headerModel.setNavHeader(title, channel);
|
|
|
|
|
|
return data = {
|
|
|
channel: channel,
|
|
|
renderData: {
|
|
|
module: 'product',
|
|
|
page: page,
|
|
|
title: title,
|
|
|
pageHeader: headerData,
|
|
|
pageFooter: true
|
|
|
}
|
|
|
};
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* sale 首页 资源位获取
|
|
|
* @param {[object]} req
|
...
|
...
|
@@ -34,18 +59,10 @@ const saleLogger = (err, res) => { |
|
|
* @return {[type]}
|
|
|
*/
|
|
|
exports.index = (req, res) => {
|
|
|
let channel = req.query.channel || req.cookies._Channel || 'boys';
|
|
|
let headerData = headerModel.setNavHeader('SALE');
|
|
|
let renderData = {
|
|
|
module: 'product',
|
|
|
page: 'sale',
|
|
|
title: 'SALE',
|
|
|
pageHeader: headerData,
|
|
|
pageFooter: true
|
|
|
};
|
|
|
|
|
|
saleModel.getSaleData(channel).then((result) => {
|
|
|
res.render('sale/index', Object.assign(renderData, queryParam, {
|
|
|
let params = processPublicData(req, 'SALE', 'sale');
|
|
|
|
|
|
saleModel.getSaleData(params.channel).then((result) => {
|
|
|
res.render('sale/index', Object.assign(params.renderData, queryParam, {
|
|
|
content: result,
|
|
|
floorHeader: {
|
|
|
title: {
|
...
|
...
|
@@ -65,20 +82,12 @@ exports.index = (req, res) => { |
|
|
* @return {[type]}
|
|
|
*/
|
|
|
exports.breakingYards = (req, res) => {
|
|
|
let channel = req.query.channel || req.cookies._Channel || 'boys';
|
|
|
let headerData = headerModel.setNavHeader('断码区');
|
|
|
let renderData = {
|
|
|
module: 'product',
|
|
|
page: 'break-code',
|
|
|
title: '断码区',
|
|
|
pageHeader: headerData,
|
|
|
pageFooter: true
|
|
|
};
|
|
|
let params = processPublicData(req, '断码区', 'break-code');
|
|
|
|
|
|
saleModel.getBreakCodeData({
|
|
|
yhChannel: channel
|
|
|
yhChannel: params.channel
|
|
|
}).then((result) => {
|
|
|
res.render('sale/break-code', Object.assign(renderData, result));
|
|
|
res.render('sale/break-code', Object.assign(params.renderData, result));
|
|
|
}).catch((err) => {
|
|
|
saleLogger(err, res);
|
|
|
});
|
...
|
...
|
@@ -91,16 +100,10 @@ exports.breakingYards = (req, res) => { |
|
|
* @return {[type]}
|
|
|
*/
|
|
|
exports.discount = (req, res) => {
|
|
|
let headerData = headerModel.setNavHeader('折扣专场');
|
|
|
let renderData = {
|
|
|
module: 'product',
|
|
|
page: 'discount',
|
|
|
pageHeader: headerData,
|
|
|
pageFooter: true
|
|
|
};
|
|
|
|
|
|
saleModel.getDiscountData().then((result) => {
|
|
|
res.render('sale/discount', Object.assign(renderData, result));
|
|
|
let params = processPublicData(req, '折扣专场', 'discount');
|
|
|
|
|
|
saleModel.getDiscountData(params.channel).then((result) => {
|
|
|
res.render('sale/discount', Object.assign(params.renderData, result));
|
|
|
}).catch((err) => {
|
|
|
saleLogger(err, res);
|
|
|
});
|
...
|
...
|
@@ -114,18 +117,12 @@ exports.discount = (req, res) => { |
|
|
* @return {[type]}
|
|
|
*/
|
|
|
exports.discountDetail = (req, res) => {
|
|
|
let headerData = headerModel.setNavHeader();
|
|
|
let id = req.query.id;
|
|
|
let renderData = {
|
|
|
module: 'product',
|
|
|
page: 'discount-detail',
|
|
|
pageFooter: true
|
|
|
};
|
|
|
let params = processPublicData(req, '', 'discount-detail');
|
|
|
|
|
|
saleModel.getDiscountDetailData(id).then((result) => {
|
|
|
headerData.navTitle = result.title;
|
|
|
renderData.pageHeader = headerData;
|
|
|
res.render('sale/discount-detail', Object.assign(renderData, result));
|
|
|
params.renderData.pageHeader.navTitle = result.title;
|
|
|
res.render('sale/discount-detail', Object.assign(params.renderData, result));
|
|
|
}).catch((err) => {
|
|
|
saleLogger(err, res);
|
|
|
});
|
...
|
...
|
@@ -138,18 +135,10 @@ exports.discountDetail = (req, res) => { |
|
|
* @return {[type]}
|
|
|
*/
|
|
|
exports.vip = (req, res) => {
|
|
|
let channel = req.query.channel || req.cookies._Channel || 'boys';
|
|
|
let headerData = headerModel.setNavHeader('会员专享');
|
|
|
let renderData = {
|
|
|
module: 'product',
|
|
|
page: 'vip',
|
|
|
title: '会员专享',
|
|
|
pageHeader: headerData,
|
|
|
pageFooter: true
|
|
|
};
|
|
|
|
|
|
saleModel.getVipData(channel).then((result) => {
|
|
|
res.render('sale/vip', Object.assign(renderData, {
|
|
|
let params = processPublicData(req, '会员专享', 'vip');
|
|
|
|
|
|
saleModel.getVipData(params.channel).then((result) => {
|
|
|
res.render('sale/vip', Object.assign(params.renderData, {
|
|
|
content: result
|
|
|
}));
|
|
|
}).catch((err) => {
|
...
|
...
|
|