...
|
...
|
@@ -13,12 +13,14 @@ const helpers = global.yoho.helpers; |
|
|
|
|
|
const homeService = require('./home-service');
|
|
|
const headerModel = require('../../../doraemon/models/header');
|
|
|
const listHandler = require('./list-handler');
|
|
|
const searchHandler = require('./search-handler');
|
|
|
const pager = require(`${global.utils}/pager`).setPager;
|
|
|
|
|
|
const productProcess = require(`${global.utils}/product-process`);
|
|
|
const handleFilterUrl = require(`${global.utils}/parameter`).fullParamToMinPath;
|
|
|
|
|
|
const GlobalApiModel = require('./global-api');
|
|
|
const GLOBAL_LIST_URI = '/product/global/list';
|
|
|
const GLOBAL_LIST_URI = '/list/global';
|
|
|
|
|
|
const _handelGlobalPathNav = (data, channel, page) => {
|
|
|
let rootName = '首页';
|
...
|
...
|
@@ -74,7 +76,7 @@ const _checkSortEqual = (rp, params) => { |
|
|
const _handelGlobalSort = (origin, params, originParams) => {
|
|
|
let all = [{
|
|
|
name: '全部品类',
|
|
|
href: `${searchHandler.handleFilterUrl(params, {}, {msort: true, misort: true, sort: true})}`
|
|
|
href: `${handleFilterUrl(GLOBAL_LIST_URI, params, {}, {msort: true, misort: true, sort: true})}`
|
|
|
}];
|
|
|
let list = [];
|
|
|
let selectSort = {};
|
...
|
...
|
@@ -90,7 +92,7 @@ const _handelGlobalSort = (origin, params, originParams) => { |
|
|
categoryId: value.category_id,
|
|
|
name: `全部${value.category_name}`,
|
|
|
num: value.node_count,
|
|
|
href: `${searchHandler.handleFilterUrl(params, value.relation_parameter)}`,
|
|
|
href: `${handleFilterUrl(GLOBAL_LIST_URI, params, value.relation_parameter)}`,
|
|
|
childActive: _checkSortEqual(value.relation_parameter, originParams)
|
|
|
}
|
|
|
]
|
...
|
...
|
@@ -113,7 +115,7 @@ const _handelGlobalSort = (origin, params, originParams) => { |
|
|
categoryId: subValue.category_id,
|
|
|
name: subValue.category_name,
|
|
|
num: subValue.node_count,
|
|
|
href: `${searchHandler.handleFilterUrl(params, subValue.relation_parameter)}`,
|
|
|
href: `${handleFilterUrl(GLOBAL_LIST_URI, params, subValue.relation_parameter)}`,
|
|
|
childActive: _checkSortEqual(subValue.relation_parameter, originParams)
|
|
|
};
|
|
|
|
...
|
...
|
@@ -186,12 +188,6 @@ function getGlobalProductListData(params, yoho) { |
|
|
let listData = _.get(result.list, 'data', {});
|
|
|
let totalNum = _.get(listData, 'total', 0);
|
|
|
|
|
|
let tip = {
|
|
|
start: (params.page - 1) * limitNum + 1,
|
|
|
total: listData.total || '',
|
|
|
end: _.min([listData.total, limitNum * params.page])
|
|
|
};
|
|
|
|
|
|
// opts 显示新品、折扣
|
|
|
listData.filter = listData.filter || {};
|
|
|
Object.assign(listData.filter, {
|
...
|
...
|
@@ -201,10 +197,10 @@ function getGlobalProductListData(params, yoho) { |
|
|
|
|
|
resData.list = {
|
|
|
leftContent: _handelGlobalSort(_.get(result.fullList, 'data.filter.group_sort', []), dps, params),
|
|
|
filters: searchHandler.handleFilterDataAll(listData, params),
|
|
|
opts: searchHandler.handleOptsData(params, totalNum, listData.filter),
|
|
|
filters: listHandler.handleFilterData(listData, params, GLOBAL_LIST_URI),
|
|
|
opts: listHandler.handleOptsData(params, totalNum, listData.filter, GLOBAL_LIST_URI),
|
|
|
totalCount: totalNum,
|
|
|
footPager: Object.assign({tip: tip}, pager(_.get(listData, 'page_total', 0), params)),
|
|
|
footPager: listHandler.handlePagerData(_.get(listData, 'total', 0), params, false, GLOBAL_LIST_URI),
|
|
|
goods: productProcess.processProductList(_.get(listData, 'product_list', []),
|
|
|
Object.assign({showDiscount: false, isGlobal: true}, params)),
|
|
|
hasNextPage: searchHandler.handleNextPage(params, totalNum),
|
...
|
...
|
|