Sfoglia il codice sorgente

联合丽格V1.0.2

zhengjinyi 1 anno fa
parent
commit
f2c71650db
1 ha cambiato i file con 16 aggiunte e 19 eliminazioni
  1. 16 19
      src/main/resources/static/js/product/list.js

+ 16 - 19
src/main/resources/static/js/product/list.js

@@ -168,7 +168,7 @@ var productList = new Vue({
                 if (response.code === 0 && response.data ) {
                     var data = response.data;
                     _self.defaultBrandLists = data.map((el, index) => {
-                        if(_self.hrefBrandId && _self.hrefBrandId == el.id){
+                        if(_self.hrefBrandId && _self.hrefBrandId === el.id){
                             el.isChecked = true;
                         }else{
                             el.isChecked = false;
@@ -298,7 +298,7 @@ var productList = new Vue({
         }
     },
     created: function () {
-        var _self = this
+        const _self = this;
         if(isPC){
             this.params.size = getUrlParam("pageSize") ? getUrlParam("pageSize") * 1 : 24;
             this.params.num = getUrlParam("pageNum") ? getUrlParam("pageNum") * 1 : 1;
@@ -341,24 +341,21 @@ var productList = new Vue({
             this.userId = JSON.parse(userInfo).userId;
             this.shopID = JSON.parse(userInfo).shopId;
         }
+        // 获取对应品牌列表
+        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)
-            }
-            console.log('aaaaa',_self.defaultBrandLists)
-            // 获取列表数据
-            this.getListByKeyword();
-            // 获取对应品牌列表
-            this.getCommoditySearchQUeryBrand();
-        },500)
+        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();
     },
     mounted: function () {
         var _self = this;