Browse Source

feat: 企微数据 - adq授权 - 编辑绑定投手&启用&禁用接口联调

zhengxy 2 years ago
parent
commit
07e8f19cd1

+ 1 - 0
project/src/assets/config/interface_api.js

@@ -251,6 +251,7 @@ var api = {
251 251
   adqAccount_list: "/api/pitcher/adqAccountList",
252 252
   adqAccount_adqBindPitcher: "/api/pitcher/adqBindPitcher",
253 253
   adqAccount_adqPitcherIndex: "/api/pitcher/adqPitcherIndex",
254
+  adqAccount_adqEditPitcher: "/api/pitcher/adqEditPitcher",
254 255
 };
255 256
 
256 257
 export { api };

+ 2 - 2
project/src/components/dataBoard/adqAccount/addPitcher.vue

@@ -92,8 +92,8 @@ export default {
92 92
         end_date: this.time[1]
93 93
       }
94 94
       if (this.editPitcher && this.editPitcher.drama_id) {
95
-        axios_api = this.URL.pitcher_relaEdit
96
-        params.rela_id = this.editPitcher.id
95
+        axios_api = this.URL.adqAccount_adqEditPitcher
96
+        params.rela_id = this.editPitcher.rela_id
97 97
         params.enable = this.enable ? 1 : 0
98 98
       } else {
99 99
         params.account_id = this.gzhData.account_id

+ 27 - 37
project/src/components/dataBoard/adqAccount/pitcherList.vue

@@ -53,30 +53,22 @@ export default {
53 53
     this.init(1)
54 54
   },
55 55
   methods: {
56
-    enableEvent (data, type) {//启用/禁用
57
-      this.loading = true
58
-      let params = {
59
-        drama_id: data.drama_id,
60
-        user_id: data.user_id,
61
-        start_date: data.start_date,
62
-        end_date: data.end_date,
63
-        rela_id: data.id,
64
-        enable: type
65
-      }
66
-      this.$axios.post(this.URL.BASEURL + this.URL.pitcher_relaEdit, params).then((res) => {
67
-        var res = res.data
68
-        this.loading = false
56
+    async enableEvent ({ drama_id, user_id, start_date, end_date, rela_id }, type) {//启用/禁用
57
+      try {
58
+        const params = { drama_id, user_id, start_date, end_date, rela_id, enable: type }
59
+        this.loading = true
60
+        const { data: res = {} } = await this.$axios.post(this.URL.BASEURL + this.URL.adqAccount_adqEditPitcher, params)
69 61
         if (res && res.errno == 0) {
70 62
           this.init(this.page)
63
+          this.$message.success('操作成功')
71 64
         } else if (res.errno != 4002) {
72
-          this.$message({
73
-            message: res.err,
74
-            type: "warning"
75
-          })
65
+          this.$message.warning(res.err)
76 66
         }
77
-      }).catch((err) => {
67
+      } catch (error) {
68
+        console.log('error => ', error)
69
+      } finally {
78 70
         this.loading = false
79
-      });
71
+      }
80 72
     },
81 73
     editEvent (data) {
82 74
       this.editPitcher = data;
@@ -88,31 +80,29 @@ export default {
88 80
         this.init(this.page)
89 81
       }
90 82
     },
91
-    init (page) {
92
-      this.page = page ? page : this.page;
93
-      this.loading = true
94
-      this.$axios.get(this.URL.BASEURL + this.URL.adqAccount_adqPitcherIndex, {
95
-        params: {
96
-          account_id: this.gzhData.account_id,
97
-          page: this.page,
98
-          page_size: this.page_size
99
-        }
100
-      }).then((res) => {
101
-        var res = res.data
102
-        this.loading = false
83
+    async init(page) {
84
+      try {
85
+        this.page = page ? page : this.page;
86
+        this.loading = true
87
+        const { data: res = {} } =  await this.$axios.get(this.URL.BASEURL + this.URL.adqAccount_adqPitcherIndex, {
88
+          params: {
89
+            account_id: this.gzhData.account_id,
90
+            page: this.page,
91
+            page_size: this.page_size
92
+          }
93
+        })
103 94
         if (res && res.errno == 0) {
104 95
           this.infoList = res.rst.data;
105 96
           this.total = res.rst.pageInfo.total;
106 97
           this.pages = res.rst.pageInfo.pages;
107 98
         } else if (res.errno != 4002) {
108
-          this.$message({
109
-            message: res.err,
110
-            type: "warning"
111
-          })
99
+          this.$message.warning(res.err)
112 100
         }
113
-      }).catch((err) => {
101
+      } catch (error) {
102
+        console.log('error => ', error)
103
+      } finally {
114 104
         this.loading = false
115
-      });
105
+      }
116 106
     },
117 107
     handleCurrentChange (val) {
118 108
       this.init(val)