<template>
    <div>
        <el-form :model="signForm" label-width="90px" :inline="true">
            <el-form-item label="学生姓名：" prop="xsxm">
                <el-input v-model="signForm.xsxm" clearable @clear="getListData">
                </el-input>
            </el-form-item>
            <el-form-item label="学籍号：" prop="xsxh">
                <el-input v-model="signForm.xsxh" clearable @clear="getListData">
                </el-input>
            </el-form-item>
            <el-button type="primary" class="ml5" @click="getListData">搜索</el-button>
        </el-form>
        <el-table :data="jfList" v-loading="loading" tooltip-effect="dark" class="mt20" style="width: 100%"
            @selection-change="handleSelectionChange">
            <el-table-column type="selection" align="center" width="55">
            </el-table-column>
            <el-table-column label="学生姓名" align="left" prop="xdwxdj_xs_xm"></el-table-column>
            <el-table-column label="学籍号" prop="xdwxdj_xs_xjh" width="auto">
            </el-table-column>
            <el-table-column label="兑换奖品" prop="xdwxdj_dhjp"></el-table-column>
            <el-table-column label="兑换消耗积分" prop="xdwxdj_dhxhjf"></el-table-column>
        </el-table>
        <footer class="flex-item-none" style="display: flex; justify-content: flex-end; margin-top: 30px">
            <el-pagination background layout="total,prev, pager, next" :page-size="limit" :total="total"
                :current-page.sync="cur_page" @current-change="handleCurrentChange"></el-pagination>
        </footer>
    </div>
</template>

<script>
import { jfdh_list, sign_del } from "./api";
import { useUserStore } from "@/stores/user";
const { token, real_name } = useUserStore();
export default {
    name: "index",
    data() {
        return {
            xdb_id: "",
            limit: 10,
            total: 0,
            loading: false,
            cur_page: 1,
            signForm: {
                xsxm: "",
                xsxh: "",
            },
            jfList: [],
            multipleSelection: [],
        };
    },
    methods: {
        getListData() {
            this.loading = true;
            let data = {
                page: this.cur_page,
                limit: this.limit,
                xdwxdj_xs_xm: this.signForm.xsxm,
                xdwxdj_xs_xjh: this.signForm.xsxh,
            };
            jfdh_list(data).then((res) => {
                this.loading = false;
                if (res.code == 1) {
                    this.jfList = res.data.page_data;
                    this.cur_page = Number(res.data.page_now);
                    this.total = Number(res.data.total_rows);
                }
            });
        },
        handleSelectionChange(val) {
            this.multipleSelection = val;
        },
        handleCurrentChange(val) {
            this.cur_page = val;
            this.getListData();
        },
    },
    mounted() {
        this.getListData();
    },
};
</script>

<style scoped></style>