Browse Source

feat: 智能推送 - 规则配置"添加客服时间段"

zhengxy 1 year ago
parent
commit
c57c17d21a
1 changed files with 64 additions and 7 deletions
  1. 64 7
      project/src/components/smartPushV2/createMassMsg.vue

+ 64 - 7
project/src/components/smartPushV2/createMassMsg.vue

@@ -45,6 +45,9 @@
45 45
               <div v-for="(conf, idx) in send_conf" :key="idx" class="send-time-item">
46 46
                 <el-input v-model.trim="conf.natural_day" size="mini" maxlength="3" clearable @input="onInputDays($event, idx)" @change="onChangeDays($event, idx)" />
47 47
                 <span class="text">天&nbsp;&nbsp;</span>
48
+                <!-- S 天数为1时 设置添加时间段 -->
49
+                <el-time-picker v-if="conf.natural_day == 1" v-model="conf.add_time" is-range size="mini" placeholder="客户添加起止时间" start-placeholder="起始时间" end-placeholder="截止时间" value-format="HH:mm:ss" :clearable="false" class="add-time" @change="onChangeAddTime($event, idx)" />
50
+                <!-- E 天数为1时 设置添加时间段 -->
48 51
                 <span class="text">当天</span>
49 52
                 <div class="timeNums-wrap">
50 53
                   <div class="timeNums">
@@ -127,6 +130,9 @@ export default {
127 130
         {
128 131
           natural_day: '',
129 132
           send_time: '',
133
+          add_time: null,
134
+          add_start_time: '',
135
+          add_end_time: '',
130 136
         }
131 137
       ],
132 138
       afferent_exclude_tag_obj: { // 规则配置 - 排除客户 标签
@@ -190,7 +196,22 @@ export default {
190 196
             tag_type: this.afferent_tag_obj.tag
191 197
           }
192 198
 
193
-          this.send_conf = res.rst.send_conf ? res.rst.send_conf : [{natural_day: '',send_time: ''}]
199
+          if (res.rst.send_conf) {
200
+            this.send_conf = res.rst.send_conf.map(s => ({
201
+              ...s,
202
+              add_start_time: s.add_start_time || '',
203
+              add_end_time: s.add_end_time || '',
204
+              add_time: (s.add_start_time && s.add_end_time) ? [s.add_start_time, s.add_end_time] : null,
205
+            }))
206
+          } else {
207
+            this.send_conf = [{
208
+              natural_day: '',
209
+              send_time: '',
210
+              add_start_time: '',
211
+              add_end_time: '',
212
+              add_time: null,
213
+            }]
214
+          }
194 215
 
195 216
           this.afferent_exclude_tag_obj.tag_id_list = res.rst.exclude_tag_list ? res.rst.exclude_tag_list.split(',') : [];
196 217
           this.exclude_tag_info = this.afferent_exclude_tag_obj
@@ -227,6 +248,18 @@ export default {
227 248
         return
228 249
       }
229 250
 
251
+      const isHasNullAddTime = this.send_conf.some(conf => {
252
+        if (conf.natural_day == 1 && (!conf.add_time || !conf.add_time.length)) {
253
+          return true
254
+        } else {
255
+          return false
256
+        }
257
+      })
258
+      if (isHasNullAddTime) {
259
+        this.$message.warning('请选择客户添加起止时间')
260
+        return
261
+      }
262
+
230 263
       if (this.name == '') {
231 264
         this.$message.warning('请输入标题!')
232 265
         return
@@ -259,7 +292,6 @@ export default {
259 292
 
260 293
       if (this.isCopy) {
261 294
         const isSameParams = this.handleGetIsSameParams(params)
262
-        console.log('isSameParams => ', isSameParams)
263 295
         if (isSameParams) {
264 296
           this.$message.warning('推送规则及内容重复!')
265 297
           return
@@ -268,6 +300,9 @@ export default {
268 300
         params.send_conf = JSON.stringify(this.send_conf.map(s => ({
269 301
           natural_day: s.natural_day,
270 302
           send_time: s.send_time,
303
+          add_time: s.add_time,
304
+          add_start_time: s.add_start_time,
305
+          add_end_time: s.add_end_time,
271 306
         })))
272 307
       }
273 308
 
@@ -287,9 +322,6 @@ export default {
287 322
       } else {
288 323
         params.rule_id = ''
289 324
       }
290
-
291
-      console.log('params => ', JSON.parse(JSON.stringify(params)))
292
-
293 325
       this.$loading(this.$loadingConfig)
294 326
       this.$axios.post(this.URL.BASEURL + this.URL.smartPushV2_set, params).then((res) => {
295 327
         var res = res.data
@@ -331,7 +363,6 @@ export default {
331 363
         pay_num_max: this.payInfo.pay_num_max || this.payInfo.pay_num_max == 0 ? Number(this.payInfo.pay_num_max) : '',
332 364
       }
333 365
       this.oldParams = JSON.parse(JSON.stringify(oldParams))
334
-      console.log('oldParams => ', this.oldParams)
335 366
     },
336 367
     handleGetIsSameParams(newParams) {
337 368
       let isSameParams = true
@@ -447,6 +478,15 @@ export default {
447 478
         this.$message.warning('天数不能为0')
448 479
       }
449 480
     },
481
+    onChangeAddTime(val, idx) {
482
+      if (val && val.length) {
483
+        this.send_conf[idx].add_start_time = val[0]
484
+        this.send_conf[idx].add_end_time = val[1]
485
+      } else {
486
+        this.send_conf[idx].add_start_time = ''
487
+        this.send_conf[idx].add_end_time = ''
488
+      }
489
+    },
450 490
     // 监听点击删除时间配置
451 491
     onClickDelConf(idx) {
452 492
       this.send_conf.splice(idx, 1)
@@ -456,6 +496,9 @@ export default {
456 496
       this.send_conf.push({
457 497
         natural_day: '',
458 498
         send_time: '',
499
+        add_start_time: '',
500
+        add_end_time: '',
501
+        add_time: null,
459 502
       })
460 503
     },
461 504
   }
@@ -512,6 +555,20 @@ export default {
512 555
 
513 556
       }
514 557
     }
558
+    /deep/ .add-time {
559
+      margin-right: 10px;
560
+      padding: 3px;
561
+      width: 140px;
562
+      justify-content: center;
563
+      .el-range__close-icon,
564
+      .el-icon-time {
565
+        width: 3px;
566
+        opacity: 0;
567
+      }
568
+      .el-range-separator {
569
+        padding: 0 10px 0 2px;
570
+      }
571
+    }
515 572
   }
516 573
 }
517 574
 
@@ -560,7 +617,7 @@ export default {
560 617
 }
561 618
 
562 619
 .screeningCustomers {
563
-  width: 659px;
620
+  width: 670px;
564 621
   background: #fafafa;
565 622
   border: 1px solid #e9e9e9;
566 623
   padding: 15px 10px;