<!--  -->
<template>
  <div class="m-core" style="margin-bottom: 18px;overflow: hidden;">
    <el-alert
        title="云教室定价"
        type="info"
        :closable="false"
        style="margin-bottom: 20px"
      ></el-alert>
      <el-col :lg="12" :md="18" :sm="18" :xs="24">
        <el-table :data="dataList"
                  style="width:100% !important;"
                  :header-cell-style="{background:'#EDEEF0',color:'#444'}">
          <el-table-column label="流量包">
            <template slot-scope="scope">
              {{ scope.row.minuteUpLimit || 0 }}分钟
            </template>
          </el-table-column>
          <el-table-column prop="contractPrice" label="合同价">
            <template slot-scope="scope">
              <el-input v-model.trim="scope.row.contractPrice" placeholder="请输入合同价" type="number"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="price" label="原价（元）">
          </el-table-column>
        </el-table>
      </el-col>
  </div>
</template>

<script>

import { queryPage as cloudQueryPage } from '@/views/platformManager/cloudTrafficPackage/api'
export default {
  props: ['type'],
  data () {
    const query = this.$route.query
    return {
      payType: query.type,
      dataList: [],
    };
  },
  mounted () {
    this.__init()
  },
  computed: {
    isDisabled() {
      return this.type == 'setting' ? true : false
    }
  },
  methods: {
    async __init() {
      try {
        const res = await cloudQueryPage({ page: 1, rows: 999 })
        const result = res.data?.rows || []
        for(let item of result) {
          this.dataList.push({
            id: item.id,
            minuteUpLimit: item.minuteUpLimit,
            price: item.price,
            contractPrice: null, // 合同价
          })
        }
      } catch(e) {
        console.log(e)
      }
    },
    onSubmit() {
      return true
      // let status = false
      // this.$refs.form.validate(_ => {
      //   status = _
      // })
      // return status
    },
    getValues() {
      return this.dataList
    },
  },
};
</script>
<style lang='scss' scoped>


</style>
