Browse Source

feat: 客户群群发 - 按群聊发送

zhengxy 1 year ago
parent
commit
533cb32942

+ 43 - 37
project/src/components/customOperate/chatGroup/createMsg.vue

@@ -31,35 +31,34 @@
31 31
       <div class="regulations">
32 32
         <label><em>*</em>选择模式:</label>
33 33
         <div style="display:flex">
34
-          <el-radio :disabled="!editFlag" v-model="operate_type" :label="1">单个企微主体</el-radio>
35
-          <el-radio :disabled="!editFlag" v-model="operate_type" :label="2">多个企微主体</el-radio>
34
+          <el-radio :disabled="!editFlag" v-model="operate_type" :label="1" @input="onChangeOperateType">单个企微主体</el-radio>
35
+          <el-radio :disabled="!editFlag" v-model="operate_type" :label="2" @input="onChangeOperateType">多个企微主体</el-radio>
36 36
         </div>
37 37
       </div>
38 38
       <!-- E 选择模式 -->
39 39
 
40
-
41
-      <!-- 新增"群发方式" 2023.09.08 删除群发方式 不再支持选择群聊 只支持选择群主 -->
42
-      <!-- <div class="regulations">
40
+      <!-- 新增"群发方式" 单企微模式时可选“群发方式” -->
41
+      <div v-show="operate_type == 1" class="regulations">
43 42
         <label><em>*</em>群发方式:</label>
44 43
         <div>
45 44
           <div style="display:flex">
46
-            <el-radio v-model="send_mode" :label="2" :disabled="!editFlag">群聊</el-radio>
47
-            <el-radio v-model="send_mode" :label="1" :disabled="!editFlag">群主</el-radio>
45
+            <el-radio v-model="send_mode" :label="1" :disabled="!editFlag">按群主发送</el-radio>
46
+            <el-radio v-model="send_mode" :label="2" :disabled="!editFlag">按群聊发送</el-radio>
48 47
           </div>
49 48
         </div>
50
-      </div> -->
49
+      </div>
51 50
 
52
-      <!-- S 使用群聊 2023.09.08 删除群发方式 不再支持选择群聊 只支持选择群主 -->
53
-      <!-- <div v-if="send_mode == 2" class="regulations">
51
+      <!-- S 使用群聊 仅单企微模式支持按群聊 -->
52
+      <div v-if="operate_type == 1 && send_mode == 2" class="regulations">
54 53
         <label><em>*</em>使用群聊:</label>
55 54
         <div>
56
-          <div style="display:flex">
55
+          <!-- <div style="display:flex">
57 56
             <el-radio v-model="isAllGroupChat" :label="1" :disabled="!editFlag">全部群聊</el-radio>
58 57
             <el-radio v-model="isAllGroupChat" :label="0" :disabled="!editFlag">部分群聊</el-radio>
59
-          </div>
60
-          <chatGroupOptions v-if="isAllGroupChat == 0" ref="chatGroupOptions" style="margin-top: 10;" width="300px" :chatListResult="chat_groups" @change="onChangeChatGroup" />
58
+          </div> -->
59
+          <chatGroupOptions ref="chatGroupOptions" style="margin-top: 0;" width="300px" :chatListResult="chat_groups" @change="onChangeChatGroup" />
61 60
         </div>
62
-      </div> -->
61
+      </div>
63 62
       <!-- E 使用群聊 -->
64 63
 
65 64
       <!-- S 使用群主 单个企微主体 模式 -->
@@ -146,7 +145,7 @@
146 145
       </div>
147 146
       <!-- E 群发方式 - 群主 -->
148 147
       <!-- S 群发方式 - 群聊 -->
149
-      <div v-if="send_mode == 2" class="regulations regulations2">
148
+      <!-- <div v-if="send_mode == 2" class="regulations regulations2">
150 149
         <label></label>
151 150
         <div class="operationProcess">
152 151
           <div class="process-title">
@@ -158,7 +157,7 @@
158 157
           <p class="process-hint">2、员工点击【消息详情】,打开待发送的群发消息,选择好群聊之后,可一键将消息发送给客户</p>
159 158
           <img v-if="processFlag" src="@/assets/img/chatGroupImg-2.jpg" class="img" alt="">
160 159
         </div>
161
-      </div>
160
+      </div> -->
162 161
       <!-- E 群发方式 - 群聊 -->
163 162
       <div class="button_box">
164 163
         <button class="button" v-if="editFlag" @click="massMsg_set">通知成员发送</button>
@@ -232,8 +231,8 @@ export default {
232 231
       customerMatchCountLoading: false,
233 232
 
234 233
       send_mode: 1, // 新增"群发方式" 1群主、2群聊
235
-      // isAllGroupChat: 1, // 新增"使用群聊" 1全部群聊、0部分群聊
236
-      // chat_groups: [], // 群聊id列表
234
+      // isAllGroupChat: 0, // 新增"使用群聊" 1全部群聊、0部分群聊
235
+      chat_groups: [], // 群聊id列表
237 236
       // isOpenGoods: 0, // 新增"商品"开关 1开启、0关闭
238 237
       // item_id: '', // 新增"商品id"
239 238
 
@@ -267,15 +266,15 @@ export default {
267 266
 
268 267
           this.send_mode = res.rst.send_mode
269 268
           if (this.send_mode == 2) { // 群发方式为"群聊" => 回显"群聊"相关数据
270
-            // if (res.rst.chat_groups && res.rst.chat_groups.length > 0) {
271
-            //   // 有值代表"部分群聊"
272
-            //   this.isAllGroupChat = 0
273
-            //   // 构造 群聊 数据 [{ chat_id: 'xxx', name: '' }]
274
-            //   let chat_groups =  res.rst.chat_groups ? res.rst.chat_groups.split(',') : []
275
-            //   chat_groups = chat_groups.map(item => ({ chat_id: item, name: '' }))
276
-            //   // 回显"部分群聊"数据
277
-            //   this.handleSetChatGroups(chat_groups)
278
-            // }
269
+            if (res.rst.chat_groups && res.rst.chat_groups.length > 0) {
270
+              // 有值代表"部分群聊"
271
+              // this.isAllGroupChat = 0
272
+              // 构造 群聊 数据 [{ chat_id: 'xxx', name: '' }]
273
+              let chat_groups =  res.rst.chat_groups ? res.rst.chat_groups.split(',') : []
274
+              chat_groups = chat_groups.map(item => ({ chat_id: item, name: '' }))
275
+              // 回显"部分群聊"数据
276
+              this.handleSetChatGroups(chat_groups)
277
+            }
279 278
             // this.item_id = res.rst.item_id || ''
280 279
             // if (res.rst.item_id) { // 有值代表开启"商品"开关
281 280
             //   this.isOpenGoods = 1
@@ -352,13 +351,13 @@ export default {
352 351
         })
353 352
         return
354 353
       }
355
-      // if (this.send_mode == 2 && this.isAllGroupChat == 0 && (!this.chat_groups || this.chat_groups.length == 0)) {
356
-      //   this.$message({
357
-      //     message: '请选择群聊!',
358
-      //     type: "warning"
359
-      //   })
360
-      //   return
361
-      // }
354
+      if (this.send_mode == 2 && (!this.chat_groups || this.chat_groups.length == 0)) {
355
+        this.$message({
356
+          message: '请选择群聊!',
357
+          type: "warning"
358
+        })
359
+        return
360
+      }
362 361
 
363 362
       if (this.operate_type == 1) { // 单主体判空
364 363
         if (this.is_for_all == 0 && (!this.user_id_list || this.user_id_list.length == 0)) {
@@ -418,11 +417,12 @@ export default {
418 417
         send_time: send_time,
419 418
         content: this.content,
420 419
         attachments: this.attachments == '' || this.attachments.length == 0 ? '' : JSON.stringify(this.attachments),
421
-        // chat_groups: this.send_mode == 2 ? (this.isAllGroupChat == 0 ? this.chat_groups.map(c => c.chat_id).join(',') : '') : '',
422
-        // item_id: (this.send_mode == 2 && this.isOpenGoods) ? this.item_id : '',
423 420
 
424
-        send_mode: 1, // 群发方式 2023.09.08 删除群发方式 不再支持选择群聊2 只支持选择群主1
421
+        send_mode: this.send_mode,
425 422
         operate_type: this.operate_type,
423
+
424
+        chat_groups: this.send_mode == 2 ? this.chat_groups.map(c => c.chat_id).join(',') : '',
425
+        // item_id: (this.send_mode == 2 && this.isOpenGoods) ? this.item_id : '',
426 426
       }
427 427
 
428 428
       if (this.operate_type == 1) { // 单企微参数
@@ -480,6 +480,12 @@ export default {
480 480
         this.multiple_senders = []
481 481
       }
482 482
     },
483
+
484
+    onChangeOperateType(currentType) {
485
+      if (currentType == 2) { // 多企微模式 只支持“按群主”发送
486
+        this.send_mode = 1
487
+      }
488
+    },
483 489
   }
484 490
 }
485 491
 </script>

+ 4 - 0
project/src/components/customOperate/chatGroup/createMsgDetail.vue

@@ -32,6 +32,10 @@
32 32
             <span class="txt">{{ dataInfo.operate_type == 1 ? '单个企微主体' : '多个企微主体' }}</span>
33 33
           </div>
34 34
           <div class="tMar20 flex-align-center">
35
+            <span class="lable">群发方式:</span>
36
+            <span class="txt">{{ dataInfo.send_mode == 1 ? '按群主发送' : '按群聊发送' }}</span>
37
+          </div>
38
+          <div v-if="dataInfo.send_mode == 1" class="tMar20 flex-align-center">
35 39
             <span class="lable">使用群主:</span>
36 40
             <div v-if="dataInfo.sender_data && dataInfo.sender_data.length" class="btn-text" @click="onClickShowGroupOwn(dataInfo.sender_data)">查看</div>
37 41
             <div v-else class="txt">-</div>

+ 5 - 0
project/src/components/customOperate/chatGroup/index.vue

@@ -36,6 +36,11 @@
36 36
           <div>{{ row.operate_type == 1 ? '单个企微主体' : '多个企微主体' }}</div>
37 37
         </template>
38 38
       </el-table-column>
39
+      <el-table-column label="群发方式" align="center" min-width="120">
40
+        <template slot-scope="scope">
41
+          <div>{{ scope.row.send_mode == 1 ? '按群主发送' : scope.row.send_mode == 2 ? '按群聊发送' : '' }}</div>
42
+        </template>
43
+      </el-table-column>
39 44
       <el-table-column label="消息类型" align="center">
40 45
         <template slot-scope="scope">
41 46
           <div>{{ scope.row.send_type == 1 ? '立即发送' : scope.row.send_type == 2 ? '定时发送' : '' }}</div>