Authored by htoooth

Merge branch 'release/5.5' into gray

@@ -42,6 +42,7 @@ const transPrice = (price) => { @@ -42,6 +42,7 @@ const transPrice = (price) => {
42 exports.getSearchData = (params, channel) => { 42 exports.getSearchData = (params, channel) => {
43 43
44 let searchParams = searchHandler.getSearchParams(params); 44 let searchParams = searchHandler.getSearchParams(params);
  45 + let changeQuery = Object.assign({}, params);
45 46
46 switch (channel) { 47 switch (channel) {
47 case 'boys': 48 case 'boys':
@@ -95,10 +96,17 @@ exports.getSearchData = (params, channel) => { @@ -95,10 +96,17 @@ exports.getSearchData = (params, channel) => {
95 // 获取商品数据和顶部筛选条件 96 // 获取商品数据和顶部筛选条件
96 if (result[2].code === 200) { 97 if (result[2].code === 200) {
97 98
98 - let filters = Object.assign(searchHandler.handleFilterDataAll(result[2].data, params),  
99 - finalResult.search.leftContent.sort); 99 + // 搜索推荐词,获取对应的参数值
100 let termsSuggestion = _.get(result[2], 'data.suggestion.terms_suggestion', []); 100 let termsSuggestion = _.get(result[2], 'data.suggestion.terms_suggestion', []);
101 101
  102 + // 推荐词 获取无商品,首次搜索,通过isChangedQuery做开关
  103 + if (result[2].data.isChangedQuery === 'Y') {
  104 + Object.assign(changeQuery, {query: termsSuggestion[0]});
  105 + }
  106 +
  107 + let filters = Object.assign(searchHandler.handleFilterDataAll(result[2].data, changeQuery),
  108 + finalResult.search.leftContent.sort);
  109 +
102 filters.checkedConditions.conditions = _.concat(filters.checkedConditions.conditions, 110 filters.checkedConditions.conditions = _.concat(filters.checkedConditions.conditions,
103 finalResult.search.leftContent.checked); 111 finalResult.search.leftContent.checked);
104 112
@@ -106,13 +114,13 @@ exports.getSearchData = (params, channel) => { @@ -106,13 +114,13 @@ exports.getSearchData = (params, channel) => {
106 searchHandler.handlePathNavData({total: result[2].data.total }, params, 'search', channel), 114 searchHandler.handlePathNavData({total: result[2].data.total }, params, 'search', channel),
107 { 115 {
108 filters: filters, 116 filters: filters,
109 - opts: searchHandler.handleOptsData(params, result[2].data.total, result[2].data.filter), 117 + opts: searchHandler.handleOptsData(changeQuery, result[2].data.total, result[2].data.filter),
110 totalCount: result[2].data.total, 118 totalCount: result[2].data.total,
111 - footPager: searchHandler.handlePagerData(result[2].data.total, params), 119 + footPager: searchHandler.handlePagerData(result[2].data.total, changeQuery),
112 goods: productProcess.processProductList(result[2].data.product_list, 120 goods: productProcess.processProductList(result[2].data.product_list,
113 Object.assign({showDiscount: false, from: {type: 'search', params: params}}, params)), 121 Object.assign({showDiscount: false, from: {type: 'search', params: params}}, params)),
114 latestWalk: 6, 122 latestWalk: 6,
115 - hasNextPage: searchHandler.handleNextPage(params, result[2].data.total), 123 + hasNextPage: searchHandler.handleNextPage(changeQuery, result[2].data.total),
116 shopEntry: result[3], 124 shopEntry: result[3],
117 name: params.query, 125 name: params.query,
118 suggest: (termsSuggestion.length !== 0) ? termsSuggestion.slice(0, 3) : false, 126 suggest: (termsSuggestion.length !== 0) ? termsSuggestion.slice(0, 3) : false,