<template>
    <el-dialog :visible.sync="visible" title="积分明细" width="70%" :close-on-click-modal="false">
        <el-table :data="tableList" v-loading="loading">
            <el-table-column type="index" label="序号" width="55" align="center"></el-table-column>
            <el-table-column label="明细名称" prop="detailName" align="center" width="150"></el-table-column>
            <el-table-column label="明细描述" prop="description" align="center"></el-table-column>
            <el-table-column label="操作之前积分" prop="beforePoints" align="center" width="130"></el-table-column>
            <el-table-column label="操作之后积分" prop="afterPoints" align="center" width="130"></el-table-column>
            <el-table-column label="时间" prop="createTime" align="center" width="150"></el-table-column>
        </el-table>
        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize" @pagination="getDetailList" />
        <template #footer>
            <el-button @click="visible = false">取消</el-button>
        </template>
    </el-dialog>
</template>
<script>
import { detailData } from '@/api/pointsManage'
export default {
    data() {
        return {
            visible: false,
            tableList: [],
            total: 0,
            queryParams: {
                pageNum: 1,
                pageSize: 10
            },
            loading: false
        }
    },
    methods: {
        openModal(row) {
            this.visible = true;
            this.queryParams.userName = row.userName
            this.getDetailList()
        },
        getDetailList() {
            this.loading = true;
            detailData(this.queryParams).then(res => {
                this.tableList = res.rows;
                this.total = res.total
            }).finally(() => {
                this.loading = false;
            })
        }
    }
}
</script>