Browse Source

feat: 智能推送 - 优化

zhengxy 1 year ago
parent
commit
579fa767ad

+ 5 - 147
project/src/components/smartPushV3/createMassMsg.vue

@@ -26,44 +26,6 @@
26 26
       <!-- E 选择模板 -->
27 27
 
28 28
       <h3 class="bigTitle">基础信息</h3>
29
-
30
-      <!-- S 选择模式 -->
31
-      <!-- <div class="regulations">
32
-        <label><em>*</em>选择模式:</label>
33
-        <div style="display:flex">
34
-          <el-radio v-model="operate_type" :label="1">单个企微主体</el-radio>
35
-          <el-radio v-model="operate_type" :label="2">多个企微主体</el-radio>
36
-        </div>
37
-      </div> -->
38
-      <!-- E 选择模式 -->
39
-
40
-      <!-- S 使用员工 - 单个企微主体 模式 -->
41
-      <!-- <div v-show="operate_type == 1" class="regulations">
42
-        <label><em>*</em>使用员工:</label>
43
-        <div>
44
-          <div style="display:flex">
45
-            <el-radio v-model="is_all" :label="1">全部员工</el-radio>
46
-            <el-radio v-model="is_all" :label="0">部分员工</el-radio>
47
-          </div>
48
-          <self-customerservice v-if="is_all == 0" title='' width="300px" :afferent_users='user_id_list' @customerDefine="(val) => { user_id_list = val; }" />
49
-        </div>
50
-      </div> -->
51
-      <!-- S 使用员工 - 单个企微主体 模式 -->
52
-
53
-      <!-- S 使用员工 - 多个企微主体 模式 -->
54
-      <!-- <div v-show="operate_type == 2" class="regulations">
55
-        <label><em>*</em>使用员工:</label>
56
-        <div>
57
-          <div style="display:flex">
58
-            <el-radio v-model="is_operation" :label="1">运营组</el-radio>
59
-            <el-radio v-model="is_operation" :label="0">选择成员</el-radio>
60
-          </div>
61
-          <selfChannel v-show="is_operation == 1" ref="operatorIdEl" :afferent_value="operator_group_id" title="" type='operatorGroup' width="300px" @channelDefine="onChangeOperatorGroupId" />
62
-          <customerServiceCorpV2 v-show="is_operation == 0" title="" width="300px" :afferent_users="afferent_multiple_senders" @customerDefine="onChangeMultiCorpUsers" />
63
-        </div>
64
-      </div> -->
65
-      <!-- S 使用员工 - 多个企微主体 模式 -->
66
-
67 29
       <div class="regulations">
68 30
         <label><em>*</em>规则配置</label>
69 31
         <div style="margin-top: 10px;" class="screeningCustomers">
@@ -101,21 +63,6 @@
101 63
               </div>
102 64
             </div>
103 65
           </div>
104
-
105
-          <!-- S 标签相关 单主体模式时显示 -->
106
-          <!-- <div v-show="operate_type == 1" class="screeningItem">
107
-            <label>标签:</label>
108
-            <enterprise-tag title="" width="355px" :afferent_obj='afferent_tag_obj' :reset='resetFlag' @tagDefine="tagDefine" style="margin:0" />
109
-          </div> -->
110
-          <!-- <div v-show="operate_type == 1" class="screeningItem" style="align-items: flex-start;">
111
-            <label>排除客户:</label>
112
-            <div style="flex:1">
113
-              <enterprise-tag title="" width="355px" :afferent_obj='afferent_exclude_tag_obj'
114
-                :excludeFlag="true" :reset='resetFlag' @tagDefine="exclude_tagDefine" style="margin:0" />
115
-              <p class="screening-hint">可根据标签选择客户,群发时将不会发送给该标签内的客户。若选择了排除的客户,需要较长时间创建本条群发消息哦~</p>
116
-            </div>
117
-          </div> -->
118
-          <!-- E 标签相关 单主体模式时显示 -->
119 66
         </div>
120 67
       </div>
121 68
 
@@ -182,7 +129,7 @@ import { getIntegerNumber, isJSON } from '@/assets/js/common'
182 129
 
183 130
 export default {
184 131
   components: { selfChannel, selfCustomerservice, customerServiceCorpV2, datePicker, enterpriseTag, editCon, screenPay, pushGroupDialog },
185
-  props: ['title', 'rule_id', 'isCopy', 'createTempGroupId', 'createTemplateId'],
132
+  props: ['title', 'rule_id', 'isCopy', 'createTempGroupId', 'createTemplateId', 'createGroupId'],
186 133
   data () {
187 134
     return {
188 135
       loading: true,
@@ -193,17 +140,6 @@ export default {
193 140
       gender: [], // 规则配置 - 性别
194 141
       payInfo: {}, // 规则配置 - 付费情况
195 142
 
196
-      // afferent_tag_obj: { // 规则配置 - 标签
197
-      //   tag_id_list: [],
198
-      //   tag: 1
199
-      // },
200
-      // tag_info: {},//标签
201
-      // afferent_exclude_tag_obj: { // 规则配置 - 排除客户 标签
202
-      //   tag_id_list: [],
203
-      //   tag: 1
204
-      // },
205
-      // exclude_tag_info: {},//排除标签
206
-
207 143
       send_conf: [ // 规则配置 - 添加客服时间
208 144
         {
209 145
           natural_day: '',
@@ -229,15 +165,6 @@ export default {
229 165
       group_id: '',
230 166
       groupOptions: [],
231 167
       pushGroupVisible: false,
232
-
233
-      // is_all: 1, // 使用员工:1全部员工 0部分员工
234
-      // user_id_list: [], // 员工列表
235
-
236
-      // operate_type: 1, // 运营模式 1单主体 2多主体
237
-      // is_operation: 1, // 多主体模式时 是否为选择“运营组” 1是 0否
238
-      // operator_group_id: '', // 运营组id
239
-      // afferent_multiple_senders: [], // 多个主体时选择的客服成员 [{ user_id: 888, corpid: 666 }]
240
-      // multiple_senders: [], // 多个主体时选择的客服成员结果
241 168
     }
242 169
   },
243 170
   computed: {
@@ -256,13 +183,16 @@ export default {
256 183
       this.isShowEditCon = true;
257 184
     }
258 185
 
259
-    if (this.createTempGroupId || String(this.createTempGroupId) === '0') {
186
+    if (this.createTempGroupId || String(this.createTempGroupId) === '0') { // 模板组id
260 187
       this.tempGroupId = this.createTempGroupId
261 188
       this.handleGetTemplateOptions()
262 189
     }
263 190
     if (this.createTemplateId) { // 根据指定模板创建
264 191
       this.onChangeTempId(this.createTemplateId)
265 192
     }
193
+    if (this.createGroupId) { // 指定推送规则分组
194
+      this.group_id = Number(this.createGroupId)
195
+    }
266 196
   },
267 197
   methods: {
268 198
     payChange (data) {//付费情况变化
@@ -288,35 +218,6 @@ export default {
288 218
           this.detailFromApi = Object.freeze(_lodash.cloneDeep(res.rst))
289 219
 
290 220
           // 数据回显
291
-
292
-          // this.operate_type = res.rst.operate_type ? res.rst.operate_type : 1
293
-          // this.is_operation = (res.rst.is_operation || res.rst.is_operation === 0) ? res.rst.is_operation : 1
294
-          // this.operator_group_id = res.rst.operator_group_id ? res.rst.operator_group_id : ''
295
-
296
-          // if (this.operate_type == 2 && this.is_operation == 0 && Array.isArray(JSON.parse(res.rst.multiple_senders))) {
297
-          //   const multiple_senders = JSON.parse(res.rst.multiple_senders)
298
-          //   this.multiple_senders = [...multiple_senders]
299
-          //   const arr = []
300
-          //   multiple_senders.forEach(corp => {
301
-          //     if (corp && corp.user_list && Array.isArray(corp.user_list)) {
302
-          //       corp.user_list.forEach(userId => {
303
-          //         arr.push({
304
-          //           user_id: userId,
305
-          //           corpid: corp.corpid,
306
-          //         })
307
-          //       })
308
-          //     }
309
-          //   })
310
-          //   this.afferent_multiple_senders = [...arr]
311
-          // }
312
-
313
-          // if (this.operate_type == 1) {
314
-          //   this.user_id_list = (res.rst.senders && !isJSON(res.rst.senders)) ? res.rst.senders.split(',') : [];
315
-          //   if (res.rst.senders && res.rst.senders.length > 0) {//有值代表部分员工
316
-          //     this.is_all = 0
317
-          //   }
318
-          // }
319
-
320 221
           this.gender = res.rst.gender ? res.rst.gender.split(',') : [];
321 222
           this.payInfo = {
322 223
             pay_status: res.rst.pay_status,
@@ -324,15 +225,6 @@ export default {
324 225
             pay_num_max: res.rst.pay_num_max,
325 226
           }
326 227
 
327
-          // this.afferent_tag_obj = {
328
-          //   tag_id_list: res.rst.tag_list ? res.rst.tag_list.split(',') : [],
329
-          //   tag: res.rst.tag_screen_type
330
-          // }
331
-          // this.tag_info = {
332
-          //   ..._lodash.cloneDeep(this.afferent_tag_obj),
333
-          //   tag_type: this.afferent_tag_obj.tag
334
-          // }
335
-
336 228
           if (res.rst.send_conf) {
337 229
             this.send_conf = res.rst.send_conf.map(s => ({
338 230
               ...s,
@@ -350,9 +242,6 @@ export default {
350 242
             }]
351 243
           }
352 244
 
353
-          // this.afferent_exclude_tag_obj.tag_id_list = res.rst.exclude_tag_list ? res.rst.exclude_tag_list.split(',') : [];
354
-          // this.exclude_tag_info = this.afferent_exclude_tag_obj
355
-
356 245
           this.name = res.rst.name;
357 246
           this.content = res.rst.content;
358 247
           this.attachments = res.rst.attachments && res.rst.attachments != '' && res.rst.attachments != 'null' ? JSON.parse(res.rst.attachments) : [];
@@ -379,24 +268,6 @@ export default {
379 268
     },
380 269
     //提交
381 270
     massMsg_set () {
382
-      // if (this.operate_type == 1) { // 单主体判空
383
-      //   if (this.is_all == 0 && (!this.user_id_list || this.user_id_list.length == 0)) {
384
-      //     this.$message.warning('请选择使用员工!')
385
-      //     return
386
-      //   }
387
-      // }
388
-
389
-      // if (this.operate_type == 2) { // 多主体判空
390
-      //   if (this.is_operation == 1 && !this.operator_group_id) {
391
-      //     this.$message.warning('请选择运营组')
392
-      //     return
393
-      //   }
394
-      //   if (this.is_operation == 0 && (!this.multiple_senders || !this.multiple_senders.length)) {
395
-      //     this.$message.warning('请选择成员')
396
-      //     return
397
-      //   }
398
-      // }
399
-
400 271
       const isHasNull = this.send_conf.some(conf => (!conf.natural_day || !conf.send_time))
401 272
       if (isHasNull) {
402 273
         this.$message.warning('请完善"添加客服时间"')
@@ -505,21 +376,8 @@ export default {
505 376
         pay_num_min: this.payInfo.pay_num_min || this.payInfo.pay_num_min == 0 ? Number(this.payInfo.pay_num_min) : '',
506 377
         pay_num_max: this.payInfo.pay_num_max || this.payInfo.pay_num_max == 0 ? Number(this.payInfo.pay_num_max) : '',
507 378
         group_id: this.group_id ? this.group_id : 0,
508
-
509
-        // is_all: this.is_all,
510
-        // senders: (this.operate_type == 1 && this.is_all == 0) ? this.user_id_list.join(',') : '',
511
-        // operate_type: this.operate_type,
512
-        // is_operation: this.operate_type == 1 ? 0 : this.is_operation, // 单主体模式 该字段传0
513
-        // operator_group_id: (this.operate_type == 2 && this.is_operation == 1) ? this.operator_group_id : '',
514
-        // multiple_senders: (this.operate_type == 2 && this.is_operation == 0 && this.multiple_senders.length) ? JSON.stringify(this.multiple_senders) : '',
515 379
       }
516 380
 
517
-      // if (this.operate_type == 1) { // 单主体支持标签 多主体不支持
518
-      //   params.tag_screen_type = this.tag_info && this.tag_info.tag_type ? this.tag_info.tag_type : 0
519
-      //   params.tag_list = this.tag_info && this.tag_info.tag_id_list ? this.tag_info.tag_id_list.join(',') : ''
520
-      //   params.exclude_tag_list = this.exclude_tag_info && this.exclude_tag_info.tag_id_list ? this.exclude_tag_info.tag_id_list.join(',') : ''
521
-      // }
522
-
523 381
       return JSON.parse(JSON.stringify(params))
524 382
     },
525 383
 

+ 1 - 0
project/src/components/smartPushV3/detailList.vue

@@ -76,6 +76,7 @@
76 76
         :title="detail_rule_id && !isCopy ? '编辑智能推送' : '新建智能推送'"
77 77
         :rule_id='detail_rule_id'
78 78
         :isCopy="isCopy"
79
+        :createGroupId="(!detail_rule_id && !isCopy) ? $route.query.group_id : ''"
79 80
         @close="detailClose"
80 81
       />
81 82
     </el-drawer>

+ 0 - 1
project/src/components/smartPushV3/pushGroupDialog.vue

@@ -134,7 +134,6 @@ export default {
134 134
           operator_group_id: (operate_type == 2 && is_operation == 1) ? operator_group_id : '',
135 135
           multiple_senders: (operate_type == 2 && is_operation == 0 && multiple_senders.length) ? JSON.stringify(multiple_senders) : '',
136 136
         }
137
-        console.log('params => ', JSON.parse(JSON.stringify(params)))
138 137
         this.loading = true
139 138
         const { data: res = {} } = await this.$axios.post(url, params)
140 139
         if (res && res.errno == 0) {