<!--  -->
<template>
  <div class="m-core">
    <el-alert
        title="手续费设置"
        type="info"
        :closable="false"
        style="margin-bottom: 20px"
      ></el-alert>
      <el-form ref="form" :model="form" label-width="120px"  :inline="true">
        <el-form-item label="手续费费率" prop="chargeRate"
          :rules="[{ required: true, message: '请输入手续费费率', trigger: 'blur' },
            { type: 'number', message: '手续费费率必须为数字值' }]">
          <el-input
            
            :disabled="isDisabled"
            v-model.number="form.chargeRate"
            placeholder="请输入手续费费率"
            style="width: 238px;"
            type="number"
          >
            <div slot="append">‰</div>
          </el-input>
        </el-form-item>
      </el-form>
  </div>
</template>

<script>
export default {
  props: ['type', 'data'],
  data () {
    return {
      form: {
        id: null,
        chargeRate: null
      }
    };
  },
  computed: {
    isDisabled() {
      return this.type == 'setting' ? true : false
    }
  },
  mounted () {
    if(this.data) {
      this.form.id = this.data.id
      this.form.chargeRate = this.data.chargeRate
    }
  },
  methods: {
    onSubmit() {
      let status = false
      this.$refs.form.validate(_ => {
        status = _
      })
      return status
    },
    getValues() {
      return this.form
    },
  },
};
</script>
<style lang='scss' scoped>


</style>
