<template>
  <div v-loading="loading">
    <div class="white-box">
      <el-form ref="form" :model="form" label-width="150px" style="width:500px;">
        <el-form-item label="会员编号">
          <el-input v-model="form.userName"></el-input>
        </el-form-item>
        <el-form-item label="会员姓名">
          <el-input v-model="form.realName"></el-input>
        </el-form-item>
        <el-form-item label="身份证号">
          <el-input v-model="form.idCard" maxlength="18"></el-input>
        </el-form-item>
        <el-form-item label="注册类型">
          <el-select v-model="form.regType" placeholder="请选择该注册类型">
            <el-option v-for="(item,key) in regTypes" :label="item.TYPE_NAME" :value="item.ID"
                       :key="item.ID"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="提现金额">
          <el-input v-model="form.applyAmount" type="number"></el-input>
        </el-form-item>
        <el-form-item label="备注">
          <el-input v-model="form.createRemark"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit" :loading="submitButtonStat">提交</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
  import Vue from 'vue'
  import store from '@/utils/vuexStore'
  import network from '@/utils/network'
  import tool from '@/utils/tool'

  export default {
    name: 'finance_withdraw-add',
    created() {

    },
    mounted() {
      network.getData('finance/withdraw-add').then(response => {
        this.regTypes = response.regTypes
        this.loading = false
      })
    },
    data() {
      return {
        form: {
          userName: null,
          realName: null,
          idCard: null,
          regType: null,
          applyAmount: null,
          createRemark: null
        },
        accountType: null,
        regTypes: null,
        loading: true,
        submitButtonStat: false,
      }
    },
    methods: {
      onSubmit() {
        this.submitButtonStat = true
        let path = 'finance/withdraw-add'
        network.postData(path, this.form).then(response => {
          this.$message({
            message: response,
            type: 'success'
          })
          this.submitButtonStat = false
          this.$router.go(-1)
        }).catch(response => {
          this.submitButtonStat = false
        })
      },
    }
  }
</script>

<style scoped>

</style>