Browse Source

feat: 邀请入群配置 - 客户补拉

zhengxy 11 months ago
parent
commit
1193e5910d
1 changed files with 103 additions and 16 deletions
  1. 103 16
      project/src/components/manage/InviteIntoGroup/createData.vue

+ 103 - 16
project/src/components/manage/InviteIntoGroup/createData.vue

@@ -46,9 +46,8 @@
46 46
         </label>
47 47
         <div>
48 48
           <div class="flex" style="justify-content: start;">
49
-            <el-radio v-model="customer_filter" :disabled="!editFlag || (invite_type == 2)" :label="0">全部客户</el-radio><!-- 选择“定时邀请”就不能选择“全部客户” -->
49
+            <el-radio v-model="customer_filter" :disabled="!editFlag" :label="0">全部客户</el-radio>
50 50
             <el-radio v-model="customer_filter" :disabled="!editFlag" :label="1">筛选客户</el-radio>
51
-            <p v-if="invite_type == 2" style="font-size:13px;line-height:30px;color:#f9a527;margin-left:30px;margin-top:-2px;">“定时邀请”类型时不支持选择“全部客户”</p>
52 51
           </div>
53 52
           <div class="screeningCustomers" v-show="customer_filter == 1">
54 53
             <div class="screeningItem">
@@ -147,19 +146,61 @@
147 146
           </el-radio>
148 147
         </el-radio-group>
149 148
       </div>
149
+
150
+      <!-- S 客户补拉(拉群模式为“当前客服群聊”时可编辑) -->
151
+      <div v-show="main_msg_data.owner_type == 1" class="regulations" style="align-items: center">
152
+        <label>
153
+          客户补拉
154
+        </label>
155
+        <div class="limitBox">
156
+          <el-switch
157
+            v-model="supplementary_invite"
158
+            active-color="#00B38A"
159
+            inactive-color="#ddd"
160
+            :active-value="1"
161
+            :inactive-value="0"
162
+            :disabled="!editFlag"
163
+            @change="onChangeSupplementaryInvite"
164
+          />
165
+        </div>
166
+      </div>
167
+      <div v-show="supplementary_invite == 1" class="regulations">
168
+        <label>
169
+          <em>*</em>
170
+          补拉入群周期
171
+        </label>
172
+        <el-input placeholder="请输入补拉周期" :disabled="!editFlag" style="width:300px" v-model.trim="supplementary_invite_cycle" clearable size="small" @input="onInputSupplementaryInviteCycle">
173
+          <template slot="append">天</template>
174
+        </el-input>
175
+      </div>
176
+      <div class="regulations" v-show="supplementary_invite == 1">
177
+        <label><em>*</em>补拉时间点</label>
178
+        <div class="send-time-item">
179
+          <div class="timeNums-wrap">
180
+            <div class="timeNums" v-for="(item, idx) in supplementary_invite_time" :key="idx">
181
+              <el-time-picker v-model="supplementary_invite_time[idx]" size="mini" placeholder="请选择" value-format="HH:mm" format="HH:mm" :clearable="false" />
182
+              <i v-if="idx !== 0" class="el-icon-error" @click="onClickDelSupplementaryInviteTime(idx)" />
183
+            </div>
184
+          </div>
185
+          <span class="add-btn" @click="onClickAddSupplementaryInviteTime"><i class="el-icon-circle-plus-outline" />新增时间点</span>
186
+        </div>
187
+      </div>
188
+      <!-- E 客户补拉 -->
189
+
190
+
150 191
       <!-- 选择群聊 -->
151 192
       <div class="regulations">
152 193
         <label><em>*</em>选择群聊:</label>
153 194
         <chatGroupOptions ref="chatGroupOptionsMain" width="300px" :isHasRoomId="true" :isOnJobUser="true" :chatListResult="main_msg_data.chat_group_config" @change="onChangeGlobalChatGroup" />
154 195
       </div>
155 196
       <!-- 进群方式 -->
156
-      <div class="regulations" style="margin-top: 20px;">
197
+      <!-- <div class="regulations" style="margin-top: 20px;">
157 198
         <label>进群方式:</label>
158 199
         <el-radio-group v-model="main_msg_data.join_type">
159 200
           <el-radio :label="1">顺序进群</el-radio>
160 201
           <el-radio :label="2">随机进群</el-radio>
161 202
         </el-radio-group>
162
-      </div>
203
+      </div> -->
163 204
       <!-- 群管理 -->
164 205
       <div class="regulations" style="align-items: center">
165 206
         <label>渠道群管理:</label>
@@ -240,10 +281,10 @@
240 281
       <div class="regulations">
241 282
         <label><em>*</em>邀请类型</label>
242 283
         <div class="flex">
243
-          <el-radio v-model="invite_type" :disabled="!editFlag" :label="1">立即邀请</el-radio>
244
-          <el-radio v-model="invite_type" :disabled="!editFlag || (customer_filter == 0)" :label="2">定时邀请</el-radio>
245
-          <p v-show="customer_filter == 0" style="font-size:13px;line-height:30px;color:#f9a527;margin-left:30px;margin-top:-2px;">选择“全部客户”时不支持“定时邀请”类型</p>
284
+          <el-radio v-model="invite_type" :disabled="!editFlag || (supplementary_invite == 1)" :label="1">立即邀请</el-radio><!-- “客户补拉”开启时 只能选择“定时邀请” -->
285
+          <el-radio v-model="invite_type" :disabled="!editFlag" :label="2">定时邀请</el-radio>
246 286
         </div>
287
+        <p v-show="supplementary_invite == 1" style="font-size:13px;line-height:30px;color:#f9a527;margin-left:10px">*客户补拉仅支持“定时邀请”类型</p>
247 288
       </div>
248 289
       <div class="regulations" v-show="invite_type == 2">
249 290
         <label><em>*</em>邀请时间点</label>
@@ -306,7 +347,7 @@ export default {
306 347
       user_id_list: [],
307 348
       main_msg_data: {
308 349
         owner_type: 2, // 拉群模式 2其他客服群聊 1当前客服群聊
309
-        join_type: 1, // 进群方式 1:顺序进群 2:随机进群
350
+        // join_type: 1, // 进群方式 1:顺序进群 2:随机进群
310 351
         chat_group_config: [],
311 352
         is_limit:0
312 353
       },
@@ -324,6 +365,10 @@ export default {
324 365
       continuously_attract_groups: 0, // 持续邀请客户入群
325 366
       upper_limit: '', // 单次创建群聊数量上限
326 367
 
368
+      supplementary_invite: 0, // 客户补拉
369
+      supplementary_invite_cycle: '', // 补拉入群周期
370
+      supplementary_invite_time: [''], // 补拉入群时间点
371
+
327 372
       add_time_later: '', // 快捷筛选
328 373
       invite_type: 1, // 邀请类型
329 374
       invite_time_list: [''], // 邀请时间点
@@ -499,7 +544,7 @@ export default {
499 544
           })
500 545
           this.main_msg_data.is_limit = 1
501 546
           //进群方式
502
-          this.main_msg_data.join_type = res.rst.join_type
547
+          // this.main_msg_data.join_type = res.rst.join_type
503 548
           //拉群模式
504 549
           this.main_msg_data.owner_type = res.rst.owner_type
505 550
 
@@ -513,6 +558,11 @@ export default {
513 558
             this.isDisabledAll = false
514 559
           }
515 560
 
561
+          // 客户补拉
562
+          this.supplementary_invite = res.rst.supplementary_invite || 0
563
+          this.supplementary_invite_cycle = res.rst.supplementary_invite_cycle || ''
564
+          this.supplementary_invite_time = (res.rst.supplementary_invite_time && isJSON(res.rst.supplementary_invite_time)) ? JSON.parse(res.rst.supplementary_invite_time) : ['']
565
+
516 566
           //表格排序
517 567
           this.$nextTick(() => {
518 568
             if(this.main_msg_data.is_limit){
@@ -562,6 +612,19 @@ export default {
562 612
         return
563 613
       }
564 614
 
615
+      if (this.main_msg_data.owner_type == 1 && this.supplementary_invite == 1) { // 客户补拉开启判空
616
+        if (!this.supplementary_invite_cycle) {
617
+          this.$message.warning('请输入补拉入群周期(不能为0)')
618
+          return
619
+        }
620
+
621
+        const isEmpty = this.supplementary_invite_time.some(i => !i)
622
+        if (isEmpty) {
623
+          this.$message.warning('请完善补拉时间点')
624
+          return
625
+        }
626
+      }
627
+
565 628
       if (!this.main_msg_data.chat_group_config || this.main_msg_data.chat_group_config.length == 0) {
566 629
         this.$message.warning('请选择群聊!')
567 630
         return
@@ -575,11 +638,6 @@ export default {
575 638
         }
576 639
       }
577 640
 
578
-      if (this.customer_filter == 0 && this.invite_type == 2) {
579
-        this.$message.warning('选择“定时邀请”时不支持选择“全部客户”')
580
-        return
581
-      }
582
-
583 641
       if (this.main_msg_data.is_limit == 1) {
584 642
         const isEmpty = this.main_msg_data.chat_group_config.some(config => {
585 643
           return !config.user_limit || config.user_limit == 0
@@ -597,7 +655,7 @@ export default {
597 655
         users:this.user_id_list&&this.user_id_list.length>0 ? this.user_id_list.join(',') : '',
598 656
         invite_config:JSON.stringify(this.main_msg_data.chat_group_config),
599 657
         owner_type:this.main_msg_data.owner_type,
600
-        join_type:this.main_msg_data.join_type,
658
+        // join_type:this.main_msg_data.join_type,
601 659
         customer_filter: this.customer_filter,
602 660
         // S 自定义筛选参数
603 661
         gender: this.gender && this.gender.length ? this.gender.join(',') : '',
@@ -615,6 +673,14 @@ export default {
615 673
         invite_time: this.invite_type == 2 ? JSON.stringify(this.invite_time_list) : '',
616 674
       }
617 675
 
676
+      // S 客户补拉参数
677
+      if (this.main_msg_data.owner_type == 1) {
678
+        params.supplementary_invite = this.supplementary_invite
679
+        params.supplementary_invite_cycle = this.supplementary_invite == 1 ? this.supplementary_invite_cycle : ''
680
+        params.supplementary_invite_time = this.supplementary_invite == 1 ? JSON.stringify(this.supplementary_invite_time) : ''
681
+      }
682
+      // E 客户补拉参数
683
+
618 684
       if (this.isEdit) {
619 685
         params.rule_id = this.rule_id
620 686
       }
@@ -652,6 +718,15 @@ export default {
652 718
       this.invite_time_list.splice(idx, 1)
653 719
     },
654 720
 
721
+    // 监听点击新增时间点
722
+    onClickAddSupplementaryInviteTime() {
723
+      this.supplementary_invite_time.push('')
724
+    },
725
+    // 监听点击删除时间点
726
+    onClickDelSupplementaryInviteTime(idx) {
727
+      this.supplementary_invite_time.splice(idx, 1)
728
+    },
729
+
655 730
     changeTime(time) {
656 731
       if (!time || time && time.length == 0) {
657 732
         this.add_times = [];
@@ -693,6 +768,18 @@ export default {
693 768
       this.upper_limit = getNot0IntegerNumber(inputVal)
694 769
     },
695 770
 
771
+    onInputSupplementaryInviteCycle(inputVal) {
772
+      // this.supplementary_invite_cycle = getIntegerNumber(inputVal)
773
+      this.supplementary_invite_cycle = getNot0IntegerNumber(inputVal)
774
+    },
775
+
776
+    // 监听补拉开关
777
+    onChangeSupplementaryInvite(val) {
778
+      if (val == 1) { // 客户补拉仅支持“定时邀请”类型
779
+        this.invite_type = 2
780
+      }
781
+    },
782
+
696 783
     onClickDisabled() {
697 784
       return false
698 785
     },
@@ -886,7 +973,7 @@ export default {
886 973
     flex-shrink: 0;
887 974
   }
888 975
   .el-input {
889
-    margin: 0 6px;
976
+    margin: 0 6px 0 0;
890 977
     width: 80px;
891 978
     font-size: 13px;
892 979
   }