kongdeqiang
2022-11-04 98fcbf66162fba0a097a8abcaeba5e1c1e32000e
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
 
<template>
  <div class="search">
    <Card>
      <Date-picker clearable @on-change="time1" format="yyyy-MM-dd" type="date" placement="bottom-end" placeholder="请选择配送日期" style="width: 240px;margin-bottom: 10px">
      </Date-picker>
      <Table
              :loading="loading"
              border
              :columns="columns"
              :data="data"
              ref="table"
      ></Table>
      <Row type="flex" justify="end" class="page">
        <Page
                :current="searchForm.pageNumber"
                :total="total"
                :page-size="searchForm.pageSize"
                @on-change="changePage"
                @on-page-size-change="changePageSize"
                :page-size-opts="[10, 20, 50]"
                size="small"
                show-total
                show-elevator
                show-sizer
        ></Page>
      </Row>
    </Card>
  </div>
</template>
 
<script>
  import {table2,} from "@/api/open2";
  export default {
    name: "table1",
    data() {
      return {
        maxHeight: 510,
        loading: true,
        searchForm: {
          // 搜索框初始化对象
          pageNumber: 1, // 当前页数
          pageSize: 10, // 页面大小
          sort: "createTime", // 默认排序字段
          order: "desc", // 默认排序方式
          sendDate: "",
          status:1//已送达
        },
        columns: [
          {
            type: "index",
            width: 60,
            align: "center",
          },
          {
            title: "商户",
            key: "customerName",
            tooltip:true,
          },
          {
            title: "条数",
            key: "num",
            width: 90,
          },
          {
            title: "配送日期",
            key: "sendDate",
            width: 150,
          },
        ],
        data: [],
        total: 0,
      };
    },
    methods: {
      getNowDay(){
        let nowDate = new Date()
        let date = {
          year: nowDate.getFullYear(),
          month: nowDate.getMonth() + 1,
          date: nowDate.getDate()
        }
        if (parseInt(date.date) < 10) {
          date.date = '0' + date.date
        }
        this.searchForm.sendDate = date.year + '-' + date.month + '-' + date.date
      },
      init() {
        this.getNowDay();
        this.getDataList();
      },
      time1(e){
        this.searchForm.sendDate = e;
        this.getDataList();
      },
      changePage(v) {
        this.searchForm.pageNumber = v;
        this.getDataList();
        this.clearSelectAll();
      },
      changePageSize(v) {
        this.searchForm.pageSize = v;
        this.getDataList();
      },
      getDataList() {
        this.loading = true;
        table2(this.searchForm).then((res) => {
          this.loading = false;
          if (res.success) {
            this.data = res.result.records;
            this.total = res.result.total;
          }
        });
      },
    },
    mounted() {
      this.maxHeight = Number(document.documentElement.clientHeight - 121) + "px";
      this.init();
    },
  };
</script>