<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
            <el-form-item label="案件编号" prop="caseNum">
                <el-input v-model="queryParams.caseNum" placeholder="请输入案件编号" clearable @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="dataList" style="width: 100%">
            <el-table-column label="序号" type="index" align="center">
                <template slot-scope="scope">
                    <span>{{
                        (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1
                    }}</span>
                </template>
            </el-table-column>
            <el-table-column label="案件编号" align="center" prop="caseNum" :show-overflow-tooltip="true" />
            <el-table-column label="名称" align="center" prop="mailName" :show-overflow-tooltip="true" />
            <!-- <el-table-column label="证件号码" align="center" prop="caseNum" :show-overflow-tooltip="true" /> -->
            <el-table-column label="邮箱地址" align="center" prop="mailAddress" />
            <el-table-column label="发送时间" align="center" prop="sendTime" :show-overflow-tooltip="true" />
            <el-table-column label="发送状态" align="center" prop="sendStatus" />
            <!-- <el-table-column label="文书类型" align="center" prop="hearDate" :show-overflow-tooltip="true" /> -->
            <!-- 缴费人 -->
            <!-- <el-table-column label="案件状态" align="center" prop="caseStatusName" /> -->
            <el-table-column label="内容" align="center" prop="mailContent"></el-table-column>
        </el-table>
        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
            @pagination="getList(queryParams)" />

    </div>
</template>
  
<script>
import {
    emailList,
} from "@/api/deliveryRecord/deliveryRecord.js";

import { getDicts } from '@/api/system/dict/data.js'
export default {
    name: "paymentList",
    dicts: ["case_status"],
    components: {},
    data() {
        return {
            queryParams: {
                pageNum: 1,
                pageSize: 10,
            },
            caseStatus: [],
            // 遮罩层
            loading: false,
            // 总条数
            total: 0,
            // 表格数据
            form: {},
            // 校验表单
            rules: {},
            dataList: [],
        };
    },
    created() {
        getDicts("case_status").then(res => {
            this.caseStatus = res.data;
            this.getList(this.queryParams);
        })
    },
    methods: {
        /** 搜索按钮操作 */
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.getList(this.queryParams);
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.resetForm("queryForm");
            this.handleQuery();
        },
        // 查询列表数据
        getList(parms) {
            this.loading = true;
            emailList(parms).then((response) => {
                this.dataList = response.rows;
                this.dataList.forEach(item => {
                    if (item.sendStatus == 0) {
                        item.sendStatus = "未发送"
                    } else if (item.sendStatus == 1) {
                        item.sendStatus = "已发送"
                    } else {
                        item.sendStatus = "未发送"
                    }
                })
                this.total = response.total;
                this.loading = false;
            });
        },
    },
};
</script>
  
<style lang="scss" scoped></style>