...
|
...
|
@@ -42,6 +42,7 @@ const transPrice = (price) => { |
|
|
exports.getSearchData = (params, channel) => {
|
|
|
|
|
|
let searchParams = searchHandler.getSearchParams(params);
|
|
|
let changeQuery = Object.assign({}, params);
|
|
|
|
|
|
switch (channel) {
|
|
|
case 'boys':
|
...
|
...
|
@@ -95,10 +96,17 @@ exports.getSearchData = (params, channel) => { |
|
|
// 获取商品数据和顶部筛选条件
|
|
|
if (result[2].code === 200) {
|
|
|
|
|
|
let filters = Object.assign(searchHandler.handleFilterDataAll(result[2].data, params),
|
|
|
finalResult.search.leftContent.sort);
|
|
|
// 搜索推荐词,获取对应的参数值
|
|
|
let termsSuggestion = _.get(result[2], 'data.suggestion.terms_suggestion', []);
|
|
|
|
|
|
// 推荐词 获取无商品,首次搜索,通过isChangedQuery做开关
|
|
|
if (result[2].data.isChangedQuery === 'Y') {
|
|
|
Object.assign(changeQuery, {query: termsSuggestion[0]});
|
|
|
}
|
|
|
|
|
|
let filters = Object.assign(searchHandler.handleFilterDataAll(result[2].data, changeQuery),
|
|
|
finalResult.search.leftContent.sort);
|
|
|
|
|
|
filters.checkedConditions.conditions = _.concat(filters.checkedConditions.conditions,
|
|
|
finalResult.search.leftContent.checked);
|
|
|
|
...
|
...
|
@@ -106,13 +114,13 @@ exports.getSearchData = (params, channel) => { |
|
|
searchHandler.handlePathNavData({total: result[2].data.total }, params, 'search', channel),
|
|
|
{
|
|
|
filters: filters,
|
|
|
opts: searchHandler.handleOptsData(params, result[2].data.total, result[2].data.filter),
|
|
|
opts: searchHandler.handleOptsData(changeQuery, result[2].data.total, result[2].data.filter),
|
|
|
totalCount: result[2].data.total,
|
|
|
footPager: searchHandler.handlePagerData(result[2].data.total, params),
|
|
|
footPager: searchHandler.handlePagerData(result[2].data.total, changeQuery),
|
|
|
goods: productProcess.processProductList(result[2].data.product_list,
|
|
|
Object.assign({showDiscount: false, from: {type: 'search', params: params}}, params)),
|
|
|
latestWalk: 6,
|
|
|
hasNextPage: searchHandler.handleNextPage(params, result[2].data.total),
|
|
|
hasNextPage: searchHandler.handleNextPage(changeQuery, result[2].data.total),
|
|
|
shopEntry: result[3],
|
|
|
name: params.query,
|
|
|
suggest: (termsSuggestion.length !== 0) ? termsSuggestion.slice(0, 3) : false,
|
...
|
...
|
|