Browse Source

feat: 群发小程序封面比例校验&客户管理流失时间

zhengxy 11 months ago
parent
commit
e28e0c7c37

+ 25 - 1
project/src/components/assembly/editCon.vue

240
 
240
 
241
           <!-- <el-button type="primary" plain size="mini">裁剪</el-button> -->
241
           <!-- <el-button type="primary" plain size="mini">裁剪</el-button> -->
242
         </div>
242
         </div>
243
-        <p class="uploadImgHint" style="margin-left:20px;">*图片仅支持png或jpg格式,且文件大小不得超过10M。封面图建议尺寸为520*416。</p>
243
+        <p class="uploadImgHint" style="margin-left:20px;">*仅支持PNG及JPG,封面显示图片宽高比为5:4,且文件大小不得超过10M。</p>
244
         <div class="buttons">
244
         <div class="buttons">
245
           <el-button type="primary" plain size="mini" @click="miniprogramVisible = false">取消</el-button>
245
           <el-button type="primary" plain size="mini" @click="miniprogramVisible = false">取消</el-button>
246
           <el-button type="primary" size="mini" @click="miniprogramDefine">确定</el-button>
246
           <el-button type="primary" size="mini" @click="miniprogramDefine">确定</el-button>
916
         if (this.miniprogramVisible) {//小程序
916
         if (this.miniprogramVisible) {//小程序
917
           this.miniprogram.pic_media_id = res.rst.material_id;
917
           this.miniprogram.pic_media_id = res.rst.material_id;
918
           this.miniprogram.pic_url = res.rst.url;
918
           this.miniprogram.pic_url = res.rst.url;
919
+          try {
920
+            this.handleCheckImgWH(file)
921
+          } catch (error) {
922
+            console.log(error)
923
+          }
919
         }
924
         }
920
         if (this.linkExtendVisible) {//推广链接
925
         if (this.linkExtendVisible) {//推广链接
921
           this.linkExtend.picurl = res.rst.url;
926
           this.linkExtend.picurl = res.rst.url;
997
       await this.handleGetMiniProOptions()
1002
       await this.handleGetMiniProOptions()
998
       this.$message.success('刷新成功')
1003
       this.$message.success('刷新成功')
999
     },
1004
     },
1005
+    // 判断小程序封面图片比例是否为5:4 => 给出提示
1006
+    handleCheckImgWH(file) {
1007
+      const reader = new FileReader()
1008
+      reader.readAsDataURL(file.raw)
1009
+      reader.onload = () => {
1010
+        const img = new Image()
1011
+        img.src = reader.result
1012
+        img.onload = () => {
1013
+          const ratio = img.width / img.height
1014
+          const requiredRatio = 5 / 4
1015
+          if (Math.abs(ratio - requiredRatio) > 0.01) {
1016
+            this.$message.warning({
1017
+              message: '小程序封面图片宽高比为5:4,建议使用【图片裁剪】进行调整',
1018
+              duration: 5000,
1019
+            })
1020
+          }
1021
+        }
1022
+      }
1023
+    },
1000
   }
1024
   }
1001
 }
1025
 }
1002
 </script>
1026
 </script>

+ 25 - 1
project/src/components/assembly/editConWelGroup.vue

226
             </div>
226
             </div>
227
           </div>
227
           </div>
228
         </div>
228
         </div>
229
-        <p class="uploadImgHint" style="margin-left:20px;">*图片仅支持png或jpg格式,且文件大小不得超过10M。封面图建议尺寸为520*416。</p>
229
+        <p class="uploadImgHint" style="margin-left:20px;">*仅支持PNG及JPG,封面显示图片宽高比为5:4,且文件大小不得超过10M。</p>
230
         <div class="buttons">
230
         <div class="buttons">
231
           <el-button type="primary" plain size="mini" @click="miniprogramVisible = false">取消</el-button>
231
           <el-button type="primary" plain size="mini" @click="miniprogramVisible = false">取消</el-button>
232
           <el-button type="primary" size="mini" @click="miniprogramDefine">确定</el-button>
232
           <el-button type="primary" size="mini" @click="miniprogramDefine">确定</el-button>
895
         if (this.miniprogramVisible) {//小程序
895
         if (this.miniprogramVisible) {//小程序
896
           this.miniprogram.pic_media_id = res.rst.material_id;
896
           this.miniprogram.pic_media_id = res.rst.material_id;
897
           this.miniprogram.pic_url = res.rst.url;
897
           this.miniprogram.pic_url = res.rst.url;
898
+          try {
899
+            this.handleCheckImgWH(file)
900
+          } catch (error) {
901
+            console.log(error)
902
+          }
898
         }
903
         }
899
         if (this.linkExtendVisible) {//推广链接
904
         if (this.linkExtendVisible) {//推广链接
900
           this.linkExtend.picurl = res.rst.url;
905
           this.linkExtend.picurl = res.rst.url;
976
       await this.handleGetMiniProOptions()
981
       await this.handleGetMiniProOptions()
977
       this.$message.success('刷新成功')
982
       this.$message.success('刷新成功')
978
     },
983
     },
984
+    // 判断小程序封面图片比例是否为5:4 => 给出提示
985
+    handleCheckImgWH(file) {
986
+      const reader = new FileReader()
987
+      reader.readAsDataURL(file.raw)
988
+      reader.onload = () => {
989
+        const img = new Image()
990
+        img.src = reader.result
991
+        img.onload = () => {
992
+          const ratio = img.width / img.height
993
+          const requiredRatio = 5 / 4
994
+          if (Math.abs(ratio - requiredRatio) > 0.01) {
995
+            this.$message.warning({
996
+              message: '小程序封面图片宽高比为5:4,建议使用【图片裁剪】进行调整',
997
+              duration: 5000,
998
+            })
999
+          }
1000
+        }
1001
+      }
1002
+    },
979
   }
1003
   }
980
 }
1004
 }
981
 </script>
1005
 </script>

+ 1 - 1
project/src/components/assembly/multipleLinkEdit.vue

62
               <i v-else class="el-icon-plus avatar-uploader-icon" />
62
               <i v-else class="el-icon-plus avatar-uploader-icon" />
63
             </el-upload>
63
             </el-upload>
64
           </div>
64
           </div>
65
-          <p class="uploadImgHint" style="margin-left:20px;">*图片仅支持png或jpg格式,且文件大小不得超过10M。封面图建议尺寸为520*416。</p>
65
+          <p class="uploadImgHint" style="margin-left:20px;">*仅支持PNG及JPG,封面显示图片宽高比为5:4,且文件大小不得超过10M。</p>
66
         </div>
66
         </div>
67
       </div>
67
       </div>
68
       <!-- E 小程序 -->
68
       <!-- E 小程序 -->

+ 35 - 11
project/src/components/customManage/manage.vue

1
 <template>
1
 <template>
2
   <div v-loading="loading">
2
   <div v-loading="loading">
3
     <!-- 使用说明 -->
3
     <!-- 使用说明 -->
4
-    <instructions doc="customManage"></instructions>
4
+    <instructions doc="customManage" />
5
 
5
 
6
     <div class="screenBox">
6
     <div class="screenBox">
7
       <!-- 搜索客户 -->
7
       <!-- 搜索客户 -->
8
-      <self-input :reset='resetFlag' @inputChange='(val)=>{input_keyword = val;init(1)}'></self-input>
8
+      <self-input :reset='resetFlag' @inputChange='(val)=>{input_keyword = val;init(1)}' />
9
       <!-- 所属客服 -->
9
       <!-- 所属客服 -->
10
-      <self-customerservice :reset='resetFlag' @customerDefine="(val)=>{user_id_list=val;init(1)}"></self-customerservice>
10
+      <self-customerservice :reset='resetFlag' @customerDefine="(val)=>{user_id_list=val;init(1)}" />
11
       <!-- 企业标签 -->
11
       <!-- 企业标签 -->
12
-      <enterprise-tag :reset='resetFlag' @tagDefine="tagDefine"></enterprise-tag>
12
+      <enterprise-tag :reset='resetFlag' @tagDefine="tagDefine" />
13
       <!-- 添加时间 -->
13
       <!-- 添加时间 -->
14
-      <date-picker :reset='resetFlag' @changeTime="changeTime"></date-picker>
14
+      <date-picker :reset='resetFlag' @changeTime="changeTime" />
15
       <!-- 添加渠道 -->
15
       <!-- 添加渠道 -->
16
-      <self-channel :reset='resetFlag' @channelDefine="(val)=>{add_way = val;init(1)}"></self-channel>
16
+      <self-channel :reset='resetFlag' @channelDefine="(val)=>{add_way = val;init(1)}" />
17
       <!-- 性别 暂时获取不到 -->
17
       <!-- 性别 暂时获取不到 -->
18
-      <self-gender :reset='resetFlag' @genderChange="(val)=>{gender = val;init(1)}"></self-gender>
18
+      <self-gender :reset='resetFlag' @genderChange="(val)=>{gender = val;init(1)}" />
19
       <!-- 流失状态 -->
19
       <!-- 流失状态 -->
20
-      <loss-body :reset='resetFlag' @lossChange="lossChange"></loss-body>
20
+      <loss-body :reset='resetFlag' @lossChange="lossChange" />
21
       <!-- 付费情况 -->
21
       <!-- 付费情况 -->
22
-      <screen-pay :reset='resetFlag' @payChange="payChange"></screen-pay>
22
+      <screen-pay :reset='resetFlag' @payChange="payChange" />
23
       <!-- 充值时间 -->
23
       <!-- 充值时间 -->
24
       <date-picker :reset='resetFlag' title="充值时间" @changeTime="onChangePayTime" />
24
       <date-picker :reset='resetFlag' title="充值时间" @changeTime="onChangePayTime" />
25
+      <!-- 流失时间 -->
26
+      <date-picker :reset='resetFlag' title="流失时间" timeFlag :defaultTime="['00:00:00', '23:59:59']" @changeTime="onChangeLossTime" />
25
       <div class="reset" @click="resetEvent">重置</div>
27
       <div class="reset" @click="resetEvent">重置</div>
26
     </div>
28
     </div>
27
     <div class="tableInfo">
29
     <div class="tableInfo">
116
           </div>
118
           </div>
117
         </template>
119
         </template>
118
       </el-table-column>
120
       </el-table-column>
119
-      <el-table-column label="客户状态" show-overflow-tooltip align="center">
121
+      <el-table-column label="客户状态" show-overflow-tooltip align="center" min-width="110">
120
         <template slot-scope="scope">
122
         <template slot-scope="scope">
121
-          <span v-if="scope.row.relation_enable==0" class="c-F03F5C">已流失</span>
123
+          <div v-if="scope.row.relation_enable==0" class="c-F03F5C">已流失
124
+            <p v-if="scope.row.loss_time">{{ scope.row.loss_time.split(' ')[0] }}</p>
125
+            <p v-if="scope.row.loss_time">{{ scope.row.loss_time.split(' ')[1] }}</p>
126
+          </div>
122
           <span v-if="scope.row.relation_enable==1" class="c-448AFF">未流失</span>
127
           <span v-if="scope.row.relation_enable==1" class="c-448AFF">未流失</span>
123
           <span v-if="scope.row.relation_enable==2" class="c-FFB055">待分配</span>
128
           <span v-if="scope.row.relation_enable==2" class="c-FFB055">待分配</span>
124
         </template>
129
         </template>
209
       add_date_end: '',//添加日期 截止
214
       add_date_end: '',//添加日期 截止
210
       last_pay_time_start: '',//充值时间 起始
215
       last_pay_time_start: '',//充值时间 起始
211
       last_pay_time_end: '',//充值时间 截止
216
       last_pay_time_end: '',//充值时间 截止
217
+      loss_time_start: '',//流失时间 起始
218
+      loss_time_end: '',//流失时间 截止
212
       loss_status: null,//客户流失状态 没有筛选时传null 0未流失 1已流失
219
       loss_status: null,//客户流失状态 没有筛选时传null 0未流失 1已流失
213
       pay_status: null,//	付款状态 没有筛选时传null 0未付款 1已付款
220
       pay_status: null,//	付款状态 没有筛选时传null 0未付款 1已付款
214
       pay_num_min: '',//最小付款次数,当pay_status是1时必传
221
       pay_num_min: '',//最小付款次数,当pay_status是1时必传
278
           add_date_end: this.add_date_end,
285
           add_date_end: this.add_date_end,
279
           last_pay_time_start: this.last_pay_time_start,
286
           last_pay_time_start: this.last_pay_time_start,
280
           last_pay_time_end: this.last_pay_time_end,
287
           last_pay_time_end: this.last_pay_time_end,
288
+          loss_time_start: this.loss_time_start,
289
+          loss_time_end: this.loss_time_end,
281
           add_way: this.add_way,
290
           add_way: this.add_way,
282
           pay_status: this.pay_status,
291
           pay_status: this.pay_status,
283
           pay_num_min: this.pay_num_min,
292
           pay_num_min: this.pay_num_min,
379
       this.add_date_end = '';
388
       this.add_date_end = '';
380
       this.last_pay_time_start = '';
389
       this.last_pay_time_start = '';
381
       this.last_pay_time_end = '';
390
       this.last_pay_time_end = '';
391
+      this.loss_time_start = '';
392
+      this.loss_time_end = '';
382
       this.loss_status = null;
393
       this.loss_status = null;
383
       this.pay_status = null;
394
       this.pay_status = null;
384
       this.pay_num_min = '';
395
       this.pay_num_min = '';
436
       }
447
       }
437
       this.init(1)
448
       this.init(1)
438
     },
449
     },
450
+    // 监听“流失时间”筛选变化
451
+    onChangeLossTime (time) {
452
+      if (!time || time && time.length == 0) {
453
+        this.loss_time_start = '';
454
+        this.loss_time_end = '';
455
+      } else {
456
+        this.loss_time_start = time[0]
457
+        this.loss_time_end = time[1]
458
+      }
459
+      this.init(1)
460
+    },
439
     tagDefine (data) {//标签选择回调
461
     tagDefine (data) {//标签选择回调
440
       if (data.tag == 1 || data.tag == 2) {
462
       if (data.tag == 1 || data.tag == 2) {
441
         if (data.tag_id_list && data.tag_id_list.length != 0) {
463
         if (data.tag_id_list && data.tag_id_list.length != 0) {
472
           add_date_end: this.add_date_end,
494
           add_date_end: this.add_date_end,
473
           last_pay_time_start: this.last_pay_time_start,
495
           last_pay_time_start: this.last_pay_time_start,
474
           last_pay_time_end: this.last_pay_time_end,
496
           last_pay_time_end: this.last_pay_time_end,
497
+          loss_time_start: this.loss_time_start,
498
+          loss_time_end: this.loss_time_end,
475
           add_way: this.add_way,
499
           add_way: this.add_way,
476
           pay_status: this.pay_status,
500
           pay_status: this.pay_status,
477
           pay_num_min: this.pay_num_min,
501
           pay_num_min: this.pay_num_min,