Authored by 郭成尧

左侧列表必填参数

@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2016-06-02 15:11:15 3 * @Date: 2016-06-02 15:11:15
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2016-06-06 10:22:43 5 + * @Last Modified time: 2016-06-06 11:02:32
6 */ 6 */
7 7
8 'use strict'; 8 'use strict';
@@ -17,9 +17,11 @@ const publicHandler = require('./public-handler'); @@ -17,9 +17,11 @@ const publicHandler = require('./public-handler');
17 17
18 /** 18 /**
19 * 获取商品列表商品数据 Controller 调用 19 * 获取商品列表商品数据 Controller 调用
20 - * @return {[type]} [description] 20 + * @param {[type]} params [常规参数]
  21 + * @param {[type]} extra [左侧列表额外要拼接的参数]
  22 + * @return {[type]} [description]
21 */ 23 */
22 -exports.getSaleOthersData = (params) => { 24 +exports.getSaleOthersData = (params, extra) => {
23 25
24 let promiseObject = [ 26 let promiseObject = [
25 saleApi.getSaleGoodsList(params), 27 saleApi.getSaleGoodsList(params),
@@ -45,9 +47,17 @@ exports.getSaleOthersData = (params) => { @@ -45,9 +47,17 @@ exports.getSaleOthersData = (params) => {
45 // 获取左侧类目数据 47 // 获取左侧类目数据
46 if (result[1].code === 200) { 48 if (result[1].code === 200) {
47 if (params.gender === '2,3') { 49 if (params.gender === '2,3') {
48 - finalResult.leftContent = publicHandler.handleSaleSortData(result[1].data.girl, params); 50 + finalResult.leftContent = publicHandler.handleSaleSortData(
  51 + result[1].data.girl,
  52 + params,
  53 + extra
  54 + );
49 } else { 55 } else {
50 - finalResult.leftContent = publicHandler.handleSaleSortData(result[1].data.boy, params); 56 + finalResult.leftContent = publicHandler.handleSaleSortData(
  57 + result[1].data.boy,
  58 + params,
  59 + extra
  60 + );
51 } 61 }
52 } 62 }
53 63
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2016-05-30 16:20:03 3 * @Date: 2016-05-30 16:20:03
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2016-06-06 10:13:41 5 + * @Last Modified time: 2016-06-06 11:03:19
6 */ 6 */
7 7
8 'use strict'; 8 'use strict';
@@ -155,7 +155,7 @@ exports.getOutletsSpecialData = (params) => { @@ -155,7 +155,7 @@ exports.getOutletsSpecialData = (params) => {
155 list.getSaleOthersData(Object.assign({ 155 list.getSaleOthersData(Object.assign({
156 productPool: result[1].data[0].productPoolId, 156 productPool: result[1].data[0].productPoolId,
157 saleType: 4 157 saleType: 4
158 - }, params)) 158 + }, params), { id: params.id })
159 ]).then(data => { 159 ]).then(data => {
160 specialData.specialHead.count = data[0].totalCount; 160 specialData.specialHead.count = data[0].totalCount;
161 Object.assign(specialData, data[0]); 161 Object.assign(specialData, data[0]);
1 /* 1 /*
2 -* @Author: Targaryen  
3 -* @Date: 2016-06-02 15:50:47  
4 -* @Last Modified by: Targaryen  
5 -* @Last Modified time: 2016-06-06 10:22:22  
6 -*/ 2 + * @Author: Targaryen
  3 + * @Date: 2016-06-02 15:50:47
  4 + * @Last Modified by: Targaryen
  5 + * @Last Modified time: 2016-06-06 11:12:06
  6 + */
7 7
8 'use strict'; 8 'use strict';
9 const _ = require('lodash'); 9 const _ = require('lodash');
@@ -307,9 +307,12 @@ exports.handleSaleOptsData = (params, total) => { @@ -307,9 +307,12 @@ exports.handleSaleOptsData = (params, total) => {
307 307
308 /** 308 /**
309 * 处理页面左侧分类筛选数据 309 * 处理页面左侧分类筛选数据
310 - * @return {[type]} [description] 310 + * @param {[type]} origin [左側分類數據列表]
  311 + * @param {[type]} params [普通篩選規則兩個參數]
  312 + * @param {[type]} extra [额外必须添加的参数]
  313 + * @return {[type]} [description]
311 */ 314 */
312 -exports.handleSaleSortData = (origin, params) => { 315 +exports.handleSaleSortData = (origin, params, extra) => {
313 var leftContent = {}; 316 var leftContent = {};
314 317
315 leftContent.allSort = {}; 318 leftContent.allSort = {};
@@ -328,10 +331,20 @@ exports.handleSaleSortData = (origin, params) => { @@ -328,10 +331,20 @@ exports.handleSaleSortData = (origin, params) => {
328 let gender = !_.isEmpty(params.gender) ? `&gender=${params.gender}` : ''; 331 let gender = !_.isEmpty(params.gender) ? `&gender=${params.gender}` : '';
329 332
330 _.forEach(value.sub, function(subValue) { 333 _.forEach(value.sub, function(subValue) {
  334 +
  335 + // 拼接額外的必須參數
  336 + let href = '?sort=' + subValue.relation_parameter.sort + gender;
  337 +
  338 + if (!_.isEmpty(extra)) {
  339 + _.forEach(extra, (thrValue, key) => {
  340 + href += '&' + key + '=' + thrValue;
  341 + });
  342 + }
  343 +
331 category.childList.push({ 344 category.childList.push({
332 name: subValue.category_name, 345 name: subValue.category_name,
333 num: subValue.node_count, 346 num: subValue.node_count,
334 - href: '?sort=' + subValue.relation_parameter.sort + gender 347 + href: href
335 }); 348 });
336 }); 349 });
337 350