浏览代码

品牌搜索回显

zhengjinyi 3 年之前
父节点
当前提交
ef1ac95445
共有 2 个文件被更改,包括 22 次插入20 次删除
  1. 11 10
      src/main/resources/static/js/product/list.js
  2. 11 10
      src/main/resources/static/js/product/produce-list.js

+ 11 - 10
src/main/resources/static/js/product/list.js

@@ -303,16 +303,6 @@ var productList = new Vue({
             this.hrefBrandId = getUrlParam("bpn") ? getUrlParam("bpn") : null; //bpn 品牌链接参数
             this.params.promotionFlag = getUrlParam("pro") ? getUrlParam("pro")*1 : 0; // pro 促销商品链接参数
             this.params.newFlag = getUrlParam("newg") ? getUrlParam("newg")*1 : 0; // newg 新品链接参数
-            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.brandId === item*1)
-                    return find && find.name
-                })
-                this.choiceBrandText = names.join(',').slice(0,15)
-            }
             if(this.params.promotionFlag == 1){
                 this.isActiviChecked = true;
             }else{
@@ -349,6 +339,17 @@ var productList = new Vue({
         this.getListByKeyword();
         // 获取对应品牌列表
         this.getCommoditySearchQUeryBrand();
+        // 设置选中的品牌
+        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.brandId === item*1)
+                return find && find.name
+            })
+            this.choiceBrandText = names.join(',').slice(0,15)
+        }
     },
     mounted: function () {
         var _self = this;

+ 11 - 10
src/main/resources/static/js/product/produce-list.js

@@ -289,16 +289,6 @@ var productList = new Vue({
         this.hrefBrandId = getUrlParam("bpn") ? getUrlParam("bpn") : null; //bpn 品牌链接参数
         this.params.promotionFlag = getUrlParam("pro") ? getUrlParam("pro")*1 : 0; // pro 促销商品链接参数
         this.params.newFlag = getUrlParam("newg") ? getUrlParam("newg")*1 : 0; // newg 新品链接参数
-        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.brandId === item*1)
-                return find && find.name
-            })
-            this.choiceBrandText = names.join(',').slice(0,15)
-        }
         if(this.params.promotionFlag == 1){
             this.isActiviChecked = true;
         }else{
@@ -334,6 +324,17 @@ var productList = new Vue({
         }
         // 获取对应品牌列表
         this.getCommoditySearchQUeryBrand();
+        // 设置选中的品牌
+        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.brandId === item*1)
+                return find && find.name
+            })
+            this.choiceBrandText = names.join(',').slice(0,15)
+        }
         if(!isPC){
             $('footer').addClass("noneImportant");
             //移动端上垃加载更多