Browse Source

TBtools-下拉框选词搜索扣费

panyong 4 years ago
parent
commit
1be3f5bcbc
1 changed files with 9 additions and 7 deletions
  1. 9 7
      htmldev/TBTools/src/views/modules/tools/tools-starkeysearch.vue

+ 9 - 7
htmldev/TBTools/src/views/modules/tools/tools-starkeysearch.vue

@@ -78,26 +78,28 @@ export default {
         this.dataListLoading = true
         this.$jsonp(api, {}).then((res) => {
           if (res && Array.isArray(res.result)) {
-            this.dataList = res.result.map(item => ({
-              value: item[0],
-              resource: resource
-            }))
-            this.funPayment(encodeURIComponent(api))
+            this.funPayment(res.result, resource)
+          } else {
+            this.$message.error('出错了,请联系客服')
           }
           this.dataListLoading = false
         })
       })
     },
     // 扣费接口
-    funPayment (api = '') {
+    funPayment (result = [], resource = '') {
       this.$http({
         url: this.$http.adornUrl('/user/apicut'),
         method: 'get',
         params: this.$http.adornParams({
-          path: api
+          path: 'tb/suggest'
         })
       }).then(({ data }) => {
         if (data.status) {
+          this.dataList = result.map(item => ({
+            value: item[0],
+            resource: resource
+          }))
           return
         }
         this.$message.error(data.msg)