<template>
  <div class="subPage">
    <form class="mainForm">
      <ul>
        <li class="flex-h">
          <span>选择案场：</span>
          <div class="flex-item">
            <div style="width:50%">
              <el-select v-model="CaseId" placeholder="请选择">
                <el-option
                  v-for="item in cases"
                  :key="item.CaseId"
                  :label="item.CaseName"
                  :value="item.CaseId">
                </el-option>
              </el-select>
            </div>
          </div>
        </li>
        <li class="flex-h">
          <span>VIP卡数量：</span>
          <div class="flex-item">
            <div style="width:50%">
              <el-input
                placeholder="请输入VIP卡数量"
                v-model="postData.CardNum"
                clearable>
              </el-input>
            </div>
          </div>
        </li>
        <li class="flex-h">
          <span>价格：</span>
          <div class="flex-item">
            <div style="width:50%">
              <el-input
                placeholder="请输入价格"
                v-model="postData.Price"
                clearable>
              </el-input>
            </div>
          </div>
        </li>
        <li style="text-align:center">
          <el-button type="primary" size="mini" @click="submit">保存</el-button>
          <el-button type="danger" size="mini" @click="cancel">取消</el-button>
        </li>
      </ul>
    </form>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: '',
  data () {
    return {
      postData: {
        CardNum: '', // 卡数量
        Price: '', // 价格
        CaseId: '', // 案场id
      }
    }
  },
  computed: {
    ...mapState({
      cases: x => x.app.cases.list,
      defaultCaseId: x => x.app.cases.default,
      OrgId: x => x.app.user.OrgId,
    }),
    CaseId: {
      get () {
        return this.postData.CaseId === '' ? this.defaultCaseId || '' : this.postData.CaseId
      },
      set (val) {
        this.postData.CaseId = val
      }
    }
  },
  created () {
    this.initData()
  },
  components: {},
  methods: {
    initData () { // 数据初始化
      // this.$ajax(this.$api.channelManager.getChannelInfo.url, {
      //   method: this.$api.channelManager.getChannelInfo.method,
      //   urlData: { channelId: this.$route.query.id }
      // }).then(res => {
      //   this.postData = res
      // })
    },
    submit () { // 提交数据
    },
    cancel () {
      this.$router.push({ name: 'vipList' })
    }
  },
  mounted () { }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
</style>
