Authored by 郭成尧

左侧列表必填参数

... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-06-02 15:11:15
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-06 10:22:43
* @Last Modified time: 2016-06-06 11:02:32
*/
'use strict';
... ... @@ -17,9 +17,11 @@ const publicHandler = require('./public-handler');
/**
* 获取商品列表商品数据 Controller 调用
* @return {[type]} [description]
* @param {[type]} params [常规参数]
* @param {[type]} extra [左侧列表额外要拼接的参数]
* @return {[type]} [description]
*/
exports.getSaleOthersData = (params) => {
exports.getSaleOthersData = (params, extra) => {
let promiseObject = [
saleApi.getSaleGoodsList(params),
... ... @@ -45,9 +47,17 @@ exports.getSaleOthersData = (params) => {
// 获取左侧类目数据
if (result[1].code === 200) {
if (params.gender === '2,3') {
finalResult.leftContent = publicHandler.handleSaleSortData(result[1].data.girl, params);
finalResult.leftContent = publicHandler.handleSaleSortData(
result[1].data.girl,
params,
extra
);
} else {
finalResult.leftContent = publicHandler.handleSaleSortData(result[1].data.boy, params);
finalResult.leftContent = publicHandler.handleSaleSortData(
result[1].data.boy,
params,
extra
);
}
}
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-05-30 16:20:03
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-06 10:13:41
* @Last Modified time: 2016-06-06 11:03:19
*/
'use strict';
... ... @@ -155,7 +155,7 @@ exports.getOutletsSpecialData = (params) => {
list.getSaleOthersData(Object.assign({
productPool: result[1].data[0].productPoolId,
saleType: 4
}, params))
}, params), { id: params.id })
]).then(data => {
specialData.specialHead.count = data[0].totalCount;
Object.assign(specialData, data[0]);
... ...
/*
* @Author: Targaryen
* @Date: 2016-06-02 15:50:47
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-06 10:22:22
*/
* @Author: Targaryen
* @Date: 2016-06-02 15:50:47
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-06 11:12:06
*/
'use strict';
const _ = require('lodash');
... ... @@ -307,9 +307,12 @@ exports.handleSaleOptsData = (params, total) => {
/**
* 处理页面左侧分类筛选数据
* @return {[type]} [description]
* @param {[type]} origin [左側分類數據列表]
* @param {[type]} params [普通篩選規則兩個參數]
* @param {[type]} extra [额外必须添加的参数]
* @return {[type]} [description]
*/
exports.handleSaleSortData = (origin, params) => {
exports.handleSaleSortData = (origin, params, extra) => {
var leftContent = {};
leftContent.allSort = {};
... ... @@ -328,10 +331,20 @@ exports.handleSaleSortData = (origin, params) => {
let gender = !_.isEmpty(params.gender) ? `&gender=${params.gender}` : '';
_.forEach(value.sub, function(subValue) {
// 拼接額外的必須參數
let href = '?sort=' + subValue.relation_parameter.sort + gender;
if (!_.isEmpty(extra)) {
_.forEach(extra, (thrValue, key) => {
href += '&' + key + '=' + thrValue;
});
}
category.childList.push({
name: subValue.category_name,
num: subValue.node_count,
href: '?sort=' + subValue.relation_parameter.sort + gender
href: href
});
});
... ...