Browse Source

feat: 客户群分配

zhengxy 1 year ago
parent
commit
6283554369

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

@@ -489,6 +489,7 @@ var api = {
489 489
   groupTransfer_changeStatus: '/api/chatGroupTransfer/changeStatus', // 客户群分配 - 切换状态
490 490
   groupTransfer_editConfig: '/api/chatGroupTransfer/editConfig', // 客户群分配 - 设置配置
491 491
   groupTransfer_configDetail: '/api/chatGroupTransfer/configDetail', // 客户群分配 - 配置详情
492
+  groupTransfer_record: '/api/chatGroupTransfer/record', // 客户群分配 - 分配结果
492 493
 
493 494
 };
494 495
 

+ 20 - 0
project/src/components/groupTransfer/index.vue

@@ -40,6 +40,7 @@
40 40
         <template slot-scope="{ row }">
41 41
           <span v-if="row.status == 0" class="btn c-007AFF" @click="onClickStatus(row, 1)">启用</span>
42 42
           <span v-if="row.status == 1" class="btn c-FF604D" @click="onClickStatus(row, 0)">禁用</span>
43
+          <span v-if="row.status == 3" class="btn c-00b38a" @click="onClickTransferRes(row)">分配结果</span>
43 44
           <span class="btn c-00b38a" @click="onClickEditBtn(row)">编辑</span>
44 45
         </template>
45 46
       </el-table-column>
@@ -48,6 +49,12 @@
48 49
       <el-pagination background :current-page="pagination.page" @current-change="handleCurrentChange" layout="prev, pager, next" :page-count="Number(pagination.pages)" />
49 50
     </div>
50 51
 
52
+    <transferResDialog
53
+      :dialogVisible="transferResVisible"
54
+      :config_id="currentConfigId"
55
+      @close="onCloseTransferRes"
56
+    />
57
+
51 58
     <!-- S 创建配置 -->
52 59
     <configDrawer
53 60
       v-model="configDrawerVisible"
@@ -64,6 +71,8 @@ import selfInputV2 from '@/components/assembly/screen/inputV2.vue'
64 71
 import selfChannelV2 from '@/components/assembly/screen/channelV2.vue'
65 72
 import serviceSingle from '@/components/assembly/screen/serviceSingle.vue'
66 73
 import configDrawer from './configDrawer.vue'
74
+import transferResDialog from './transferResDialog.vue'
75
+
67 76
 const groupTransferStatusMap = new Map([
68 77
   [0, {label: '禁用', cls: 'c-F03F5C'}],
69 78
   [1, {label: '待分配', cls: 'c-FFB055'}],
@@ -80,6 +89,7 @@ export default {
80 89
     selfChannelV2,
81 90
     serviceSingle,
82 91
     configDrawer,
92
+    transferResDialog,
83 93
   },
84 94
   data () {
85 95
     return {
@@ -98,6 +108,7 @@ export default {
98 108
       },
99 109
       list: [],
100 110
 
111
+      transferResVisible: false,
101 112
       configDrawerVisible: false,
102 113
       currentConfigId: '',
103 114
     }
@@ -217,6 +228,15 @@ export default {
217 228
     onCancelConfig() {
218 229
       this.configDrawerVisible = false
219 230
     },
231
+
232
+    onClickTransferRes(row) {
233
+      this.currentConfigId = row.config_id
234
+      this.transferResVisible = true
235
+    },
236
+    onCloseTransferRes() {
237
+      this.currentConfigId = ''
238
+      this.transferResVisible = false
239
+    },
220 240
   },
221 241
 }
222 242
 </script>

+ 169 - 0
project/src/components/groupTransfer/transferResDialog.vue

@@ -0,0 +1,169 @@
1
+<template>
2
+  <el-dialog
3
+    :visible.sync="dialogVisible"
4
+    :before-close="handleCancel"
5
+    class="list-dialog"
6
+    :title="dialogTitle"
7
+    width="900px"
8
+  >
9
+    <!-- <div>
10
+      <selfInput label_name="关键字" @inputChange="onInputKeyword" />
11
+    </div> -->
12
+    <div class="form-wrap" v-loading="loading">
13
+      <el-table ref="tableDom" :max-height="height" :data="list" tooltip-effect="dark" style="width: 100%; margin-top: 10px;">
14
+        <el-table-column label="客户群名称" prop="name" min-width="120" align="center">
15
+          <template slot-scope="{ row }">
16
+            <span>{{ row.name || '未设置群名称' }}</span>
17
+          </template>
18
+        </el-table-column>
19
+        <el-table-column label="群主名称" prop="owner_name" min-width="100" align="center" />
20
+        <el-table-column label="分配返回码" prop="errno" min-width="80" align="center" />
21
+        <el-table-column label="分配结果说明" prop="msg" align="center" min-width="160">
22
+          <template slot-scope="{ row }">
23
+            <span :style="{ color: row.errno == 0 ? '#00B38A' : '#EB4315' }">{{ row.msg || '-' }}</span>
24
+          </template>
25
+        </el-table-column>
26
+      </el-table>
27
+      <div class="pagination" v-show="pagination.total > 0">
28
+        <el-pagination background :current-page="pagination.page" @current-change="handleCurrentChange" layout="prev, pager, next" :page-count="Number(pagination.pages)" />
29
+      </div>
30
+    </div>
31
+    <div slot="footer" class="dialog-footer">
32
+      <!-- <el-button size="mini" @click="handleCancel">关 闭</el-button> -->
33
+    </div>
34
+  </el-dialog>
35
+</template>
36
+
37
+<script>
38
+import selfInput from '@/components/assembly/screen/input.vue'
39
+export default {
40
+  components: {
41
+    selfInput,
42
+  },
43
+  props: {
44
+    // 控制弹框是否显示
45
+    dialogVisible: {
46
+      type: Boolean,
47
+      default: () => false
48
+    },
49
+    config_id: {
50
+      type: String | Number,
51
+      default: () => ''
52
+    },
53
+  },
54
+  data() {
55
+    return {
56
+      height: 500,
57
+      loading: false,
58
+      pagination: {
59
+        page: 1,
60
+        page_size: 100,
61
+        pages: 0,
62
+        total: 0,
63
+      },
64
+      filter: {
65
+        keyword: '',
66
+      },
67
+      list: [],
68
+    }
69
+  },
70
+  computed: {
71
+    // 弹框标题
72
+    dialogTitle() {
73
+      return '客户群分配结果'
74
+    }
75
+  },
76
+  watch: {
77
+    dialogVisible(isShow) {
78
+      // 弹框显示 => 初始化表单数据
79
+      if (isShow) {
80
+        this.pagination.page = 1
81
+        this.filter.keyword = ''
82
+        this.handleInitList()
83
+        this.handleGetList()
84
+      }
85
+    },
86
+  },
87
+  methods: {
88
+    // 获取列表数据
89
+    async handleGetList() {
90
+      try {
91
+        this.loading = true
92
+        const url = `${this.URL.BASEURL}${this.URL.groupTransfer_record}`
93
+        const params = {
94
+          config_id: this.config_id,
95
+          // keyword: this.filter.keyword,
96
+          page: this.pagination.page,
97
+          // page_size: this.pagination.page_size,
98
+        }
99
+        const { data: res = {} } = await this.$axios.get(url, { params })
100
+        if (res && res.errno == 0 && Array.isArray(res.rst.data)) {
101
+          this.list = res.rst.data;
102
+          this.pagination.total = res.rst.pageInfo.total;
103
+          this.pagination.pages = res.rst.pageInfo.pages;
104
+          this.$refs.tableDom.bodyWrapper.scrollTop = 0
105
+        } else if (res.errno != 4002) {
106
+          this.$message.warning(res.err)
107
+          this.handleInitList()
108
+        }
109
+      } catch (error) {
110
+        console.log(error)
111
+        this.handleInitList()
112
+      } finally {
113
+        this.loading = false
114
+      }
115
+    },
116
+    // 监听当前页数变化
117
+    handleCurrentChange(currentPage) {
118
+      this.pagination.page = currentPage
119
+      this.handleGetList()
120
+    },
121
+    // 监听"搜索剧集"变化
122
+    onInputKeyword(val) {
123
+      this.filter.keyword = val || ''
124
+      this.pagination.page = 1
125
+      this.handleGetList()
126
+    },
127
+    // 初始化列表数据
128
+    handleInitList() {
129
+      this.list = [];
130
+      this.pagination.total = 0;
131
+      this.pagination.pages = 0;
132
+    },
133
+    handleCancel() {
134
+      this.$emit('close')
135
+    },
136
+  },
137
+};
138
+</script>
139
+
140
+<style lang="scss" scoped>
141
+.list-dialog {
142
+  .status {
143
+    margin: 2px auto;
144
+    padding: 0 6px;
145
+    color: #32B38A;
146
+    border: 1px solid #32B38A;
147
+  }
148
+  .form-wrap {
149
+    padding: 0 10px;
150
+  }
151
+  .dialog-footer {
152
+    text-align: center;
153
+  }
154
+  /deep/ .el-dialog {
155
+    position: absolute;
156
+    top: 50%;
157
+    left: 50%;
158
+    margin: 0 !important;
159
+    transform: translate(-50%, -50%);
160
+  }
161
+
162
+  /deep/ .el-dialog__body {
163
+    padding: 0 10px 10px;
164
+  }
165
+  /deep/ .el-dialog__footer {
166
+    padding: 0;
167
+  }
168
+}
169
+</style>