Authored by 郭成尧

排序效果处理

@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2016-06-02 15:50:47 3 * @Date: 2016-06-02 15:50:47
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2016-06-08 16:51:55 5 + * @Last Modified time: 2016-06-08 17:04:40
6 */ 6 */
7 7
8 'use strict'; 8 'use strict';
@@ -83,8 +83,8 @@ const handleSalebreakingYardsSortData = (origin, params) => { @@ -83,8 +83,8 @@ const handleSalebreakingYardsSortData = (origin, params) => {
83 83
84 // 判断是否在这组数据里面 84 // 判断是否在这组数据里面
85 if (!_.isEmpty(_.find(value.sort_id.split(','), o => { 85 if (!_.isEmpty(_.find(value.sort_id.split(','), o => {
86 - return o === sortParam;  
87 - }))) { 86 + return o === sortParam;
  87 + }))) {
88 88
89 // 如果在某组数据里面,组合数据退出循环 89 // 如果在某组数据里面,组合数据退出循环
90 _.forEach(value.sub, function(subValue) { 90 _.forEach(value.sub, function(subValue) {
@@ -241,6 +241,8 @@ exports.handleSaleOptsData = (params, total) => { @@ -241,6 +241,8 @@ exports.handleSaleOptsData = (params, total) => {
241 241
242 dest.sortType = []; 242 dest.sortType = [];
243 243
  244 +
  245 +
244 for (let i = 0; i < 4; i++) { 246 for (let i = 0; i < 4; i++) {
245 let opt = {}; 247 let opt = {};
246 248
@@ -252,24 +254,36 @@ exports.handleSaleOptsData = (params, total) => { @@ -252,24 +254,36 @@ exports.handleSaleOptsData = (params, total) => {
252 case 1: 254 case 1:
253 if (params.order === 's_p_desc') { 255 if (params.order === 's_p_desc') {
254 opt.href = handleFilterUrl(params, { order: 's_p_asc' }); 256 opt.href = handleFilterUrl(params, { order: 's_p_asc' });
  257 + opt.hasSortOrient = false;
  258 + opt.active = false;
255 } else { 259 } else {
256 opt.href = handleFilterUrl(params, { order: 's_p_desc' }); 260 opt.href = handleFilterUrl(params, { order: 's_p_desc' });
  261 + opt.hasSortOrient = true;
  262 + opt.active = true;
257 } 263 }
258 opt.name = '价格'; 264 opt.name = '价格';
259 break; 265 break;
260 case 2: 266 case 2:
261 if (params.order === 'p_d_desc') { 267 if (params.order === 'p_d_desc') {
262 opt.href = handleFilterUrl(params, { order: 'p_d_asc' }); 268 opt.href = handleFilterUrl(params, { order: 'p_d_asc' });
  269 + opt.hasSortOrient = false;
  270 + opt.active = false;
263 } else { 271 } else {
264 opt.href = handleFilterUrl(params, { order: 'p_d_desc' }); 272 opt.href = handleFilterUrl(params, { order: 'p_d_desc' });
  273 + opt.hasSortOrient = true;
  274 + opt.active = true;
265 } 275 }
266 opt.name = '折扣'; 276 opt.name = '折扣';
267 break; 277 break;
268 case 3: 278 case 3:
269 if (params.order === 's_n_desc') { 279 if (params.order === 's_n_desc') {
270 opt.href = handleFilterUrl(params, { order: 's_n_asc' }); 280 opt.href = handleFilterUrl(params, { order: 's_n_asc' });
  281 + opt.hasSortOrient = false;
  282 + opt.active = false;
271 } else { 283 } else {
272 opt.href = handleFilterUrl(params, { order: 's_n_desc' }); 284 opt.href = handleFilterUrl(params, { order: 's_n_desc' });
  285 + opt.hasSortOrient = true;
  286 + opt.active = true;
273 } 287 }
274 opt.name = '销量'; 288 opt.name = '销量';
275 break; 289 break;
@@ -277,10 +291,6 @@ exports.handleSaleOptsData = (params, total) => { @@ -277,10 +291,6 @@ exports.handleSaleOptsData = (params, total) => {
277 break; 291 break;
278 } 292 }
279 293
280 - opt.hasSortOrient = {};  
281 - opt.hasSortOrient.active = {};  
282 - opt.hasSortOrient.active.desc = {};  
283 -  
284 dest.sortType.push(opt); 294 dest.sortType.push(opt);
285 } 295 }
286 296