<template>
  <el-dialog class="contact-dialog"
             title="驳回借款" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">

    <div class="input">
      <el-form :model="contact" ref="contactForm" :label-width="'100px'">
        <el-form-item label="驳回意见:" prop="content">
          <el-input type="textarea" row="3" v-model="memo"></el-input>
        </el-form-item>
      </el-form>
    </div>

    <div slot="footer">
      <el-button @click="handleClose">取 消</el-button>
      <el-button type="primary" @click="submitClick">驳 回</el-button>
    </div>
  </el-dialog>
</template>

<script type="text/ecmascript-6">


  export default {
    name: 'RefuseLoanDialog',
    props: {
      dialogVisible: {
        type: Boolean
      },
      loanNo: {
        type: String,
        required: true
      }
    },
    data() {
      return {
        contact: {},
        memo: '',
        visible: this.$props.dialogVisible,
      }
    },
    methods: {
      submitClick() {




        this.$$post('/loanRecord/refuse', {loanNo: this.loanNo, memo: this.memo}).then(res => {
          if (res.data.code < 1) {
            this.$message.error(res.data.msg);
            return
          }
          this.$message({message: '操作成功', type: 'success'});
          this.handleClose();
        })

      },
      /** 关闭处理 */
      handleClose() {
        this.visible = false;
        setTimeout(() => {
          this.$emit('update:dialogVisible', false)
        }, 100);
        window.location.reload();
      }
    }
  }
</script>
<style lang="stylus" rel="stylesheet/stylus">

  .client-contact-dialog {
    .input {
      width 60%
      margin auto
    }
  }

</style>
