Browse Source

feat: 邀请入群配置 - 持续任务

zhengxy 11 months ago
parent
commit
67bf915911
1 changed files with 170 additions and 12 deletions
  1. 170 12
      project/src/components/manage/InviteIntoGroup/createData.vue

+ 170 - 12
project/src/components/manage/InviteIntoGroup/createData.vue

@@ -8,13 +8,12 @@
8 8
         <i class="el-icon-close pointer" @click="$emit('close')" />
9 9
       </div>
10 10
     </div>
11
-    <div v-if="!loading" class="bg-ffffff" style="padding: 15px 30px;">
11
+
12
+    <div v-if="!loading" class="bg-ffffff content-wrap" style="padding: 15px 30px;">
12 13
       <div class="regulations">
13 14
         <label><em>*</em>标题</label>
14 15
         <el-input placeholder="配置标题" :disabled="!editFlag" style="width:300px" v-model.trim="name" clearable size="small" />
15 16
       </div>
16
-
17
-
18 17
       <!-- S 使用员工 - 单个企微主体 模式 -->
19 18
       <div class="regulations">
20 19
         <label><em>*</em>客服:</label>
@@ -27,8 +26,6 @@
27 26
         </div>
28 27
       </div>
29 28
       <!-- S 使用员工 - -->
30
-
31
-
32 29
       <!-- S 选择客户 -->
33 30
       <div class="regulations">
34 31
         <label><em>*</em>选择客户</label>
@@ -64,11 +61,47 @@
64 61
                 <datePicker title="" width="355px" :disabled="!editFlag" :timeFlag="true" :afferent_time="add_times" :pickerOptions="{}" @changeTime="changeTime" :defaultTime="['00:00:00', '23:59:59']" />
65 62
               </div>
66 63
             </div>
64
+            <div class="screeningItem">
65
+              <label>性别:</label>
66
+              <el-checkbox-group class="checkboxGroup" v-model="gender" :disabled="!editFlag">
67
+                <el-checkbox label="1">男性</el-checkbox>
68
+                <el-checkbox label="2">女性</el-checkbox>
69
+                <el-checkbox label="0">未知性别</el-checkbox>
70
+              </el-checkbox-group>
71
+            </div>
72
+            <div class="screeningItem">
73
+              <label>付费情况:</label>
74
+              <screenPay title="" width="355px" :disabled="!editFlag" @payChange="payChange" :afferent_obj='payInfo' style="margin:0" />
75
+            </div>
76
+            <div class="screeningItem">
77
+              <label>标签:</label>
78
+              <enterpriseTag title="" width="355px" :disabled="!editFlag" :afferent_obj='afferent_tag_obj' @tagDefine="tagDefine" style="margin:0" />
79
+            </div>
67 80
           </div>
68 81
         </div>
69 82
       </div>
70 83
       <!-- E 选择客户 -->
71 84
 
85
+      <!-- S 持续邀请入群 -->
86
+      <div class="regulations" style="align-items: center">
87
+        <label>持续邀请入群:</label>
88
+        <div class="limitBox">
89
+          <el-switch
90
+            v-model="continuously_attract_groups"
91
+            active-color="#00B38A"
92
+            inactive-color="#ddd"
93
+            :active-value="1"
94
+            :inactive-value="0"
95
+            :disabled="!editFlag"
96
+          />
97
+        </div>
98
+        <p style="font-size:13px;line-height:30px;color:#f9a527;margin-left:10px">*持续邀请入群任务仅可新增不可编辑</p>
99
+      </div>
100
+      <div v-show="continuously_attract_groups == 1" class="regulations">
101
+        <label><em>*</em>单次创建群聊上限</label>
102
+        <el-input placeholder="请输入创建群聊数量上限" :disabled="!editFlag" style="width:300px" v-model.trim="upper_limit" clearable size="small" @input="onInputUpperLimit" />
103
+      </div>
104
+      <!-- E 持续邀请入群 -->
72 105
 
73 106
       <!-- 群聊类型 -->
74 107
       <div class="regulations" style="margin-top: 20px;">
@@ -145,7 +178,7 @@
145 178
       </div>
146 179
       <!-- E 群管理表格 -->
147 180
 
148
-      <!-- 群公告 announcement -->
181
+      <!-- S 群公告 -->
149 182
       <div class="regulations">
150 183
         <label>群公告</label>
151 184
         <div class="flex">
@@ -161,6 +194,7 @@
161 194
           />
162 195
         </div>
163 196
       </div>
197
+      <!-- E 群公告 -->
164 198
 
165 199
       <div class="regulations">
166 200
         <label><em>*</em>邀请类型</label>
@@ -187,24 +221,39 @@
187 221
       <div class="button_box">
188 222
         <button class="button" v-if="editFlag" @click="massMsg_set">确定</button>
189 223
       </div>
224
+
225
+      <div v-if="false" class="disabled-wrap" @click.stop="onClickDisabled" />
190 226
     </div>
191 227
   </div>
192 228
 </template>
193 229
 <script>
194 230
 import selfCustomerservice from '@/components/assembly/screen/customerService.vue'
231
+import chatGroupOptions from './chatGroupOptions.vue'
232
+import datePicker from '@/components/assembly/screen/datePicker.vue'
233
+import screenPay from '@/components/assembly/screen/pay.vue'
234
+import enterpriseTag from '@/components/assembly/screen/enterpriseTag.vue'
195 235
 import _lodash from 'lodash'
196 236
 import Sortable from 'sortablejs'
197 237
 import { getIntegerNumber, getNot0IntegerNumber, isJSON } from '@/assets/js/common'
198
-import chatGroupOptions from './chatGroupOptions.vue'
199
-import datePicker from '@/components/assembly/screen/datePicker.vue'
200 238
 
201 239
 export default {
202 240
   components: {
203 241
     selfCustomerservice,
204 242
     chatGroupOptions,
205 243
     datePicker,
244
+    screenPay,
245
+    enterpriseTag,
246
+  },
247
+  props: {
248
+    title: {
249
+      type: String,
250
+      default: () => '详情'
251
+    },
252
+    rule_id: {
253
+      type: String | Number,
254
+      default: () => ''
255
+    },
206 256
   },
207
-  props: ['title', 'rule_id'],
208 257
   data () {
209 258
     return {
210 259
       loading: true,
@@ -222,17 +271,34 @@ export default {
222 271
       deleteChart: {},
223 272
 
224 273
       customer_filter: 0, // 筛选
274
+      gender: [],
275
+      payInfo: {},
276
+      afferent_tag_obj: {
277
+        tag_id_list: [],
278
+        tag: 1
279
+      },
280
+      tag_info: {},//标签
281
+
282
+      continuously_attract_groups: 0, // 持续邀请客户入群
283
+      upper_limit: '', // 单次创建群聊数量上限
284
+
225 285
       add_time_later: '', // 快捷筛选
226 286
       invite_type: 1, // 邀请类型
227 287
       invite_time_list: [''], // 邀请时间点
228 288
 
229 289
       filter_type: 1, // 筛选用户方式 1客户添加N小时后拉群 2按指定添加起止时间筛选
230 290
       add_times: [],
291
+
231 292
     }
232 293
   },
294
+  computed: {
295
+    isEdit() {
296
+      return !!this.rule_id
297
+    },
298
+  },
233 299
   created () {
234 300
     this.$nextTick(()=>{
235
-      if (this.rule_id) {//详情
301
+      if (this.isEdit) {//详情
236 302
         this.detail()
237 303
       } else {
238 304
         this.loading = false;
@@ -345,6 +411,7 @@ export default {
345 411
 
346 412
           //标题
347 413
           this.name = res.rst.title;
414
+
348 415
           //群公告
349 416
           this.announcement = res.rst.announcement;
350 417
           //客服
@@ -355,6 +422,22 @@ export default {
355 422
 
356 423
           // 筛选客户
357 424
           this.customer_filter = res.rst.customer_filter || 0
425
+          this.gender = res.rst.gender ? res.rst.gender.split(',') : [];
426
+          this.payInfo = {
427
+            pay_status: res.rst.pay_status,
428
+            pay_num_min: res.rst.pay_num_min,
429
+            pay_num_max: res.rst.pay_num_max,
430
+          }
431
+          this.afferent_tag_obj = {
432
+            tag_id_list: res.rst.tag_list ? res.rst.tag_list.split(',') : [],
433
+            tag: res.rst.tag_screen_type
434
+          }
435
+          this.tag_info = {
436
+            ..._lodash.cloneDeep(this.afferent_tag_obj),
437
+            tag_type: this.afferent_tag_obj.tag
438
+          }
439
+
440
+
358 441
           this.filter_type = res.rst.filter_type || 1
359 442
           this.add_time_later = (res.rst.customer_filter && res.rst.filter_type == 1) ? res.rst.add_time_later : ''
360 443
           this.add_times = (res.rst.customer_filter && res.rst.filter_type == 2) ? [res.rst.add_time_st || '', res.rst.add_time_et || ''] : []
@@ -367,6 +450,9 @@ export default {
367 450
             this.invite_time_list = ['']
368 451
           }
369 452
 
453
+          this.continuously_attract_groups = res.rst.continuously_attract_groups;
454
+          this.upper_limit = res.rst.continuously_attract_groups == 1 ? res.rst.upper_limit : ''
455
+
370 456
           //群聊
371 457
           this.main_msg_data.chat_group_config = res.rst.invite_config
372 458
           this.main_msg_data.chat_group_config.forEach(item=>{
@@ -416,6 +502,12 @@ export default {
416 502
         return
417 503
       }
418 504
 
505
+      if (this.continuously_attract_groups == 1 && !this.upper_limit) {
506
+        this.$message.warning('请输入单次创建群聊上限(不能为0)')
507
+        return
508
+      }
509
+
510
+
419 511
       if (!this.main_msg_data.owner_type) {
420 512
         this.$message.warning('请选择群聊类型')
421 513
         return
@@ -448,8 +540,9 @@ export default {
448 540
 
449 541
       this.$loading(this.$loadingConfig)
450 542
       let params = {
451
-        rule_id: this.rule_id ? this.rule_id : '',
452 543
         title: this.name,
544
+        continuously_attract_groups: this.continuously_attract_groups,
545
+        upper_limit: this.continuously_attract_groups == 1 ? this.upper_limit : 0,
453 546
         announcement: this.announcement,
454 547
         is_for_all:this.is_for_all,
455 548
         users:this.user_id_list&&this.user_id_list.length>0 ? this.user_id_list.join(',') : '',
@@ -458,6 +551,12 @@ export default {
458 551
         join_type:this.main_msg_data.join_type,
459 552
         customer_filter: this.customer_filter,
460 553
         // S 自定义筛选参数
554
+        gender: this.gender && this.gender.length ? this.gender.join(',') : '',
555
+        pay_status: this.payInfo.pay_status || this.payInfo.pay_status == 0 ? this.payInfo.pay_status : '',
556
+        pay_num_min: this.payInfo.pay_num_min || this.payInfo.pay_num_min == 0 ? this.payInfo.pay_num_min : '',
557
+        pay_num_max: this.payInfo.pay_num_max || this.payInfo.pay_num_max == 0 ? this.payInfo.pay_num_max : '',
558
+        tag_screen_type: this.tag_info && this.tag_info.tag_type ? this.tag_info.tag_type : 0,
559
+        tag_list: this.tag_info && this.tag_info.tag_id_list ? this.tag_info.tag_id_list.join(',') : '',
461 560
         filter_type: this.customer_filter == 1 ? this.filter_type : '',
462 561
         add_time_later: (this.customer_filter == 1 && this.filter_type == 1) ? this.add_time_later : '',
463 562
         add_time_st: (this.customer_filter == 1 && this.filter_type == 2) ? this.add_times[0] : '',
@@ -466,11 +565,16 @@ export default {
466 565
         invite_type: this.invite_type,
467 566
         invite_time: this.invite_type == 2 ? JSON.stringify(this.invite_time_list) : '',
468 567
       }
568
+
569
+      if (this.isEdit) {
570
+        params.rule_id = this.rule_id
571
+      }
572
+
469 573
       this.$axios.post(this.URL.BASEURL + this.URL.inviteRule_add, params).then((res) => {
470 574
         var res = res.data
471 575
         this.$loading(this.$loadingConfig).close()
472 576
         if (res && res.errno == 0) {
473
-          if (!this.rule_id) {//复制或者新建
577
+          if (!this.isEdit) {//复制或者新建
474 578
             this.$emit('close', 'update_new')
475 579
           } else {//编辑
476 580
             this.$emit('close', 'update')
@@ -506,6 +610,43 @@ export default {
506 610
         this.add_times = time;
507 611
       }
508 612
     },
613
+
614
+    payChange (data) {//付费情况变化
615
+      this.payInfo = {
616
+        pay_status: data.radio,
617
+        pay_num_min: data.minValue,
618
+        pay_num_max: data.maxValue,
619
+      }
620
+    },
621
+    tagDefine (data) {//标签选择回调
622
+      if (data.tag == 1 || data.tag == 2) {
623
+        if (data.tag_id_list && data.tag_id_list.length != 0) {
624
+          this.tag_info = {
625
+            tag_id_list: data.tag_id_list,
626
+            tag_type: data.tag
627
+          }
628
+        } else {
629
+          this.tag_info = {
630
+            tag_id_list: [],
631
+            tag_type: 0
632
+          }
633
+        }
634
+      } else {
635
+        this.tag_info = {
636
+          tag_id_list: [],
637
+          tag_type: data.tag
638
+        }
639
+      }
640
+    },
641
+
642
+    onInputUpperLimit(inputVal) {
643
+      // this.upper_limit = getIntegerNumber(inputVal)
644
+      this.upper_limit = getNot0IntegerNumber(inputVal)
645
+    },
646
+
647
+    onClickDisabled() {
648
+      return false
649
+    },
509 650
   }
510 651
 }
511 652
 </script>
@@ -737,4 +878,21 @@ export default {
737 878
 .ml-80 {
738 879
   margin-left: 80px;
739 880
 }
881
+.createMassMsg .regulations label {
882
+  width: 125px;
883
+}
884
+
885
+.content-wrap {
886
+  position: relative;
887
+  .disabled-wrap {
888
+    position: absolute;
889
+    top: 0;
890
+    bottom: 0;
891
+    left: 0;
892
+    right: 0;
893
+    background-color: rgba(0, 0, 0, 0.45);
894
+    cursor: not-allowed;
895
+    z-index: 999;
896
+  }
897
+}
740 898
 </style>