<template>
  <div class="app-container">
    <el-form :model="form" :rules="rules" ref="form" label-width="100px">
      <el-form-item label="关联设备：">
        <el-select v-model="deviceIds" multiple placeholder="请选择关联设备">
          <el-option v-for="item in devOptions" :key="item.value" :label="item.label"
            :value="item.value.toString()" />
        </el-select>
      </el-form-item>
      <el-form-item label="流量名称：">
        <el-input v-model="form.name" placeholder="请输入套餐名称" />
      </el-form-item>
      <el-form-item label="服务类型：">
        <el-select v-model="form.businessType" placeholder="请选择服务类型" :disabled="form.id ? true : false">
          <el-option v-for="item in businessOptions" :key="item.value" :value="item.value"
            :label="item.label" />
        </el-select>
      </el-form-item>
      <el-form-item label="流量套餐：">
        <el-select v-model="form.goodsId" placeholder="请选择流量套餐" :disabled="form.id ? true : false">
          <el-option v-for="(item, index) in goodsOptions" :key="index" :label="item" :value="index" />
        </el-select>
      </el-form-item>
      <el-form-item label="原价：" prop="price">
        <el-input v-model="form.price" placeholder="请输入原价" />
      </el-form-item>
      <el-form-item label="活动价：" prop="discount">
        <el-input v-model="form.discount" placeholder="请输入活动价" />
      </el-form-item>
      <el-form-item label="是否推荐：">
        <el-select v-model="form.isRecommend">
          <el-option v-for="item in recommendOptions" :key="item.value" :label="item.label"
            :value="item.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="排序：" v-if="form.businessType === 5">
        <el-input-number v-model="form.sort" :min="1" />
      </el-form-item>
      <el-form-item>
        <el-button @click="cancel">取消</el-button>
        <el-button type="primary" @click="getSubmit">提交</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { devMixin } from '@/mixin/index'
import { mixin, detailMixin, goodsMixin } from '../mixin/index'
export default {
  mixins: [devMixin, mixin, detailMixin, goodsMixin],
  data() {
    return {
      // 表单
      form: {
        type: 12
      },
    }
  },
  methods: {
    // 取消
    cancel() {
      this.$tab.closeOpenPage("/service/flowPackage");
    }
  }
}
</script>

<style lang="scss" scoped>
.el-form {
  width: 500px;
}
</style>