duanshenglang 1 mês atrás
pai
commit
9b8f7dffb7
2 arquivos alterados com 96 adições e 36 exclusões
  1. 49 11
      lottery/js/select-date.js
  2. 47 25
      lottery/jxs.html

+ 49 - 11
lottery/js/select-date.js

@@ -24,17 +24,55 @@ var demoComponent = Vue.extend({
             minDate: '',
             maxDate: '',
         }
-    },
-    created() { 
-        let nowDat = new Date()
-        let dateY = nowDat.getFullYear()
-        let dateM = nowDat.getMonth()
-        let dateD = nowDat.getDate()
-        // 设置日期可选最小值minDate、最大值maxDate
-        this.minDate = new Date(dateY - 1, dateM, dateD)
-        //日历可选范围为一年,dateY + 1
-        this.maxDate = new Date(dateY, dateM, dateD - 1)
-    },
+  },
+  props: {
+    pageDate: {
+      type: Array,
+      default: () => []
+    }
+  },
+  watch: {
+    pageDate: {
+      handler(newVal, oldVal) {
+        if (newVal.length) {
+          this.currentDate = newVal
+          if (this.currentDate[0] === this.getDateTime(-1) && this.currentDate[1] === this.getDateTime(-1)) {
+            this.numRange = 1
+          } else if (this.currentDate[0] === this.getDateTime(-7) && this.currentDate[1] === this.getDateTime(-1)) {
+            this.numRange = 7
+          } else if (this.currentDate[0] === this.getDateTime(-30) && this.currentDate[1] === this.getDateTime(-1)) {
+            this.numRange = 30
+          } else {
+            this.numRange = 3
+          }
+        }
+      },
+      deep: true
+    }
+  },
+  created() {
+    let nowDat = new Date()
+    let dateY = nowDat.getFullYear()
+    let dateM = nowDat.getMonth()
+    let dateD = nowDat.getDate()
+    // 设置日期可选最小值minDate、最大值maxDate
+    this.minDate = new Date(dateY - 1, dateM, dateD)
+    //日历可选范围为一年,dateY + 1
+    this.maxDate = new Date(dateY, dateM, dateD - 1)
+    if (this.pageDate.length) {
+      this.currentDate = this.pageDate
+      if (this.currentDate[0] === this.getDateTime(-1) && this.currentDate[1] === this.getDateTime(-1)) {
+        this.numRange = 1
+      } else if (this.currentDate[0] === this.getDateTime(-7) && this.currentDate[1] === this.getDateTime(-1)) {
+        this.numRange = 7
+      } else if (this.currentDate[0] === this.getDateTime(-30) && this.currentDate[1] === this.getDateTime(-1)) {
+        this.numRange = 30
+      } else {
+        this.numRange = 3
+      }
+      this.$emit('change-date', this.currentDate)
+        }
+  },
   methods: {
     handleChangeNumDateType(type) {
           this.numRange = type

+ 47 - 25
lottery/jxs.html

@@ -550,13 +550,13 @@
           <div class="top_data_title_branch">网点:{{outletName}}</div>
           <div class="triangle"></div>
         </div>
-        <select-date v-else @change-date="handleChangeDate"></select-date>
+        <select-date v-else :page-date="pageDate" @change-date="handleChangeDate"></select-date>
       </div>
       <div class="outlet_data" v-show="pageTitle !== '客户资产'" @click="showPicker = true">
         <div class="top_data_title_branch">网点:{{outletName}}</div>
         <div class="triangle"></div>
       </div>
-      <van-popup v-model="showPopup" closeable position="top" :lock-scroll="false" :style="{ height: '100%' }" @close="handleClosePopup">
+      <van-popup v-model="showPopup" duration="0.2" closeable position="top" :lock-scroll="false" :style="{ height: '100vh' }" @close="handleClosePopup">
         <div class="popup_list" v-show="!showMer">
           <div class="popup_item" @click="handlePage(1)">客户资产</div>
           <div class="popup_line"></div>
@@ -575,11 +575,11 @@
             :key="index" @click="handleSelectMer(item.id)">{{item.name}}</div>
         </div>
       </van-popup>
-      <van-popup v-model="showPicker" round position="bottom">
+      <van-popup v-model="showPicker" duration="0.2" round position="bottom">
         <van-picker title="网点" show-toolbar :columns="outletsData" @confirm="onConfirm" @cancel="showPicker = false" />
       </van-popup>
       <!-- 顾问响应统计 -->
-      <van-popup v-model="showMemberReply" position="right" :overlay="false" :lock-scroll="false" :style="{ width: '100%', height: '100%' }">
+      <van-popup v-model="showMemberReply" duration="0.2" position="right" :overlay="false" :lock-scroll="false" :style="{ width: '100%', height: '100vh' }">
         <div class="memberReply_title">
           <image class="close_icon" src="./img/close.png" @click="closeReply"></image>
           <div>顾问响应统计</div>
@@ -622,7 +622,7 @@
         </div>
       </van-popup>
       <!-- 顾问响应统计详情 -->
-      <van-popup v-model="showItemMemberReply" position="right" :lock-scroll="false" :overlay="false" :style="{ width: '100%', height: '100%' }">
+      <van-popup v-model="showItemMemberReply" position="right" duration="0.2" :lock-scroll="false" :overlay="false" :style="{ width: '100%', height: '100vh' }">
         <div class="memberReply_title">
           <image class="close_icon" src="./img/close.png" @click="closeItemMemberReply"></image>
           <div>顾问:{{currentMemberName}}</div>
@@ -646,18 +646,18 @@
             <van-loading type="spinner" color="#1989fa" class="van_loading" v-if="loading"></van-loading>
             <div class="branch_table" style="margin-bottom: 20px;" v-if="!loading">
               <div class="branch_header">
-                <div style="width: 50px;">客户昵称</div>
-                <div style="width: 80px;">手机号</div>
+                <div style="width: 60px;">客户昵称</div>
+                <div style="width: 100px;">手机号</div>
                 <div style="width: 80px;">最新消息<br />时间</div>
                 <div style="width: 60px;">等待时间</div>
-                <div style="width: 60px;">最新消息<br />内容</div>
+                <div style="width: 100px;">最新消息<br />内容</div>
               </div>
               <div class="branch_item" v-for="(item, index) in memberDetailReplyData" :key="index">
-                <div style="width: 50px;">{{item.clientName}}</div>
-                <div style="width: 80px;">{{item.clientPhone}}</div>
+                <div style="width: 60px;">{{item.clientName}}</div>
+                <div style="width: 100px;">{{item.clientPhone}}</div>
                 <div style="width: 80px;">{{timeFormat(item.msgTime)}}</div>
                 <div style="width: 60px;">{{formatTime(item.waitSeconds)}}</div>
-                <div style="width: 60px;">{{item.content}}</div>
+                <div style="width: 100px;">{{item.content}}</div>
               </div>
             </div>
             <van-pagination v-model="currentItemPage" :total-items="itemTotalItems" :show-page-size="3" force-ellipses
@@ -666,7 +666,7 @@
         </div>
       </van-popup>
       <!-- 顾问完成情况统计 -->
-      <van-popup v-model="showDoneReply" position="right" :overlay="false" :lock-scroll="false" :style="{ width: '100%', height: '100%' }">
+      <van-popup v-model="showDoneReply" position="right" duration="0.2" :overlay="false" :lock-scroll="false" :style="{ width: '100%', height: '100vh' }">
         <div class="memberReply_title">
           <image class="close_icon" src="./img/close.png" @click="closeReply"></image>
           <div>顾问完成情况统计</div>
@@ -724,7 +724,7 @@
             </van-popover>
           </div>
           <div id="funnelChart" :style="{ width: '100%', height: '200px', marginBottom: '20px' }"></div>
-          <select-date @change-date="handleChangeDate"></select-date>
+          <select-date :page-date="pageDate" @change-date="handleChangeDate"></select-date>
           <div class="all_data">
             <p class="add_data_p" :class="{'allData_bg': index === 1}" @click="handleClickItem(1)">总客户数</p>
             <p class="add_data_p" :class="{'allData_bg': index === 2}" @click="handleClickItem(2)">互动客户数</p>
@@ -885,12 +885,12 @@
               <div class="interact_line"></div>
               <div class="interact_item">
                 <div class="num_item_title">员工平均响应时长</div>
-                <div class="num_item_count">{{chatIndicators.total.avgReplyDuration ? chatIndicators.total.avgReplyDuration + '秒' : ''}}</div>
+                <div class="num_item_count">{{chatIndicators.total.avgReplyDuration ? formatTime(chatIndicators.total.avgReplyDuration) : ''}}</div>
                 <div class="num_item_data">
                   <div>较昨日:
                     <span v-if="chatIndicators.yda.avgReplyDuration" class="selected_color"
                       :style="{color: chatIndicators.yda.avgReplyDuration > 0 ? '#FF4E4E' : '#1677FF'}">
-                      {{chatIndicators.yda.avgReplyDuration > 0 ? '+' : ''}}{{chatIndicators.yda.avgReplyDuration}}</span>
+                      {{chatIndicators.yda.avgReplyDuration > 0 ? '+' : ''}}{{formatTime(chatIndicators.yda.avgReplyDuration)}}</span>
                   </div>
                   <image class="client_item_icon" v-if="chatIndicators.yda.avgReplyDuration"
                     :src="chatIndicators.yda.avgReplyDuration > 0 ? './img/jxs-up2.png' : './img/jxs-down1.png'"></image>
@@ -983,16 +983,16 @@
           <div class="branch_table">
             <div class="branch_header" style="box-sizing: border-box;">
               <div style="width: 60px;">网点</div>
-              <div>下发任务数</div>
-              <div>任务完成率</div>
-              <div>互动客户数</div>
+              <div style="width: 60px;">下发任务数</div>
+              <div style="width: 60px;">任务完成率</div>
+              <div style="width: 60px;">互动客户数</div>
               <div>激活率</div>
             </div>
             <div class="branch_item" style="box-sizing: border-box;" v-for="(item, index) in outletCount" :key="index">
               <div style="width: 60px;">{{item.outletName}}</div>
-              <div>{{item.taskNum}}</div>
-              <div>{{item.taskCompletePercent ? item.taskCompletePercent + '%' : '-'}}</div>
-              <div>{{item.interactClient}}</div>
+              <div style="width: 60px;">{{item.taskNum}}</div>
+              <div style="width: 60px;">{{item.taskCompletePercent ? item.taskCompletePercent + '%' : '-'}}</div>
+              <div style="width: 60px;">{{item.interactClient}}</div>
               <div>{{item.activatePercent ? item.activatePercent + '%' : '-'}}</div>
             </div>
           </div>
@@ -1150,7 +1150,7 @@
 
         contentRankData: [], // 运营任务-素材排行榜
         loading: false,
-
+        pageDate: [], // 日期范围
       }
     },
     created() {
@@ -1210,8 +1210,8 @@
             }
             this.outletName = '全部'
             this.outletId = null
+            this.getOutletsData()
             if (this.pageTitle === '客户资产') {
-              this.getOutletsData()
               this.getClientIndicators() // 客户资产-总数据
               this.getTrend() // 客户资产-统计趋势图
               this.stepStatistic() // 客户资产-客群包分布
@@ -1523,6 +1523,7 @@
       handleChangeDate(date) {
         this.pageStartTime = date[0]
         this.pageEndTime = date[1]
+        this.pageDate = date
         if (this.noDealerIds()) {
           return
         }
@@ -3781,14 +3782,35 @@
         if (seconds === undefined || seconds === '' || seconds === null) {
           return '--'
         }
-        if (seconds >= 60) {
+        if (seconds >= 3600) {
+          // 转换为小时并保留整数部分
+          const hour = this.formatNumber(seconds / 3600);
+          return `${hour}小时`;
+        } else if (seconds >= 60) {
           // 转换为分钟并保留整数部分
-          const minutes = Math.floor(seconds / 60);
+          const minutes = this.formatNumber(seconds / 60);
           return `${minutes}分钟`;
         } else {
           return `${seconds}秒`;
         }
       },
+      formatNumber(num) {
+        const number = Number(num);
+
+        if (isNaN(number) || !isFinite(number)) {
+          return num;
+        }
+
+        // 整数直接返回
+        if (Number.isInteger(number)) {
+          return number.toString();
+        }
+
+        // 非整数处理:先保留两位小数,再移除末尾的零
+        let str = number.toFixed(2);
+        // 正则表达式移除末尾的零(保留有效小数位)
+        return str.replace(/(\.[1-9]?0+)$|(\.[1-9])0+$/g, '$1$2');
+      },
       // 日期格式处理
       getDateTime(day) {
         let today = new Date()