...
|
...
|
@@ -12,26 +12,65 @@ const mRoot = '../models'; |
|
|
// sale 页 model
|
|
|
const sale = require(`${mRoot}/sale`);
|
|
|
|
|
|
const saleDiscount = require(`${mRoot}/sale-discount`);
|
|
|
|
|
|
/**
|
|
|
* sale 首页
|
|
|
* @param {[type]} req [description]
|
|
|
* @param {[type]} res [description]
|
|
|
* @return {[type]} [description]
|
|
|
*/
|
|
|
exports.index = (req, res) => {
|
|
|
|
|
|
headerModel.requestHeaderData()
|
|
|
.then(response => {
|
|
|
response = headerModel.setHeaderData(response.data, 'boys');
|
|
|
response = headerModel.setHeaderData(response.data, 'sale');
|
|
|
|
|
|
response.module = 'product';
|
|
|
response.page = 'sale';
|
|
|
response.footerTop = true;
|
|
|
response.devEnv = true;
|
|
|
|
|
|
res.render('sale/index', Object.assign(response, sale.outputDevData()));
|
|
|
// 假数据输出
|
|
|
// res.render('sale/index', Object.assign(response, sale.outputDevData()));
|
|
|
|
|
|
/* return sale.getSaleDate().then(result => {
|
|
|
// 真实数据输出
|
|
|
return sale.getSaleDate().then(result => {
|
|
|
|
|
|
response.result = result;
|
|
|
response.resultShow = JSON.stringify(result, null, 4);
|
|
|
|
|
|
res.render('sale/index', response);
|
|
|
});*/
|
|
|
});
|
|
|
})
|
|
|
.catch(() => {
|
|
|
res.render('error', { devEnv: true, pageErr: true });
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 折扣专场
|
|
|
* @param {[type]} req [description]
|
|
|
* @param {[type]} res [description]
|
|
|
* @return {[type]} [description]
|
|
|
*/
|
|
|
exports.discount = (req, res) => {
|
|
|
headerModel.requestHeaderData()
|
|
|
.then(response => {
|
|
|
response = headerModel.setHeaderData(response.data, 'sale-discount');
|
|
|
response.module = 'product';
|
|
|
response.page = 'sale';
|
|
|
response.footerTop = true;
|
|
|
response.devEnv = true;
|
|
|
|
|
|
return saleDiscount.getSaleDiscountData()
|
|
|
.then(result => {
|
|
|
response.result = result;
|
|
|
response.resultShow = JSON.stringify(result, null, 4);
|
|
|
|
|
|
res.render('sale/discount', response);
|
|
|
});
|
|
|
|
|
|
})
|
|
|
.catch(() => {
|
|
|
res.render('error', { devEnv: true, pageErr: true });
|
...
|
...
|
|