hejianhao
2025-04-16 dab2d210ca06c1faa514c6388fbd5de1ab355360
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<template>
  <div class="finance-del">
    <v-header
      title="预约汇总"
    ></v-header>
    <div class="add">
      <span class="back-color" @click="back"><i class="el-icon-arrow-left"></i>返回上一级</span>
    </div>
    <el-form :inline="true"  class="demo-form-inline">
      <el-form-item>
        <div class="block">
          <span class="demonstration">预约日期</span>
          <el-date-picker
            v-model="time"
            @change="changeTime"
            type="daterange"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
            range-separator="至"
            :clearable="false"  
            start-placeholder="开始日期"
            end-placeholder="结束日期">
          </el-date-picker>
          <button class="m_btn bgc_primary min-width" @click="Reset()">重 置</button>
          <button class="m_btn bgc_primary min-width" @click="exports()">导 出</button>
        </div>
      </el-form-item>
    </el-form>
    <!-- data -->
    <div class="dataBox">
      <el-calendar v-model="calendar">
              <!-- 这里使用的是 2.5 slot 语法,对于新项目请使用 2.6 slot 语法-->
              <template
                slot="dateCell"
                slot-scope="{date, data}">
                <p @click="calendarOnClick(data)">  
            <span>        
                  {{ data.day.split('-').slice(1).join('-') }}<br />
            </span>
            <span class="data-color">
            {{dealMyDate(data.day)}}
            </span>
                </p>
              </template>
            </el-calendar>
    </div>
 
    <div class="tab">
      <v-tool-table
        :trs="trs"
        :tds="tds"
      >
      </v-tool-table>
    </div>
 
 
  </div>
</template>
 
<script>
export default {
  props: [],
  components: {},
  data() {
    return {
      time:[],
      calendar:new Date(),
      os: {},
      trs: [
        { text: "日期", val: "reserveTime" },
        { text: "预约主题", val: "title" },
        { text: "所占百分比", val: "tag" },
        { text: "预约量", val: "count" },
        { text: "每日合计", val: "allCount" },
      ],
      tds: [],
      startTime:'',
      endTime:'',
      resDate: []
    };
  },
 
 
  mounted() {
    this.init();
  },
 
  methods: {
    dealMyDate(v) {
      let len = this.resDate.length
      let res = ""
      for(let i=0; i<len; i++){
          if(this.resDate[i].reserveTime == v) {
            res = this.resDate[i].count +'个已预约'
            break
          }
      }
      return res
    },    
    
    Reset() {
      this.time = '';
      this.startTime = '';
      this.endTime = '';
      this.init();
    },
 
    back() {
      this.$router.back();
    },
 
    changeTime() {
      this.startTime = this.time[0]; 
      this.endTime = this.time[1]; 
      this.init();
    },
 
    //点击日期块
    calendarOnClick(e) {
      console.log(e);
      this.startTime = e.day;
      this.endTime = '';
      this.init()
    },
 
    init() {
      let params = {
        endTime: this.endTime,
        startTime: this.startTime,
      };
 
      this.$api.post("reserve/make/statistics", params, (e) => {
        this.resDate = e.leftStatisticsList;
        this.tds = (e.rightStatisticsList || []).map((v) => {
          this.$set(v, 'che', false)
          return v;
        });
      });
 
    },
 
    //导出
    exports() {
      let params = {
        endTime: this.endTime,
        startTime: this.startTime,
      }
      this.$api.post("reserve/make/statistics/export", params, (e) => {
        window.location.href = e;
      });
    },
 
 
  },
};
</script>
 
<style scoped lang="less">
.tab {
  width: 600px;
  height: 650px;
  float: left;
  overflow-y: auto;
  outline:1px solid #EBEEF5;
}
.dataBox {
  width: 600px;
  height: 650px;
  float: left;
  margin-right: 25px;
  border:1px solid #EBEEF5;
}
.finance-del {
  overflow: scroll;
}
.demo_hidden::-webkit-scrollbar {
    display: block !important; 
}
.finance-del{
  overflow-y: auto;
  // height: 700px;
}
.tab::-webkit-scrollbar {
/*滚动条整体样式*/
width : 3px;  /*高宽分别对应横竖滚动条的尺寸*/
height: 1px;
}
.tab::-webkit-scrollbar-thumb {
/*滚动条里面小方块*/
border-radius: 5px;
background   : #999;
}
.tab::-webkit-scrollbar-track {
/*滚动条里面轨道*/
border-radius: 5px;
background   : #ededed;
}
.add {
  text-align: right;
  padding-bottom: 20px;
  .back-color {
    color: #409EFF;
    cursor: pointer;
    }
  }
.bgc_primary {
  margin-bottom: 15px;
}
.min-width {
  width: 70px;
}
.data-color {
  color: #F56C6C;
}
</style>