Selaa lähdekoodia

联合丽格V1.0.2

zhengjinyi 1 vuosi sitten
vanhempi
commit
51c8e23e0f
1 muutettua tiedostoa jossa 15 lisäystä ja 17 poistoa
  1. 15 17
      src/main/resources/static/js/product/list.js

+ 15 - 17
src/main/resources/static/js/product/list.js

@@ -162,8 +162,8 @@ var productList = new Vue({
                 }
             });
         },
-        getCommoditySearchQUeryBrand:function() { // 查询筛选项品牌
-            var _self = this;
+        getCommoditySearchQUeryBrand() { // 查询筛选项品牌
+            const _self = this;
             ProductApi.getCommoditySearchQUeryBrand(_self.brandParam,function (response) {
                 if (response.code === 0 && response.data ) {
                     var data = response.data;
@@ -175,6 +175,17 @@ var productList = new Vue({
                         }
                         return el;
                     })
+                    // 设置选中的品牌
+                    if(this.hrefBrandId){
+                        let brandIdsArray = this.hrefBrandId.split(',')
+                        this.params.brandIds = this.hrefBrandId +',';
+                        this.isChoiceBrandText = true
+                        const names = brandIdsArray.map(function (item) {
+                            const find = _self.defaultBrandLists.find(el => el.id === item*1)
+                            return find && find.name
+                        })
+                        this.choiceBrandText = names.join(',').slice(0,15)
+                    }
                     _self.brandLists = _self.defaultBrandLists.slice(0,7)
                 }else {
                     console.log('查询品牌列表异常')
@@ -343,22 +354,9 @@ var productList = new Vue({
         }
         // 获取对应品牌列表
         this.getCommoditySearchQUeryBrand();
-        // 设置选中的品牌
-        setTimeout(()=>{
-            if(this.hrefBrandId){
-                const brandIdsArray = this.hrefBrandId.split(',')
-                this.params.brandIds = this.hrefBrandId +',';
-                this.isChoiceBrandText = true
-                const names = brandIdsArray.map(function (item) {
-                    const find = _self.defaultBrandLists.find(el => el.id === item*1)
-                    return find && find.name
-                })
-                this.choiceBrandText = names.join(',').slice(0,15)
-            }
-            // 获取列表数据
-            this.getListByKeyword();
-        },500)
 
+        // 获取列表数据
+        this.getListByKeyword();
     },
     mounted: function () {
         var _self = this;