Browse Source

feat: 客服许可续期任务

zhengxy 1 year ago
parent
commit
174a01e68e

+ 51 - 15
project/src/components/license/createTaskDrawer.vue

@@ -62,14 +62,16 @@
62 62
                 </div>
63 63
               </div>
64 64
               <div class="user-wrap" v-if="account.user_list && account.user_list.length">
65
-                <el-tag
66
-                  v-for="(user, userIdx) in account.user_list"
67
-                  class="user-item-wrap"
68
-                  :key="user.user_id"
69
-                  :closable="!isDetail"
70
-                  @close="onCloseUserTag(userIdx, accountIdx)">
71
-                  {{ user.name }}
72
-                </el-tag>
65
+                <span v-for="(user, userIdx) in account.user_list" class="user-item-wrap">
66
+                  <el-tag
67
+                    :key="user.user_id"
68
+                    :type="(isDetail && handleGetUserTagType(user.status).type) || ''"
69
+                    :closable="!isDetail"
70
+                    @close="onCloseUserTag(userIdx, accountIdx)">
71
+                    {{ user.name }}
72
+                    <span v-if="isDetail">({{ handleGetUserTagType(user.status).desc }})</span>
73
+                  </el-tag>
74
+                </span>
73 75
               </div>
74 76
             </div>
75 77
           </div>
@@ -179,12 +181,22 @@ export default {
179 181
           await this.$nextTick()
180 182
           this.onChangeUserIdRes(account_list[aIdx].user_id_res, a.corpid, aIdx)
181 183
         })
184
+        this.handleGetUserDetailByReslist(list)
182 185
       }
183 186
     },
187
+    async handleGetUserDetailByReslist(list) {
188
+      await this.$nextTick()
189
+      this.form.account_list.forEach(corp => {
190
+        corp.user_list.forEach(user => {
191
+          const crtUser = list.find(l => l.user_id === user.user_id)
192
+          this.$set(user, 'status', crtUser.status)
193
+        })
194
+      });
195
+    },
184 196
     async handleGetAllList () {
185 197
       const url = `${this.URL.BASEURL}${this.URL.warn_djuserList}`
186 198
       const params = {
187
-        is_active: 1,
199
+        is_active: this.isDetail ? '' : 1,
188 200
         sys_group_id: this.$cookie.getCookie('isSuperManage') == 1 ? sessionStorage.getItem('company_session_defaultCorp_level_1').toString() : '',
189 201
       }
190 202
       const { data: res = {} } = await this.$axios.get(url, { params })
@@ -220,17 +232,29 @@ export default {
220 232
       this.form.account_list[accountIdx].user_id_res = user_id_res
221 233
       this.form.account_list[accountIdx].user_list = this.handleGetUserListByUseridres(user_id_res, corpid)
222 234
     },
235
+    handleGetUserTagType(status) {
236
+      const statusTypeMap = new Map([
237
+        [-1, {type: 'danger', desc: '续期失败'}],
238
+        [0, {type: 'warning', desc: '待支付'}],
239
+        [1, {type: '', desc: '已支付'}],
240
+        [2, {type: 'info', desc: '已取消'}],
241
+      ])
242
+      return statusTypeMap.get(status) || { type: '', desc: '' }
243
+    },
223 244
     onCloseUserTag(userIdx, accountIdx) {
224 245
       this.form.account_list[accountIdx].user_list.splice(userIdx, 1)
225 246
       this.form.account_list[accountIdx].user_id_res = this.form.account_list[accountIdx].user_list.map(user => user.user_id)
226 247
     },
227 248
     async onClickDeleteCorp(idx) {
228 249
       try {
229
-        await this.$confirm('确定清空当前已选的客服账号吗?', '提示', {
230
-          confirmButtonText: '确定',
231
-          cancelButtonText: '取消',
232
-          type: 'warning'
233
-        })
250
+        const isSelected = this.form.account_list[idx].user_id_res.length
251
+        if (isSelected) {
252
+          await this.$confirm('确定清空当前已选的客服账号吗?', '提示', {
253
+            confirmButtonText: '确定',
254
+            cancelButtonText: '取消',
255
+            type: 'warning'
256
+          })
257
+        }
234 258
         this.form.account_list.splice(idx, 1)
235 259
         this.handleInitCorpOptionsStatus()
236 260
       } catch (error) {
@@ -404,8 +428,20 @@ export default {
404 428
             background-color: rgb(247, 247, 247);
405 429
             margin-top: 10px;
406 430
             padding: 10px 10px 0 10px;
431
+            display: flex;
432
+            align-items: center;
433
+            flex-wrap: wrap;
407 434
             .user-item-wrap {
408
-              margin: 0 10px 10px 0;
435
+              position: relative;
436
+              margin: 0 14px 10px 0;
437
+              .err-icon {
438
+                position: absolute;
439
+                top: -5px;
440
+                right: -5px;
441
+                color: #c1c1c1;
442
+                font-size: 15px;
443
+                font-weight: 500;
444
+              }
409 445
             }
410 446
           }
411 447
         }

+ 73 - 0
project/src/components/license/errListDialog.vue

@@ -0,0 +1,73 @@
1
+<template>
2
+  <el-dialog
3
+    :visible.sync="dialogVisible"
4
+    :before-close="handleCancel"
5
+    class="errlist-dialog"
6
+    :title="title"
7
+    width="550px"
8
+    :close-on-click-modal="false"
9
+  >
10
+    <div class="content-wrap" v-loading="loading">
11
+      <el-table max-height="300" :data="list" tooltip-effect="dark" style="width: 100%;">
12
+        <el-table-column label="企微主体" prop="corp_name" min-width="150" align="center" show-overflow-tooltip fixed="left" />
13
+        <el-table-column label="关闭失败原因" prop="errmsg" min-width="300" align="center" show-overflow-tooltip />
14
+      </el-table>
15
+    </div>
16
+    <div slot="footer" class="dialog-footer">
17
+      <el-button size="mini" type="primary" @click="handleCancel">关 闭</el-button>
18
+    </div>
19
+  </el-dialog>
20
+</template>
21
+
22
+<script>
23
+export default {
24
+  props: {
25
+    // 控制弹框是否显示
26
+    dialogVisible: {
27
+      type: Boolean,
28
+      default: () => false
29
+    },
30
+    list: {
31
+      type: [],
32
+      default: () => []
33
+    }
34
+  },
35
+  data() {
36
+    return {
37
+      loading: false,
38
+    }
39
+  },
40
+  computed: {
41
+    title() {
42
+      return ``
43
+    },
44
+  },
45
+  watch: {
46
+    dialogVisible(isShow) {
47
+      if (isShow) {
48
+        // do sth.
49
+      }
50
+    },
51
+  },
52
+  methods: {
53
+    handleCancel() {
54
+      this.$emit('close')
55
+    },
56
+    // 清空弹框表单数据
57
+    handleClearFormData() {
58
+      // this.form.app_id = ''
59
+    },
60
+  },
61
+};
62
+</script>
63
+
64
+<style lang="scss" scoped>
65
+.errlist-dialog {
66
+  .content-wrap {
67
+    min-height: 150px;
68
+  }
69
+  .dialog-footer {
70
+    text-align: center;
71
+  }
72
+}
73
+</style>

+ 25 - 0
project/src/components/license/index.vue

@@ -52,6 +52,14 @@
52 52
       @cancel="onCancelCreateTask"
53 53
     />
54 54
     <!-- E 创建续期任务 -->
55
+
56
+    <!-- S 取消失败信息 -->
57
+    <errListDialog
58
+      :dialogVisible="errListDialogVisible"
59
+      :list="currentErrList"
60
+      @close="onCloseErrList"
61
+    />
62
+    <!-- E 取消失败信息 -->
55 63
   </div>
56 64
 </template>
57 65
 
@@ -59,6 +67,7 @@
59 67
 import selfChannelV2 from '@/components/assembly/screen/channelV2.vue'
60 68
 import selfInputV2 from '@/components/assembly/screen/inputV2.vue'
61 69
 import createTaskDrawer from './createTaskDrawer.vue'
70
+import errListDialog from './errListDialog.vue'
62 71
 import { licenseTaskStatusMap, licenseTaskStatusCode } from '@/assets/js/staticTypes'
63 72
 
64 73
 export default {
@@ -67,6 +76,7 @@ export default {
67 76
     selfChannelV2,
68 77
     selfInputV2,
69 78
     createTaskDrawer,
79
+    errListDialog,
70 80
   },
71 81
   data () {
72 82
     return {
@@ -88,6 +98,9 @@ export default {
88 98
 
89 99
       createTaskDrawerVisible: false,
90 100
       currentTaskId: '',
101
+
102
+      errListDialogVisible: false,
103
+      currentErrList: [],
91 104
     }
92 105
   },
93 106
   created () {
@@ -165,6 +178,8 @@ export default {
165 178
         const { data: res = {} } = await this.$axios.post(url, params)
166 179
         if (res && res.errno == 0) {
167 180
           this.$message.success('操作成功')
181
+        } else if (res.errno == 2708 && Array.isArray(res.rst) && res.rst.length) {
182
+          this.handleShowErrList(res.rst)
168 183
         } else if (res.errno != 4002) {
169 184
           this.$message.warning(res.err)
170 185
         }
@@ -179,6 +194,7 @@ export default {
179 194
       const allowedStatus = [licenseTaskStatusCode.NOT_EXECUTED, licenseTaskStatusCode.EXECUTED]
180 195
       return allowedStatus.includes(status)
181 196
     },
197
+
182 198
     // 监听点击“客服数量”
183 199
     onClickUserNum(row) {
184 200
       this.currentTaskId = row.rule_id
@@ -197,6 +213,15 @@ export default {
197 213
     onCancelCreateTask() {
198 214
       this.createTaskDrawerVisible = false
199 215
     },
216
+
217
+    handleShowErrList(list) {
218
+      this.currentErrList = [...list]
219
+      this.errListDialogVisible = true
220
+    },
221
+    onCloseErrList() {
222
+      this.errListDialogVisible = false
223
+      this.currentErrList = []
224
+    },
200 225
   },
201 226
 }
202 227
 </script>