<template>
  <el-dialog title="提现审核通过确认" :close-on-click-modal="false" :visible.sync="open" width="700px" append-to-body>
    <el-form ref="form" :model="form" :rules="rules" label-width="100px">
      <el-form-item label="打款方式" prop="autoTrans">
        <el-select v-model="form.autoTrans" size="small">
          <el-option key="2" label="手工打款" :value="false" />
          <el-option key="3" label="自动打款（暂不支持）" :value="true" />
        </el-select>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
      <el-button @click="open = false">取 消</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { userWithdrawAuditSuccess } from '@/api/xq/userWithdraw'

export default {
  components: {
  },
  data () {
    return {
      open: false,
      form:{
        id: undefined,
        autoTrans: false,
      },
      // 表单校验
      rules: {
        autoTrans: [
          { required: true, message: "数据不能为空", trigger: "blur" }
        ],
      },
      buttonLoading: false,
    }
  },
  created() {
  },
  methods: {
    init (row) {
      this.open = true;
      this.form.id = row.id
    },
    // 表单提交
    submitForm () {
      this.$refs['form'].validate((valid) => {
        if (valid) {
          this.buttonLoading = true;
          userWithdrawAuditSuccess(this.form).then(data => {
            this.$modal.msgSuccess("审核成功");
            this.buttonLoading = false;
            this.open = false
            this.$emit('refreshDataList')
          }).finally(() => {
            this.buttonLoading = false;
          });
        }
      })
    },
  }
}
</script>
