Browse Source

feat: ADQ账号管理 - 绑定状态校验逻辑

zhengxy 1 year ago
parent
commit
a5e4744cec

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

@@ -471,6 +471,7 @@ var api = {
471 471
   adqAccount_bindPidList: '/api/accountConf/bindPidList', // adq账号授权 - 绑定推广计划列表
472 472
   adqAccount_pidEditStatus: '/api/accountConf/editStatus', // adq账号授权 - 推广计划状态
473 473
   adqAccount_adqBindPid: '/api/accountConf/bindPid', // adq账号授权 - 绑定推广计划ID
474
+  adqAccount_checkBindType: '/api/accountConf/checkBindType', // adq账号授权 - 绑定状态校验
474 475
 
475 476
 };
476 477
 

+ 31 - 1
project/src/components/dataBoard/adqAccount/accountBindUser.vue

@@ -2,7 +2,7 @@
2 2
   <div class="container" v-loading="loading">
3 3
     <div class="flex">
4 4
       <div class="flex-start">
5
-        <el-button type="primary" size="small" @click="bindFlag=true">绑定客服</el-button>
5
+        <el-button type="primary" size="small" @click="onClickBindBtn">绑定客服</el-button>
6 6
         <div class="selectCustom" style="margin-bottom: 0;">已选择{{multipleArr.length}}个客服
7 7
           <el-button type="info" plain size="mini" @click="clearSelect">清空选中</el-button>
8 8
         </div>
@@ -57,6 +57,7 @@ export default{
57 57
   components:{ customerServiceCorpCon },
58 58
   data(){
59 59
     return{
60
+      sys_group_id: this.$cookie.getCookie('isSuperManage') == 1 ? sessionStorage.getItem('company_session_defaultCorp_level_1').toString() : '',
60 61
       tableData: [],
61 62
       loading: false,
62 63
       bindFlag: false,
@@ -266,6 +267,35 @@ export default{
266 267
       }).catch((err) => {
267 268
       });
268 269
     },
270
+
271
+    async onClickBindBtn() {
272
+      const { bind_status = false, msg } = await this.handleGetBindStatus()
273
+      if (bind_status) { // 已绑定 => 提示先解绑
274
+        this.$message.warning(msg)
275
+      } else {
276
+        this.bindFlag = true
277
+      }
278
+    },
279
+    async handleGetBindStatus() {
280
+      try {
281
+        const url = `${this.URL.BASEURL}${this.URL.adqAccount_checkBindType}`
282
+        const params = {
283
+          sys_group_id: this.sys_group_id,
284
+          account_id: this.account_id,
285
+          type: 1,
286
+        }
287
+        const { data: res = {} } = await this.$axios.get(url, { params })
288
+        if (res && res.errno == 0) {
289
+          return Promise.resolve({...res.rst})
290
+        } else if (res.error != 4002) {
291
+          this.$message.warning(res.err)
292
+          return Promise.reject(res.err)
293
+        }
294
+      } catch (error) {
295
+        console.log(error)
296
+        return Promise.reject(error)
297
+      }
298
+    },
269 299
   }
270 300
 }
271 301
 </script>

+ 36 - 2
project/src/components/dataBoard/adqAccount/adqBindPid.vue

@@ -117,6 +117,15 @@ export default {
117 117
     // 监听点击切换"状态"
118 118
     async onClickStatus(row) {
119 119
       try {
120
+
121
+        if (row.status == 0) { // 设置启用时 => 校验绑定状态 => 提示
122
+          const { bind_status = false, msg } = await this.handleGetBindStatus()
123
+          if (bind_status) { // 已绑定 => 提示先解绑
124
+            this.$message.warning(msg)
125
+            return false
126
+          }
127
+        }
128
+
120 129
         await this.$confirm(`确定${row.status == 0 ? '启用' : '禁用'}当前推广计划吗?`, `推广计划(${row.pid})`, {
121 130
           confirmButtonText: '确定',
122 131
           cancelButtonText: '取消',
@@ -149,8 +158,13 @@ export default {
149 158
 
150 159
 
151 160
     // 监听点击“绑定推广计划”
152
-    onClickBindPid() {
153
-      this.bindPidDialogVisible = true
161
+    async onClickBindPid() {
162
+      const { bind_status = false, msg } = await this.handleGetBindStatus()
163
+      if (bind_status) { // 已绑定 => 提示先解绑
164
+        this.$message.warning(msg)
165
+      } else {
166
+        this.bindPidDialogVisible = true
167
+      }
154 168
     },
155 169
     onConfirmBindPid() {
156 170
       this.bindPidDialogVisible = false
@@ -160,6 +174,26 @@ export default {
160 174
     onCancelBindPid() {
161 175
       this.bindPidDialogVisible = false
162 176
     },
177
+    async handleGetBindStatus() {
178
+      try {
179
+        const url = `${this.URL.BASEURL}${this.URL.adqAccount_checkBindType}`
180
+        const params = {
181
+          sys_group_id: this.sys_group_id,
182
+          account_id: this.account_id,
183
+          type: 2,
184
+        }
185
+        const { data: res = {} } = await this.$axios.get(url, { params })
186
+        if (res && res.errno == 0) {
187
+          return Promise.resolve({...res.rst})
188
+        } else if (res.error != 4002) {
189
+          this.$message.warning(res.err)
190
+          return Promise.reject(res.err)
191
+        }
192
+      } catch (error) {
193
+        console.log(error)
194
+        return Promise.reject(error)
195
+      }
196
+    },
163 197
   }
164 198
 }
165 199
 </script>