Эх сурвалжийг харах

修改pc搜索联想词关联顺序

yangc 7 жил өмнө
parent
commit
8820bd0180

+ 14 - 14
components/common/PcSearchHeader.vue

@@ -118,46 +118,46 @@
         } else {
           let sType = null
           if (this.type === 'default' && this.keyword && this.keyword !== '' && this.similarList.component) {
-            if (this.similarList.component[0] && this.keyword === this.similarList.component[0].code) {
-              sType = 'code'
-            } else if (this.similarList.brand[0] && this.keyword === this.similarList.brand[0].nameEn) {
+            if (this.similarList.brand[0] && this.keyword === this.similarList.brand[0].nameEn) {
               sType = 'brand'
             } else if (this.similarList.kind[0] && this.keyword === this.similarList.kind[0].nameCn) {
               sType = 'kind'
+            } else if (this.similarList.component[0] && this.keyword === this.similarList.component[0].code) {
+              sType = 'code'
             } else {
               let arr = [...this.similarList.component, ...this.similarList.brand, ...this.similarList.kind]
               if (arr[0]) {
-                if (arr[0].code) {
-                  this.keyword = arr[0].code
-                  sType = 'code'
-                } else if (arr[0].nameEn) {
+                if (arr[0].nameEn) {
                   this.keyword = arr[0].nameEn
                   sType = 'brand'
                 } else if (arr[0].nameCn) {
                   this.keyword = arr[0].nameCn
                   sType = 'kind'
+                } else if (arr[0].code) {
+                  this.keyword = arr[0].code
+                  sType = 'code'
                 }
               }
             }
           } else if (this.type === 'supplier' && this.keyword && this.keyword !== '' && this.similarList.pCmpCode) {
-            if (this.similarList.pCmpCode[0] && this.keyword === this.similarList.pCmpCode[0].pCmpCode) {
-              sType = 'pCmpCode'
-            } else if (this.similarList.pBrandEn[0] && this.keyword === this.similarList.pBrandEn[0].nameEn) {
+            if (this.similarList.pBrandEn[0] && this.keyword === this.similarList.pBrandEn[0].nameEn) {
               sType = 'pBrandEn'
             } else if (this.similarList.kind[0] && this.keyword === this.similarList.kind[0].kind) {
               sType = 'kind'
+            } else if (this.similarList.pCmpCode[0] && this.keyword === this.similarList.pCmpCode[0].pCmpCode) {
+              sType = 'pCmpCode'
             } else {
               let arr = [...this.similarList.pCmpCode, ...this.similarList.pBrandEn, ...this.similarList.kind]
               if (arr[0]) {
-                if (arr[0].pCmpCode) {
-                  this.keyword = arr[0].pCmpCode
-                  sType = 'pCmpCode'
-                } else if (arr[0].nameEn) {
+                if (arr[0].nameEn) {
                   this.keyword = arr[0].nameEn
                   sType = 'pBrandEn'
                 } else if (arr[0].kind) {
                   this.keyword = arr[0].kind
                   sType = 'kind'
+                } else if (arr[0].pCmpCode) {
+                  this.keyword = arr[0].pCmpCode
+                  sType = 'pCmpCode'
                 }
               }
             }