<template>
    <el-dialog id="tableBody" title="拒绝批次打款" :visible.sync="dialogVisible" width="45%"   center :before-close="handleClose">
        <div style="margin-left:20%">
            <h3>确认要对：</h3>
            <br/>
            <div>
                <el-row :gutter="20" style="margin-left:5%;line-height: 25px;">
                    <el-col :span="16"><div class="grid-content bg-purple">打款批次：{{  this.client.batchNo }}</div></el-col>
                    <el-col :span="16"><div class="grid-content bg-purple">打款数量：{{  this.client.totalCount }}</div></el-col>
                    <el-col :span="16"><div class="grid-content bg-purple">总金额：{{  this.client.totalAmt }}</div></el-col>
                </el-row>
               
            </div>
             <br/>
            <h3>拒绝打款吗</h3>
            <br/>
            <br/>
            <div slot="footer" style="margin-right:30%">
                <el-button type="info" plain @click="handleClose" >取 消</el-button>
                <el-button type="primary" @click="submitMarket" style="margin-left:150px">确 定</el-button>
            </div>
        </div>
    </el-dialog>
</template>

<script>
    export default {
        name: "byhExportMarket",
        props: {
            dialogVisible: {
                type: Boolean
            },
            batchNo: {
                type: String
            },
            totalCount: {
                type: Number
            },
            totalAmt: {
                type: Number
            },
        },
        data () {
            return {
                client: {
                    batchNo:'',
                    totalAmt:'',
                    totalCount:'',
                },
            }
        },
        created() {
            this.client = {
                batchNo: this.batchNo,
                totalAmt: this.totalAmt,
                totalCount: this.totalCount,
            }
        },
        methods: {

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

            submitMarket() {
                this.$$get('/raise/raiseApproval', this.buildParam()).then(res => {

                    if (res.data.code != 200) {
                        this.$message.error(res.data.message);
                        return
                    }
                    
                    this.$message({message: '拒绝申请打款', type: 'success'});
                    this.handleClose();
                    window.location.reload()

                })
                .catch(error => {
                    this.$Message.error(error || '系统异常');
                });
            },
                //参数
            buildParam() {
                var return_hash = {
                    approvalStatus:'FAIL',
                    password:'45454654655645',
                    channel:'channelRand',
                };

                if (this.client.batchNo != '') {
                    return_hash['batchNo'] = this.client.batchNo
                }
               
                return return_hash;
            },
      
           
        },
        mounted: function () {
        },
    }
</script>

<style scoped lang="stylus" >

#tableBody{
    text-align:center;
}
 .el-row {
    margin-bottom: 20px;
    &:last-child {
      margin-bottom: 0;
    }
  }
</style>