<template>
  <div class="tableBox">
    <div class="block-title">
      导游：{{ info.guide }}
    </div>
    <el-table
      border
      stripe
      :data="tableData">
      <el-table-column
        prop="key"
        label="票种"></el-table-column>
      <el-table-column
        prop="value"
        label="数量"></el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  props: {
    info: {
      type: Object,
      default: () => {}
    }
  },
  data () {
    return {
      visible: false,
      tableData: []
    }
  },
  watch: {
    visible (val) {
      if (val && this.info) {
        let tableData = []
        Object.keys(this.info).forEach(key => {
          if (key !== 'guide' && key !== 'travel_agency' && key !== '总计') {
            tableData.push({
              key: key,
              value: this.info[key]
            })
          }
        })
        tableData.push({
          key: '总计',
          value: this.info['总计']
        })
        this.tableData = tableData
      }
    }
  }
}
</script>
