Authored by 郭成尧

断码区尺码筛选数据

@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2016-05-25 18:16:59 3 * @Date: 2016-05-25 18:16:59
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2016-05-26 11:11:07 5 + * @Last Modified time: 2016-05-26 13:33:33
6 */ 6 */
7 7
8 'use strict'; 8 'use strict';
@@ -195,21 +195,20 @@ exports.handleSaleSortData = (origin, params) => { @@ -195,21 +195,20 @@ exports.handleSaleSortData = (origin, params) => {
195 * 处理断码区分类筛选数据 待处理 195 * 处理断码区分类筛选数据 待处理
196 * @return {[type]} [description] 196 * @return {[type]} [description]
197 */ 197 */
198 -exports.handleSalebreakingYardsSortData = (origin) => {  
199 - var leftContent = {}; 198 +exports.handleSalebreakingYardsSortData = (origin, params) => {
  199 + var dest = [];
200 200
201 - leftContent.allDiscount = {};  
202 - leftContent.allDiscount.list = []; 201 + _.forEach(origin[0], function(value) {
  202 + let size = {};
203 203
204 - _.forEach(origin, function(value) {  
205 - let category = {}; 204 + size.checked = false;
  205 + size.href = handleFilterUrl(params, { size: value.size_id });
  206 + size.name = value.size_name;
206 207
207 - category.name = value.sort_name;  
208 - leftContent.allDiscount.list.push(category); 208 + dest.push(size);
209 }); 209 });
210 210
211 -  
212 - return leftContent; 211 + return dest;
213 }; 212 };
214 213
215 /** 214 /**
@@ -2,14 +2,13 @@ @@ -2,14 +2,13 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2016-05-19 10:20:08 3 * @Date: 2016-05-19 10:20:08
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2016-05-26 11:11:37 5 + * @Last Modified time: 2016-05-26 13:32:58
6 */ 6 */
7 7
8 'use strict'; 8 'use strict';
9 const library = '../../../library'; 9 const library = '../../../library';
10 const API = require(`${library}/api`).API; 10 const API = require(`${library}/api`).API;
11 const api = new API(); 11 const api = new API();
12 -const _ = require('lodash');  
13 const saleApi = require('./sale-api'); 12 const saleApi = require('./sale-api');
14 const saleHandler = require('./sale-handler'); 13 const saleHandler = require('./sale-handler');
15 14
@@ -61,21 +60,13 @@ exports.getSaleOthersData = (params) => { @@ -61,21 +60,13 @@ exports.getSaleOthersData = (params) => {
61 let finalResult = {}; 60 let finalResult = {};
62 61
63 if (result[0].code === 200) { 62 if (result[0].code === 200) {
64 -  
65 - if (!_.isEmpty(result[0].data.product_list)) { // 处理商品列表数据  
66 finalResult.goods = saleHandler.handleSaleGoodsListData(result[0].data.product_list); 63 finalResult.goods = saleHandler.handleSaleGoodsListData(result[0].data.product_list);
67 - }  
68 -  
69 - if (!_.isEmpty(result[0].data.filter)) {  
70 finalResult.filters = saleHandler.handleSaleFilterData(result[0].data.filter, params); 64 finalResult.filters = saleHandler.handleSaleFilterData(result[0].data.filter, params);
71 - }  
72 -  
73 - if (!_.isEmpty(result[0].data.filter.group_sort)) {  
74 finalResult.leftContent = saleHandler.handleSaleSortData(result[0].data.filter.group_sort, params); 65 finalResult.leftContent = saleHandler.handleSaleSortData(result[0].data.filter.group_sort, params);
75 } 66 }
76 67
77 - }  
78 finalResult.opts = saleHandler.handleSaleOptsData(); 68 finalResult.opts = saleHandler.handleSaleOptsData();
  69 +
79 return finalResult; 70 return finalResult;
80 }); 71 });
81 }; 72 };
@@ -104,23 +95,19 @@ exports.getSaleDiscountData = (params) => { @@ -104,23 +95,19 @@ exports.getSaleDiscountData = (params) => {
104 * @return {[type]} [description] 95 * @return {[type]} [description]
105 */ 96 */
106 exports.getSalebreakingYardsData = (params) => { 97 exports.getSalebreakingYardsData = (params) => {
107 - return api.all([saleApi.getSalebreakingYardsSortList(), saleApi.getSaleGoodsList(params)]).then(result => { 98 + return api.all([saleApi.getSaleGoodsList(params), saleApi.getSalebreakingYardsSortList()]).then(result => {
108 let finalResult = {}; 99 let finalResult = {};
109 100
110 if (result[0].code === 200) { 101 if (result[0].code === 200) {
111 - finalResult.size = saleHandler.handleSalebreakingYardsSortData(result[0].data); // 待处理 102 + finalResult.goods = saleHandler.handleSaleGoodsListData(result[0].data.product_list);
  103 + finalResult.filters = saleHandler.handleSaleFilterData(result[0].data.filter, params);
  104 + finalResult.leftContent = saleHandler.handleSaleSortData(result[0].data.filter.group_sort, params);
112 } 105 }
113 - if (result[1].code === 200) {  
114 106
115 - if (!_.isEmpty(result[1].data.product_list)) { // 处理商品列表数据  
116 - finalResult.goods = saleHandler.handleSaleGoodsListData(result[1].data.product_list); 107 + if (result[1].code === 200) {
  108 + finalResult.filters.size = saleHandler.handleSalebreakingYardsSortData(result[1].data, params);
117 } 109 }
118 110
119 - if (!_.isEmpty(result[1].data.filter)) {  
120 - finalResult.filters = saleHandler.handleSaleFilterData(result[1].data.filter);  
121 - finalResult.leftContent = saleHandler.handleSaleSortData(result[1].data.filter.group_sort, params);  
122 - }  
123 - }  
124 finalResult.opts = saleHandler.handleSaleOptsData(params); 111 finalResult.opts = saleHandler.handleSaleOptsData(params);
125 return finalResult; 112 return finalResult;
126 }); 113 });
1 -{{!-- <pre>{{resultShow}}</pre> --}} 1 +<pre>{{resultShow}}</pre>
2 <div class="new-sale-page product-page yoho-page"> 2 <div class="new-sale-page product-page yoho-page">
3 {{# saleList}} 3 {{# saleList}}
4 4