<template>
  <div v-loading="loading">
    <div class="white-box">
      <el-form ref="form" :model="form" label-width="250px" class="form-page">
        <el-form-item label="类型名称">
          <el-input v-model="form.typeName"></el-input>
        </el-form-item>
        <el-form-item label="是否启用">
          <el-switch v-model="form.isEnable"></el-switch>
        </el-form-item>
        <el-form-item label="备注">
          <el-input v-model="form.createRemark"></el-input>
        </el-form-item>
        <el-form-item label="排序">
          <el-input v-model="form.sort" type="number" min="1"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit" :loading="submitButtonStat">Confirm</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_deal-type-add',
    created() {

    },
    data() {
      return {
        form: {
          typeName: null,
          isEnable: true,
          createRemark: null,
          sort: 1,
        },
        loading: false,
        submitButtonStat: false,
      }
    },
    methods: {
      onSubmit() {
        this.submitButtonStat = true
        let path = 'finance/deal-type-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>
