Browse Source

发布询价自动填充

yangc 7 years ago
parent
commit
f20a129a1e

+ 17 - 2
components/applyPurchase/articleOne.vue

@@ -471,8 +471,23 @@
         window.location.href = '/seek/release/template'
       },
       setCode: function (code) {
-        this.applyObj.code = code
-        this.showSimilarCodeList = false
+        this.$http.get('/search/201819', {params: {page: 1, count: 1, type: 'component', keyword: code}})
+          .then(res => {
+            if (res.data && res.data.futures && res.data.futures.content) {
+              let obj = res.data.futures.content[0]
+              if (obj) {
+                this.applyObj.brand = obj.pbrand || obj.pbranden || ''
+                this.applyObj.prodTitle = obj.kind || obj.kinden || ''
+                this.applyObj.spec = obj.spec || ''
+              }
+            }
+            this.applyObj.code = code
+            this.showSimilarCodeList = false
+          }, err => {
+            this.applyObj.code = code
+            this.showSimilarCodeList = false
+            console.log(err.response.data || err)
+          })
       },
       setBrand: function (brand) {
         this.applyObj.brand = brand

+ 17 - 2
components/mobile/applyPurchase/PublishSeek.vue

@@ -341,8 +341,23 @@
         }
       },
       setCode: function (code) {
-        this.applyObj.code = code
-        this.showSimilarCodeList = false
+        this.$http.get('/search/201819', {params: {page: 1, count: 1, type: 'component', keyword: code}})
+          .then(res => {
+            if (res.data && res.data.futures && res.data.futures.content) {
+              let obj = res.data.futures.content[0]
+              if (obj) {
+                this.applyObj.brand = obj.pbrand || obj.pbranden || ''
+                this.applyObj.prodTitle = obj.kind || obj.kinden || ''
+                this.applyObj.spec = obj.spec || ''
+              }
+            }
+            this.applyObj.code = code
+            this.showSimilarCodeList = false
+          }, err => {
+            this.applyObj.code = code
+            this.showSimilarCodeList = false
+            console.log(err.response.data || err)
+          })
       },
       setBrand: function (brand) {
         this.applyObj.brand = brand