瀏覽代碼

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

zhengxy 2 年之前
父節點
當前提交
07e8f19cd1

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

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

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

92
         end_date: this.time[1]
92
         end_date: this.time[1]
93
       }
93
       }
94
       if (this.editPitcher && this.editPitcher.drama_id) {
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
         params.enable = this.enable ? 1 : 0
97
         params.enable = this.enable ? 1 : 0
98
       } else {
98
       } else {
99
         params.account_id = this.gzhData.account_id
99
         params.account_id = this.gzhData.account_id

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

53
     this.init(1)
53
     this.init(1)
54
   },
54
   },
55
   methods: {
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
         if (res && res.errno == 0) {
61
         if (res && res.errno == 0) {
70
           this.init(this.page)
62
           this.init(this.page)
63
+          this.$message.success('操作成功')
71
         } else if (res.errno != 4002) {
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
         this.loading = false
70
         this.loading = false
79
-      });
71
+      }
80
     },
72
     },
81
     editEvent (data) {
73
     editEvent (data) {
82
       this.editPitcher = data;
74
       this.editPitcher = data;
88
         this.init(this.page)
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
         if (res && res.errno == 0) {
94
         if (res && res.errno == 0) {
104
           this.infoList = res.rst.data;
95
           this.infoList = res.rst.data;
105
           this.total = res.rst.pageInfo.total;
96
           this.total = res.rst.pageInfo.total;
106
           this.pages = res.rst.pageInfo.pages;
97
           this.pages = res.rst.pageInfo.pages;
107
         } else if (res.errno != 4002) {
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
         this.loading = false
104
         this.loading = false
115
-      });
105
+      }
116
     },
106
     },
117
     handleCurrentChange (val) {
107
     handleCurrentChange (val) {
118
       this.init(val)
108
       this.init(val)