Authored by 郭成尧

列表页筛选

... ... @@ -71,7 +71,7 @@ exports.channel = (req, res) => {
*/
exports.special = (req, res) => {
let params = req.query;
let channel = req.query.channel || req.cookies._Channel || 'boys';
let resData = {
module: 'product',
page: 'outlets'
... ... @@ -84,7 +84,7 @@ exports.special = (req, res) => {
// 模拟数据
// resData = outletsSimulation.special();
outlets.getOutletsSpecialData(params).then(result => {
outlets.getOutletsSpecialData(params, channel).then(result => {
res.render('outlets/special', Object.assign(resData, result));
}).catch(() => {
resData.pageErr = true;
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-06-02 15:11:15
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-07 15:21:15
* @Last Modified time: 2016-06-07 16:10:50
*/
'use strict';
... ... @@ -12,7 +12,6 @@ const API = require(`${library}/api`).API;
const api = new API();
const saleApi = require('./sale-api');
const productProcess = require(`${utils}/product-process`);
const _ = require('lodash');
const publicHandler = require('./public-handler');
const headerModel = require('../../../doraemon/models/header');
... ... @@ -24,43 +23,30 @@ const headerModel = require('../../../doraemon/models/header');
*/
exports.getSaleOthersData = (params, channel) => {
let promiseObject = [
return api.all([
headerModel.requestHeaderData(channel),
saleApi.getSaleGoodsList(params),
saleApi.getLeftContentList()
];
return api.all(promiseObject).then(result => {
saleApi.getSaleGoodsList({ saleType: '4', limit: '1', channel: channel })
]).then(result => {
let finalResult = result[0];
// 获取商品数据和顶部筛选条件
if (result[1].code === 200) {
finalResult.goods = productProcess.processProductList(result[1].data.product_list);
if (!_.isEmpty(result[1].data.filter)) {
finalResult.filters = publicHandler.handleSaleFilterData(result[1].data.filter, params);
}
// 处理排序数据
finalResult.opts = publicHandler.handleSaleOptsData(params, result[1].data.total);
finalResult.totalCount = result[1].data.total;
finalResult.pager = publicHandler.handleSalePagerData(result[1].data.total, params);
}
// 获取左侧类目数据
if (result[2].code === 200) {
if (params.gender === '2,3') {
finalResult.leftContent = publicHandler.handleSaleSortData(
result[2].data.girl,
params
);
} else {
finalResult.leftContent = publicHandler.handleSaleSortData(
result[2].data.boy,
params
);
}
finalResult.leftContent = publicHandler.handleSaleSortData(result[2].data.filter.group_sort, params);
finalResult.filters = publicHandler.handleSaleFilterData(result[2].data.filter, params);
// 处理排序数据
finalResult.opts = publicHandler.handleSaleOptsData(params, result[2].data.total);
finalResult.totalCount = result[2].data.total;
finalResult.pager = publicHandler.handleSalePagerData(result[2].data.total, params);
}
return finalResult;
});
};
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-05-30 16:20:03
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-07 15:55:16
* @Last Modified time: 2016-06-07 16:08:05
*/
'use strict';
... ... @@ -136,7 +136,7 @@ exports.getOutletsChannelData = (params) => {
* @param {[object]}
* @return {[type]}
*/
exports.getOutletsSpecialData = (params) => {
exports.getOutletsSpecialData = (params, channel) => {
return api.all([
headerModel.requestHeaderData('outlets'),
outletsApi.getOutletsActivityOrigin({
... ... @@ -155,7 +155,7 @@ exports.getOutletsSpecialData = (params) => {
list.getSaleOthersData(Object.assign({
productPool: result[1].data[0].productPoolId,
saleType: 4
}, params), { id: params.id })
}, params), channel)
]).then(data => {
specialData.specialHead.count = data[0].totalCount;
Object.assign(specialData, data[0]);
... ...