<template>
  <div class="app-container">
    <div class="box" v-loading="loading">
      <el-form :inline="true" ref="formRef" :model="form" :rules="rules" class="demo-form-inline">
        <h3>广告奖励金额与兑换豆比例</h3>
        <div class="item" style=" width: 1100px;">
          *赠送兑换豆比例
          <div>
            <el-form-item label="" prop="giftExchangeRatio">
              <!-- <el-input v-model="form.giftExchangeRatio" placeholder=""></el-input> -->
              <el-input-number v-model="form.giftExchangeRatio" controls-position="right" :min="0" :precision="2"></el-input-number>倍
            </el-form-item>
          </div>
          *为广告收益金额的N倍，发放获得兑换豆
        </div>
      </el-form>
      <div class="btnBox">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">保 存</el-button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      form: {
      },
      rules: {
      },
      buttonLoading: false,
      loading: false
    }
  },
  created () {
    // this.getDetails()
  },
  methods: {
    getDetails () {
      this.loading = true
      shopSaleConfigDefault().then(res => {
        this.form = res.data
      }).finally(() => {
        this.loading = false
      })
    },
    submitForm () {
      this.$refs['formRef'].validate((valid) => {
        if (valid) {
          shopSaleConfigSet(this.form).then(res => {
            this.$message({
              message: '提交成功',
              type: 'success'
            })
          })
        }
      })
    }
  }
}
</script>

<style lang='scss' scoped>
h3 {
  font-weight: 700;
}
.item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  font-size: 14px;
  > div {
    margin: 0 10px;
  }
}
.hint {
  font-size: 12px;
  color: red;
}
.btnBox {
  margin: 20px 0 0 100px;
}
.el-form-item {
  margin-bottom: 0;
}
</style>