Authored by 郭成尧

'店铺商品筛选数据初步处理'

@@ -11,6 +11,7 @@ const shopApi = require('./shop-api'); @@ -11,6 +11,7 @@ const shopApi = require('./shop-api');
11 const processProductList = require(`${global.utils}/beautify/product`); 11 const processProductList = require(`${global.utils}/beautify/product`);
12 const camelCase = global.yoho.camelCase; 12 const camelCase = global.yoho.camelCase;
13 const _ = require('lodash'); 13 const _ = require('lodash');
  14 +const prettyFilter = require(`${global.utils}/beautify/filters`);
14 15
15 /** 16 /**
16 * 获取品牌店铺数据 17 * 获取品牌店铺数据
@@ -115,6 +116,7 @@ const getBrandShopGoodsData = params => { @@ -115,6 +116,7 @@ const getBrandShopGoodsData = params => {
115 })) 116 }))
116 ]).then(subResult => { 117 ]).then(subResult => {
117 if (subResult[0].code === 200) { 118 if (subResult[0].code === 200) {
  119 + prettyFilter(subResult[0].data.filter);
118 finalResult.data = { 120 finalResult.data = {
119 productList: processProductList(subResult[0].data.product_list), 121 productList: processProductList(subResult[0].data.product_list),
120 filter: subResult[0].data.filter 122 filter: subResult[0].data.filter
@@ -30,8 +30,8 @@ @@ -30,8 +30,8 @@
30 shareData: {}, // 分享相关数据 30 shareData: {}, // 分享相关数据
31 shopInfo: {}, // 店铺介绍相关数据 31 shopInfo: {}, // 店铺介绍相关数据
32 32
33 - sortConfig: global.sortConfig,  
34 - filterConfig: global.filterConfig, 33 + sortConfig: {},
  34 + filterConfig: {},
35 35
36 // query 36 // query
37 url: '/product/get-brand-shop-goods', 37 url: '/product/get-brand-shop-goods',
@@ -135,11 +135,11 @@ @@ -135,11 +135,11 @@
135 created() { 135 created() {
136 this.getShopInfo(); 136 this.getShopInfo();
137 this.search(); 137 this.search();
138 - bus.$on('list.paging', function() { 138 + bus.$on('list.paging', () =>{
139 this.search(); 139 this.search();
140 }); 140 });
141 141
142 - bus.$on('sort.change', function({ val }) { 142 + bus.$on('sort.change', ({ val }) => {
143 console.log(val); 143 console.log(val);
144 this.sort = val; 144 this.sort = val;
145 }); 145 });
@@ -150,9 +150,9 @@ @@ -150,9 +150,9 @@
150 * 1. 重新搜索 150 * 1. 重新搜索
151 * 2. 关闭 drawer 组件 151 * 2. 关闭 drawer 组件
152 */ 152 */
153 - bus.$on('filter.change', function({ val }) {  
154 - console.log(val);  
155 - this.filter = val; 153 + bus.$on('filter.change', ({val}) => {
  154 + Object.assign(this.filter, val);
  155 + this.search();
156 this.$refs.drawer.on = false; 156 this.$refs.drawer.on = false;
157 }); 157 });
158 158
@@ -161,8 +161,7 @@ @@ -161,8 +161,7 @@
161 * 1. 打开view 161 * 1. 打开view
162 * 2. 监听 router.back ,重新设置 筛选值 162 * 2. 监听 router.back ,重新设置 筛选值
163 */ 163 */
164 - bus.$on('filter.sub.show', function({val}) {  
165 - console.log(this); 164 + bus.$on('filter.sub.show', ({val}) => {
166 this.openFilterSub(val); 165 this.openFilterSub(val);
167 }); 166 });
168 } 167 }