Authored by 郭成尧

销量排序

... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-05-25 18:16:59
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-08 16:01:59
* @Last Modified time: 2016-06-08 16:17:06
*/
'use strict';
... ... @@ -198,8 +198,8 @@ const handleSalebreakingYardsSortData = (origin, params) => {
// 判断是否在这组数据里面
if (!_.isEmpty(_.find(value.sort_id.split(','), o => {
return o === sortParam;
}))) {
return o === sortParam;
}))) {
// 如果在某组数据里面,组合数据退出循环
_.forEach(value.sub, function(subValue) {
... ... @@ -391,7 +391,7 @@ exports.handleSaleOptsData = (params, total) => {
dest.sortType = [];
for (let i = 0; i < 3; i++) {
for (let i = 0; i < 4; i++) {
let opt = {};
switch (i) {
... ... @@ -400,21 +400,29 @@ exports.handleSaleOptsData = (params, total) => {
opt.name = '最新';
break;
case 1:
if (params.order === 's_p_asc') {
opt.href = handleFilterUrl(params, { order: 's_p_desc' });
} else {
if (params.order === 's_p_desc') {
opt.href = handleFilterUrl(params, { order: 's_p_asc' });
} else {
opt.href = handleFilterUrl(params, { order: 's_p_desc' });
}
opt.name = '价格';
break;
case 2:
if (params.order === 'p_d_asc') {
opt.href = handleFilterUrl(params, { order: 'p_d_desc' });
} else {
if (params.order === 'p_d_desc') {
opt.href = handleFilterUrl(params, { order: 'p_d_asc' });
} else {
opt.href = handleFilterUrl(params, { order: 'p_d_desc' });
}
opt.name = '折扣';
break;
case 3:
if (params.order === 's_n_desc') {
opt.href = handleFilterUrl(params, { order: 's_n_asc' });
} else {
opt.href = handleFilterUrl(params, { order: 's_n_desc' });
}
opt.name = '销量';
break;
default:
break;
}
... ...