<template>
  <el-dialog title="历史首充记录" :close-on-click-modal="false" :visible.sync="open" width="800px" append-to-body>
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
      <el-form-item label="日期" prop="countDate">
        <el-date-picker
            v-model="queryParams.countDate"
            type="date"
            placeholder="选择日期"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
            @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table v-loading="loading" :data="oldFastPayList">
      <el-table-column label="日期" align="center" prop="countDate" />
      <el-table-column label="人数" align="center" prop="count" />
    </el-table>
    <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
    />
  </el-dialog>
</template>

<script>
import {fastPayTotalList} from '@/api/cai/rechargeOrder'

export default {
  name: "OldFastPay",
  data() {
    return {
      oldFastPayList:[],
      queryParams:{
        pageNum: 1,
        pageSize: 10,
      },
      open: false,
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
    };
  },
  created() {

  },
  methods: {
    init(){
      this.open = true;
      this.getList();
    },
    getList(){
      fastPayTotalList(this.queryParams).then(response => {
        this.oldFastPayList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
  }
};
</script>
