...
|
...
|
@@ -4,6 +4,32 @@ const api = global.yoho.API; |
|
|
const prettyFilter = require(`${global.utils}/beautify/filters`);
|
|
|
const processProductList = require(`${global.utils}/beautify/product`);
|
|
|
|
|
|
// 排序转换
|
|
|
const getTypeCont = (type, order) => {
|
|
|
switch (type) {
|
|
|
case 'price':
|
|
|
return order === '0' ? 's_p_desc' : 's_p_asc';
|
|
|
case 'discount':
|
|
|
return order === '0' ? 'p_d_desc' : 'p_d_asc';
|
|
|
case 'sale':
|
|
|
return order === '0' ? 's_n_desc' : 's_n_asc';
|
|
|
case 'newest':
|
|
|
return order === '0' ? 's_t_desc' : 's_t_asc';
|
|
|
case 'stock':
|
|
|
return order === '0' ? 's_s_desc' : 's_s_asc';
|
|
|
case 'all':
|
|
|
return order === '0' ? 'd_s_desc' : 'd_s_asc';
|
|
|
case 'category':
|
|
|
return order === '0' ? 's_t_desc' : 's_t_asc';
|
|
|
case 'new':
|
|
|
return order === '0' ? 's_t_desc' : 's_t_asc';
|
|
|
case 'hot':
|
|
|
return order === '0' ? 's_n_desc' : 's_n_asc';
|
|
|
default:
|
|
|
return order === '0' ? 's_t_desc' : 's_t_asc';
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/* 查询最新产品列表 */
|
|
|
exports.getNewData = (params) => {
|
|
|
if (params.hasOwnProperty('priceRange')) {
|
...
|
...
|
@@ -11,6 +37,12 @@ exports.getNewData = (params) => { |
|
|
delete params.priceRange;
|
|
|
}
|
|
|
|
|
|
if (params.order) {
|
|
|
params.order = getTypeCont(params.type || '', params.order);
|
|
|
} else {
|
|
|
params.order = 's_t_asc';
|
|
|
}
|
|
|
|
|
|
params = Object.assign({
|
|
|
method: 'app.search.newProduct',
|
|
|
}, params);
|
...
|
...
|
@@ -49,4 +81,4 @@ exports.getNewData = (params) => { |
|
|
// data: filterConfig
|
|
|
// };
|
|
|
// });
|
|
|
// }; |
|
|
\ No newline at end of file |
|
|
// }; |
...
|
...
|
|