<template>
  <div style="box-sizing: border-box; padding: 20px">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>配件配置</span>
      </div>
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="空调">
          <div style="width: 100%; display: flex; align-items: center">
            <div style="width: 240px"><el-input v-model="form.priceRate1"></el-input></div>
            <span>倍</span>
            <div style="margin-left: 10px; color: red">销售价格倍率设置，需大于等于1</div>
          </div>
        </el-form-item>
        <el-form-item label="生活电器">
          <div style="width: 100%; display: flex; align-items: center">
            <div style="width: 240px"><el-input v-model="form.priceRate2"></el-input></div>
            <span>倍</span>
            <div style="margin-left: 10px; color: red">销售价格倍率设置，需大于等于1</div>
          </div>
        </el-form-item>
        <el-form-item label="冰箱">
          <div style="width: 100%; display: flex; align-items: center">
            <div style="width: 240px"><el-input v-model="form.priceRate3"></el-input></div>
            <span>倍</span>
            <div style="margin-left: 10px; color: red">销售价格倍率设置，需大于等于1</div>
          </div>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">保存</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>

<script>
import { partsBaseConfigEdit, partsBaseConfig } from '@/api/partsSalesRatio.js'
export default {
  data() {
    return {
      form: {
        priceRate1: '',
        priceRate2: '',
        priceRate3: ''
      }
    }
  },
  created() {
    partsBaseConfig().then(res => {
      this.form = res.data
    })
  },
  methods: {
    onSubmit() {
      partsBaseConfigEdit(this.form),
        then(res => {
          this.$message({ type: 'success', message: `设置成功!` })
        })
    }
  }
}
</script>

<style lang="scss" scoped></style>
