<template>
  <div class="table-box">
    <div class="block-title">
      渠道列表
    </div>
    <el-table
      ref="table"
      border
      stripe
      v-loading="loading"
      :data="tableData">
      <el-table-column
        prop="channel_name"
        label="名称">
      </el-table-column>

      <el-table-column
        prop="auto_invoice"
        label="自动开发票">
      </el-table-column>

      <el-table-column
        prop="auto_invoice_time"
        label="自动开发票时间">
      </el-table-column>

      <el-table-column
        prop="url"
        label="接口地址">
      </el-table-column>

      <el-table-column
        prop="allow_days"
        label="允许开发票天数">
      </el-table-column>

      <el-table-column
        label="操作"
        width="100"
        fixed="right">
        <template slot-scope="scope">
          <el-button
            type="primary"
            size="small"
            @click="$refs.editChannel.show(scope.row,'edit')"
          >
            编辑
          </el-button>
        </template>
      </el-table-column>
    </el-table>

    <EditChannel
      ref="editChannel"
      @update="getList"></EditChannel>
  </div>
</template>
<script>
import { listInvoiceChannel } from '@/api/ticketType'
import EditChannel from './EditChannel'

export default {
  components: {
    EditChannel
  },
  data () {
    return {
      loading: false,
      tableData: []
    }
  },
  methods: {
    getList () {
      this.loading = true
      listInvoiceChannel({}).then(res => {
        this.tableData = res?.data
      }).finally(() => {
        this.loading = false
      })
    }
  }
}
</script>

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