819527061@qq.com
2024-11-18 34aedd9998b5572488e49db884b2f7966d960a57
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
<template>
    <div class="mod-config" style="padding: 10px 10px 0px 10px;">
        <div>
            <el-form :inline="true" :model="searchForm">
              <el-form-item label="停车场">
              <el-select v-model="searchForm.parkId" clearable>
                <el-option v-for="item in table1" :key="item.id" :label="item.name" :value="item.id" ></el-option>
              </el-select>
              </el-form-item>
              <el-form-item label="选择月份">
                <div class="date-box">
                  <el-date-picker
                      v-model="searchForm.day"
                      type="month"
                      value-format="yyyy-MM"
                      placeholder="选择月">
                  </el-date-picker>
                </div>
              </el-form-item>
                <el-form-item>
                    <el-button type="primary" size="small" @click="onSearch" icon="el-icon-search">查询</el-button>
                </el-form-item>
            </el-form>
        </div>
 
        <el-table
            :height="tableHeight"
            :data="table2"
            border
            style="width:100%;border:1px solid #bcbec2;"
            show-summary>
          <el-table-column
              prop="day"
              align="center"
              label="日期"
              fixed="left"
              width="120">
          </el-table-column>
            <el-table-column
                v-for="(item,index) in headTable"
                :key="index"
                :label="item.parkName"
                :prop="item.parkId + ''"
                align="center">
              <el-table-column :prop="item.parkName + 'num'" label="有效订单数" align="right" header-align="center"></el-table-column>
              <el-table-column :prop="item.parkName + 'price'"  label="订单总金额(元)" align="right" header-align="center"></el-table-column>
            </el-table-column>
        </el-table>
    </div>
</template>
 
<script>
    export default {
        name: "index",
        data: function () {
            return {
                flag:false,
                flag2:false,
                searchForm: {
                    parkId: '',
                    startTime:'',
                    endTime:'',
                    day:'',
                },
                formData: {
                  parkName:'',
                  orderNum:'',
                  orderMoney:''
                },
                urlPath:this.$systemconfig.basePath + '/ffzf/orderrecord/',
                table1:[],
                table2:[],
                headTable:[],
                tableHeight:500
            }
        },
      created() {
        this.tableHeight = window.innerHeight - 170
      },
      mounted() {
            this.defaultDate();
            this.$byutil.postData(this, this.$systemconfig.basePath+'/ffzf/park/findAll', this.formData, res => {
                this.table1 = res.data;
            })
        },
        methods: {
            loadData() {
              this.table2 = []
              this.$byutil.postData(this, this.urlPath+'findCountPageByDay', this.searchForm,res => {
                this.headTable = res.data[0].data
                let temp = res.data
                temp.forEach(item => {
                  let row = {day:item.day};
                  item.data.forEach(e=>{
                    row[e.parkName + 'num']=e.num;
                    row[e.parkName + 'price']=e.price;
                  })
                  this.table2.push(row)
                })
             });
            },
            onSearch() {
                this.loadData();
            },
          //设置默认日期
          defaultDate(){
            //默认显示上月日期
            // let date = new Date(new Date() - 30 * 24 * 3600 * 1000);
            // this.value =
            //     date.getFullYear() +
            //     (date.getMonth() + 1 < 10 ? "0" : "") +
            //     (date.getMonth() + 1);
            // console.log(this.value );   //202212
 
            //默认显示当月日期
            let date = new Date(new Date());
            this.searchForm.day =
                date.getFullYear() +'-'+
                (date.getMonth() + 1 < 10 ? "0" : "") +
                (date.getMonth() + 1);
            console.log(this.value );   //202301
            this.loadData()
          },
        }
    }
</script>
 
<style scoped>
 
</style>