<template>
  <div>
    <el-form
      class="searchBox"
      ref="form"
      :model="form"
      :inline="true"
    >
      <div class="block-title">
        查询条件
      </div>
      <el-form-item
        label="票号"
        prop="keyWords1"
      >
        <QRReader v-model="form.keyWords1"></QRReader>
      </el-form-item>
      <el-button
        @click="reset"
      >
        重置
      </el-button>
      <el-button
        type="primary"
        @click="getData"
      >
        搜索
      </el-button>
    </el-form>
    <el-table
      stripe
      border
      v-loading="loading"
      :data="tableData"
    >
      <el-table-column
        prop="ticket_type_name"
        label="票种名称"
      >
      </el-table-column>
      <el-table-column
        label="是否激活"
      >
        <template slot-scope="scope">
          {{ scope.row.ticketInStockList[0].is_active | yesOrNo }}
        </template>
      </el-table-column>
      <el-table-column
        label="激活时间"
      >
        <template slot-scope="scope">
          {{ scope.row.ticketInStockList[0].activation_time | formatTime }}
        </template>
      </el-table-column>
      <el-table-column
        label="是否导出"
      >
        <template slot-scope="scope">
          {{ scope.row.ticketInStockList[0].is_print | yesOrNo }}
        </template>
      </el-table-column>
      <el-table-column
        label="导出时间"
      >
        <template slot-scope="scope">
          {{ scope.row.ticketInStockList[0].print_time | formatTime }}
        </template>
      </el-table-column>
      <el-table-column
        prop="status"
        label="状态"
      >
        <template slot-scope="scope">
          {{ scope.row.ticketInStockList[0].status | ticketStatus }}
        </template>
      </el-table-column>
      <el-table-column
        prop="creator"
        label="创建人"
      >
      </el-table-column>
      <el-table-column
        label="入库时间"
      >
        <template slot-scope="scope">
          {{ scope.row.create_time | formatTime }}
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import { getTicketInStockLog } from '@/api/ticketType'
export default {
  data () {
    return {
      form: {
        keyWords1: '',
        keyWords2: '',
        keyWords3: '',
        pageNum: 1,
        pageSize: 10,
        startDate: '',
        endDate: ''
      },
      loading: false,
      total: 0,
      tableData: []
    }
  },
  methods: {
    reset () {
      this.$refs.form.resetFields()
    },
    getData () {
      this.loading = true
      getTicketInStockLog(this.form).then(res => {
        this.tableData = res.list
      }).finally(() => {
        this.loading = false
      })
    }
  }
}
</script>
