<template>
  <div class="tableBox">
    <el-table
      border
      stripe
      :data="memberCount">
      <el-table-column
        label="今日卡检票数据"
        label-class-name="table-title"
      >
        <el-table-column
          prop="ticketTypeName"
          label="类别">
        </el-table-column>
        <el-table-column
          prop="count"
          label="次数">
        </el-table-column>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import moment from 'moment'
import { getMemberCheckStatistics } from '@/api/member'

export default {
  data () {
    return {
      memberCount: [], // 卡通行人数
      startDate: new Date(moment().startOf('day').format('YYYY-MM-DD HH:mm:ss')),
      endDate: new Date(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'))
    }
  },
  created () {
    this.getMemberCheckStatistics()
  },
  methods: {
    getMemberCheckStatistics (params) {
      getMemberCheckStatistics({
        keyList1: [1, 2, 3],
        startDate: this.startDate,
        endDate: this.endDate
      }).then(res => {
        let obj = res.data[0]
        let keys = res.memberTypeList
        this.memberCount = keys.map(i => {
          return {
            'ticketTypeName': i,
            'count': obj[i]
          }
        })
      })
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
