Authored by yyq

sort page

... ... @@ -57,8 +57,9 @@ const getProductListOrig = (finalParams) => {
const getProductList = (params) => {
let finalParams = {
method: 'web.search.search',
// method: 'app.search.li',
sales: 'Y',
outlets: 2,
stocknumber: 1,
order: 's_n_desc',
need_filter: 'yes',
limit: 60
... ...
... ... @@ -300,7 +300,7 @@ exports.handleOptsData = (params, total, extra) => {
switch (i) {
case 0:
opt.href = handleFilterUrl(params, {order: ''});
opt.href = handleFilterUrl(params, {order: ''}, {page: true});
if (extra === 'discont') { // 如果是折扣专场
opt.name = '全部';
if (_.isEmpty(params.order) || params.order === 's_t_desc') {
... ... @@ -319,16 +319,16 @@ exports.handleOptsData = (params, total, extra) => {
break;
case 1:
if (params.order !== 's_t_desc' && params.order !== 's_t_asc') {
opt.href = handleFilterUrl(params, {order: 's_t_desc'});
opt.href = handleFilterUrl(params, {order: 's_t_desc'}, {page: true});
opt.hasSortOrient = true;
} else {
opt.hasSortOrient = true;
opt.active = true;
if (params.order === 's_t_desc') {
opt.href = handleFilterUrl(params, {order: 's_t_asc'});
opt.href = handleFilterUrl(params, {order: 's_t_asc'}, {page: true});
opt.desc = false;
} else {
opt.href = handleFilterUrl(params, {order: 's_t_desc'});
opt.href = handleFilterUrl(params, {order: 's_t_desc'}, {page: true});
opt.desc = true;
}
}
... ... @@ -337,16 +337,16 @@ exports.handleOptsData = (params, total, extra) => {
break;
case 2:
if (params.order !== 's_p_desc' && params.order !== 's_p_asc') {
opt.href = handleFilterUrl(params, {order: 's_p_desc'});
opt.href = handleFilterUrl(params, {order: 's_p_desc'}, {page: true});
opt.hasSortOrient = true;
} else {
opt.hasSortOrient = true;
opt.active = true;
if (params.order === 's_p_desc') {
opt.href = handleFilterUrl(params, {order: 's_p_asc'});
opt.href = handleFilterUrl(params, {order: 's_p_asc'}, {page: true});
opt.desc = false;
} else {
opt.href = handleFilterUrl(params, {order: 's_p_desc'});
opt.href = handleFilterUrl(params, {order: 's_p_desc'}, {page: true});
opt.desc = true;
}
}
... ... @@ -355,16 +355,16 @@ exports.handleOptsData = (params, total, extra) => {
break;
case 3:
if (params.order !== 'p_d_desc' && params.order !== 'p_d_asc') {
opt.href = handleFilterUrl(params, {order: 'p_d_desc'});
opt.href = handleFilterUrl(params, {order: 'p_d_desc'}, {page: true});
opt.hasSortOrient = true;
} else {
opt.hasSortOrient = true;
opt.active = true;
if (params.order === 'p_d_desc') {
opt.href = handleFilterUrl(params, {order: 'p_d_asc'});
opt.href = handleFilterUrl(params, {order: 'p_d_asc'}, {page: true});
opt.desc = false;
} else {
opt.href = handleFilterUrl(params, {order: 'p_d_desc'});
opt.href = handleFilterUrl(params, {order: 'p_d_desc'}, {page: true});
opt.desc = true;
}
}
... ... @@ -380,13 +380,13 @@ exports.handleOptsData = (params, total, extra) => {
// 上下翻页数据处理
dest.pageCounts = [{
href: handleFilterUrl(params, {limit: 60}),
href: handleFilterUrl(params, {limit: 60}, {page: true}),
count: 60
}, {
href: handleFilterUrl(params, {limit: 100}),
href: handleFilterUrl(params, {limit: 100}, {page: true}),
count: 100
}, {
href: handleFilterUrl(params, {limit: 200}),
href: handleFilterUrl(params, {limit: 200}, {page: true}),
count: 200
}];
... ... @@ -396,7 +396,7 @@ exports.handleOptsData = (params, total, extra) => {
dest.countPerPage = _.isEmpty(params.limit) ? 60 : params.limit;
// 全部页码数量
dest.pageCount = parseInt(total / (_.isEmpty(params.limit) ? 60 : params.limit), 10) + 1;
dest.pageCount = parseInt(total / (dest.countPerPage - 1)) + 1;
// 每页多少商品
let paramsLimit = parseInt((_.isEmpty(params.limit) ? 60 : params.limit), 10);
... ...