<template>
  <el-dialog
    title="门票详情"
    :visible.sync="visible"
    width="900px"
    @close="handleClose">
    <el-table
      :data="tableData"
      border
      stripe>
      <el-table-column
        prop="ticketTypeName"
        label="票种名称">
      </el-table-column>

      <el-table-column
        prop="ticketNo"
        label="票号">
      </el-table-column>

      <el-table-column
        prop="refund_time"
        label="检票时间">
        <template slot-scope="scope">
          <span v-if="scope.row.check_time && scope.row.status==='USED'">{{ scope.row.check_time | formatTime }}</span>
        </template>
      </el-table-column>

      <el-table-column
        prop="refund_time"
        label="退票时间">
        <template slot-scope="scope">
          <span v-if="scope.row.refund_time">{{ scope.row.refund_time | formatTime }}</span>
        </template>
      </el-table-column>

      <el-table-column
        prop="is_print"
        label="已打印">
        <template slot-scope="scope">
          <el-tag :type="scope.row.is_print?'success':'info'">{{ scope.row.is_print?'是':'否' }}</el-tag>
        </template>
      </el-table-column>

      <el-table-column
        prop="status"
        label="状态">
        <template slot-scope="scope">
          <el-tag :type="ticketStatus[scope.row.status].color">
            {{ ticketStatus[scope.row.status].label }}
          </el-tag>
        </template>
      </el-table-column>
    </el-table>

    <span slot="footer">
      <el-button
        type="primary"
        @click="visible = false">确 定</el-button>
    </span>
  </el-dialog>

</template>

<script>
import { ticketStatus } from '@/const'

export default {
  data () {
    return {
      ticketStatus,
      visible: false,
      tableData: []
    }
  },
  methods: {
    show (tickets) {
      this.visible = true
      this.tableData = tickets
    },
    handleClose () {
      this.visible = false
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
