<template>
    <el-dialog   :visible.sync="dialogVisible" width="70%" :before-close="handleClose">
        <div >
            <el-table :data="records" stripe style="width: 100%;">
                <el-table-column prop="gmtCreated" label="打款批次" :formatter="dateFormat" ></el-table-column>
                <el-table-column prop="bizNo" label="放款单号" ></el-table-column>
                <el-table-column prop="ownerName" label="姓名"   ></el-table-column>
                <el-table-column prop="bankAccount" label="银行卡号"  ></el-table-column>
                <el-table-column prop="raiseAmt" label="放款金额"  ></el-table-column>
                <el-table-column prop="openBankName" label="银行名称"  ></el-table-column>
                <el-table-column prop="ownerIdNo" label="证件号码"  ></el-table-column>
                <el-table-column prop="raiseStatusStr" label="打款状态"  ></el-table-column>
                <el-table-column prop="raiseResult" label="打款结果"  ></el-table-column>
            </el-table>

            <div class="page">
                <el-pagination
                        @current-change="handleCurrentChange"
                        @size-change="handleSizeChange"
                        :current-page.sync="page.current"
                        :page-sizes="[20, 50, 80, 100]"
                        :page-size="page.size"
                        layout="total, sizes, prev, pager, next, jumper"
                        :total="page.total">
                </el-pagination>
            </div>

        </div>
    </el-dialog>
</template>

<script>
    import * as moment from "moment";

    export default {
        name: "ByhContactDialog",
        props: {
            dialogVisible: {
                type: Boolean
            },
            batchNo: {
                type: String
            },
        },
        data () {
            return {
                ruleForm: {
                    batchNo:'',
                },
                records:[],
                 page: {
                    current: 1,
                    size: 20,
                    total: 0
                },
            }
        },
        created() {
            this.ruleForm = {
                batchNo: this.batchNo,
            }
        },
        methods: {

            /** 关闭处理 */
            handleClose () {
                this.visible = false
                setTimeout(() => {
                    this.$emit('update:dialogVisible', false)
                }, 100)
            },

            /*日期*/
            dateFormat: function (row, column) {
                var date = row[column.property]
                if (date == undefined) {
                    return ''
                }
                return moment(date).format("YYYY-MM-DD h:m:s")
            },
            handleSizeChange(row){
                this.page.size=row
                this.page.current=1;
                this.submitMarket();
            },
               /** 处理分页操作*/
            handleCurrentChange() {
                this.records = this.submitMarket();
            },

            submitMarket() {
                 this.$$post('/raise/getQueryBatchDetail', this.buildParam()).then(res => {
                    if (res.data.code != 200) {
                        this.$message.error(res.data.message);
                        return
                    }
                    this.records = res.data.result.data;
                    this.page.total = res.data.result.total;
                }).catch(error => {
                    this.$Message.error(error || '系统异常');
                });
            },
             //参数
            buildParam() {
                var return_hash = {
                    size: this.page.size,
                    current: this.page.current,
                };

                if (this.ruleForm.batchNo != '') {
                    return_hash['batchNo'] = this.ruleForm.batchNo
                }

                return return_hash;
            },

        },
        mounted: function () {
            this.submitMarket();
        },
    }
</script>

<style scoped lang="stylus" rel="stylesheet/stylus">

</style>