...
|
...
|
@@ -212,34 +212,38 @@ exports.handleSaleOptsData = (params, total, extra) => { |
|
|
};
|
|
|
|
|
|
// 用来标记是否是折扣专场,折扣专场只需要前三个排序参数
|
|
|
let count = (extra === 'discont') ? 4 : 5;
|
|
|
let count = (extra === 'discont') ? 3 : 4;
|
|
|
|
|
|
if (extra === 'default') {
|
|
|
let defaultOpt = {},
|
|
|
defaultParams = params;
|
|
|
|
|
|
defaultOpt.href = handleFilterUrl(params, {order: ''});
|
|
|
defaultOpt.name = '默认';
|
|
|
defaultOpt.hasSortOrient = true;
|
|
|
if (_.isEmpty(params.order)) {
|
|
|
defaultOpt.active = true;
|
|
|
} else {
|
|
|
defaultOpt.active = false;
|
|
|
}
|
|
|
defaultOpt.desc = true;
|
|
|
dest.sortType.push(defaultOpt);
|
|
|
}
|
|
|
|
|
|
for (let i = 0; i < count; i++) {
|
|
|
let opt = {};
|
|
|
|
|
|
switch (i) {
|
|
|
case 0:
|
|
|
opt.href = handleFilterUrl(params, {order: 'shelve_time:desc'});
|
|
|
opt.href = handleFilterUrl(params, {order: 's_t_desc'});
|
|
|
if (extra === 'discont') { // 如果是折扣专场
|
|
|
opt.name = '全部';
|
|
|
if (_.isEmpty(params.order) || params.order === 'shelve_time:desc') {
|
|
|
if (_.isEmpty(params.order) || params.order === 's_t_desc') {
|
|
|
opt.active = true;
|
|
|
} else {
|
|
|
opt.active = false;
|
|
|
}
|
|
|
} else {
|
|
|
opt.name = '默认';
|
|
|
opt.hasSortOrient = true;
|
|
|
if (_.isEmpty(params.order) || params.order === 'shelve_time:desc') {
|
|
|
opt.active = true;
|
|
|
} else {
|
|
|
opt.active = false;
|
|
|
}
|
|
|
opt.desc = true;
|
|
|
}
|
|
|
break;
|
|
|
case 1:
|
|
|
if (extra !== 'discont') {
|
|
|
if (params.order !== 's_t_desc' && params.order !== 's_t_asc') {
|
|
|
opt.href = handleFilterUrl(params, {order: 's_t_desc'});
|
|
|
opt.hasSortOrient = true;
|
...
|
...
|
@@ -258,7 +262,7 @@ exports.handleSaleOptsData = (params, total, extra) => { |
|
|
opt.name = '最新';
|
|
|
}
|
|
|
break;
|
|
|
case 2:
|
|
|
case 1:
|
|
|
if (params.order !== 's_p_desc' && params.order !== 's_p_asc') {
|
|
|
opt.href = handleFilterUrl(params, {order: 's_p_desc'});
|
|
|
opt.hasSortOrient = true;
|
...
|
...
|
@@ -276,7 +280,7 @@ exports.handleSaleOptsData = (params, total, extra) => { |
|
|
|
|
|
opt.name = '价格';
|
|
|
break;
|
|
|
case 3:
|
|
|
case 2:
|
|
|
if (params.order !== 'p_d_desc' && params.order !== 'p_d_asc') {
|
|
|
opt.href = handleFilterUrl(params, {order: 'p_d_desc'});
|
|
|
opt.hasSortOrient = true;
|
...
|
...
|
@@ -294,7 +298,7 @@ exports.handleSaleOptsData = (params, total, extra) => { |
|
|
|
|
|
opt.name = '折扣';
|
|
|
break;
|
|
|
case 4:
|
|
|
case 3:
|
|
|
if (params.order !== 's_n_desc' && params.order !== 's_n_asc') {
|
|
|
opt.href = handleFilterUrl(params, {order: 's_n_desc'});
|
|
|
opt.hasSortOrient = true;
|
...
|
...
|
|