Explorar o código

恒春来
-主页新增指定日期查询条件

lk hai 2 días
pai
achega
4153f435e8
Modificáronse 1 ficheiros con 35 adicións e 3 borrados
  1. 35 3
      src/views/components/index/statisticsDashboard.vue

+ 35 - 3
src/views/components/index/statisticsDashboard.vue

@@ -251,7 +251,20 @@
             <el-radio-button label="本周"></el-radio-button>
             <el-radio-button label="本月"></el-radio-button>
             <el-radio-button label="上月"></el-radio-button>
+            <el-radio-button label="指定日期" v-if="!showCompanyField"></el-radio-button>
           </el-radio-group>
+          <el-date-picker
+      v-if="queryTime === '指定日期'"
+      v-model="specificDate"
+      type="date"
+      placeholder="请选择日期"
+      :picker-options="pickerOptions"
+      format="yyyy-MM-dd"
+      value-format="yyyy-MM-dd"
+      size="medium"
+      style=" width: 150px;"
+      @change="handleAnalysis"
+    ></el-date-picker>
         </div>
         <div class="action-group">
           <div v-if="this.$store.state.user.medicalMallConfig.statics">
@@ -1067,9 +1080,21 @@ export default {
       // 今日商品总数
       todayGoodsNum: 0,
       // 微信上传失败订单数量
-      wxFailedCount: 0
+      wxFailedCount: 0,
+      specificDate:null,
+      pickerOptions: {
+        disabledDate(time) {
+          // 可选:限制只能选择今天及以前的日期
+          return time.getTime() > Date.now();
+        },},
     }
   },
+  computed: {
+    // 计算属性判断是否显示
+    showCompanyField() {
+      return process.env.VUE_APP_TITLE_INDEX === '恒春来';
+    },
+  },
   mounted() {
     this.$nextTick(() => {
       this.initViewerChart();
@@ -1483,7 +1508,11 @@ export default {
         param.startTime = this.formatDate(lastMonth.startOf('month'));
         param.endTime = this.formatDate(lastMonth.endOf('month'));
         type = 4;
-      } else {
+      } else if(this.queryTime === '指定日期'){
+        param.startTime = this.formatDate(this.specificDate);
+        param.endTime = this.formatDate(this.specificDate);
+        type = 5;
+      }else {
         console.warn(`未知的 queryTime: ${this.queryTime}, 默认使用今日`);
         param.startTime = this.formatDate(today);
         param.endTime = this.formatDate(today);
@@ -1494,7 +1523,10 @@ export default {
     },
     // 分析概览
     handleAnalysis(e) {
-
+      if(this.queryTime === '指定日期' && this.specificDate === null ){
+        return;
+      }
+      if(this.queryTime != '指定日期')this.specificDate = null;
       let param = this.getParam();
       analysisPreview(param).then(res => {
         if (res.code === 200) {