<template>
<div class="app-container calendar-list-container">
  <!-- 筛选条件 -->
  <div class="filter-container">
  
    <el-button class="filter-item" type="primary" v-waves icon="search" @click="handleSearch">搜索</el-button>
    <el-button class="filter-item pull-right" type="success" icon="edit" @click="handleCreate">添加</el-button>
  </div>

  <!-- 列表数据 -->
  <Pagination uri="/venue/prices" :request-params="params" ref="pagination">

      <!-- 场馆价格 -->
      <el-table-column align="center" label="场馆价格">
        <template scope="scope">
          <span>{{scope.row.price}}</span>
        </template>
      </el-table-column>

      <!-- 场馆ID -->
      <el-table-column align="center" label="场馆ID">
        <template scope="scope">
          <span>{{scope.row.venueId}}</span>
        </template>
      </el-table-column>

      <!-- 场馆类型 -->
      <el-table-column align="center" label="场馆类型">
        <template scope="scope">
          <span>{{scope.row.venueTye}}</span>
        </template>
      </el-table-column>

      <!-- 起始时间 -->
      <el-table-column align="center" label="起始时间">
        <template scope="scope">
          <span>{{scope.row.starTime}}</span>
        </template>
      </el-table-column>

      <!-- 结束时间 -->
      <el-table-column align="center" label="结束时间">
        <template scope="scope">
          <span>{{scope.row.endTime}}</span>
        </template>
      </el-table-column>

      <!-- 平台来源 -->
      <el-table-column align="center" label="平台来源">
        <template scope="scope">
          <span>{{scope.row.platformId}}</span>
        </template>
      </el-table-column>

      <!-- 创建时间 -->
      <el-table-column align="center" label="创建时间">
        <template scope="scope">
          <span>{{scope.row.createdTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
        </template>
      </el-table-column>

    <el-table-column label="操作" align="center" width="150">
      <template scope="scope">
        <el-button size="small" type="text" @click="handleEdit(scope.row.id)">编辑</el-button>
        <el-button size="small" type="text" class="danger" @click="handleDelete(scope.row)">删除</el-button>
      </template>
    </el-table-column>
  </Pagination>
</div>
</template>

<script>
import { remove } from '@/api//venue/price'
import waves from '@/directive/waves.js'// 水波纹指令
import Pagination from '@/components/Pagination'

export default {
  name: 'venuePrice_list',
  components: { Pagination },
  directives: {
    waves
  },
  data() {
    return {
      params: {
      }
    }
  },
  created() {
  },
  methods: {
    /**
     * 搜索场馆对应价格表
     */
    handleSearch() {
      this.$refs.pagination.pageRequest()
    },

    /**
     * 编辑场馆对应价格表
     */
    handleEdit(id) {
      this.$router.push({ path: '/venue/price/edit', query: { id: id }})
    },

    /**
     * 创建场馆对应价格表
     */
    handleCreate() {
      this.$router.push({ path: '/venue/price/edit' })
    },

    /**
     * 删除场馆对应价格表
     */
    handleDelete(row) {
      this.$confirm('确认删除该场馆对应价格表？').then(_ => {
        remove(row.id).then(response => {
          this.$refs.pagination.removeItem(row)
        })
      }).catch(_ => {})
    }
  }
}
</script>

