<template>
  <div>
    <el-table
      border
      :data="memberHistoryInfoTableData">
      <el-table-column
        label="会员ID"
        prop="member_id">
      </el-table-column>
      <el-table-column
        label="创建时间"
        prop="createTime">
        <template slot-scope="prop">
          {{ prop.row.createTime | formatTime }}
        </template>
      </el-table-column>
      <el-table-column
        label="会员类型"
        prop="memberTypeName">
      </el-table-column>
      <el-table-column
        label="面值"
        prop="total_money">
        <template slot-scope="prop">
          {{ prop.row.total_money + '元' }}
        </template>
      </el-table-column>
      <el-table-column
        label="交易类型"
        prop="trade_type">
        <template slot-scope="prop">
          {{ judgeTradeType(prop.row.trade_type) }}
        </template>
      </el-table-column>
      <el-table-column
        label="支付渠道"
        prop="payChannel">
      </el-table-column>
      <el-table-column
        label="支付状态"
        prop="pay_status">
        <template slot-scope="prop">
          <el-tag
            :type="judgePayStatusLabel(prop.row.pay_status)"
            size="normal"
          >
            {{ judgePayStatus(prop.row.pay_status) }}
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column
        label="地址"
        prop="address">
      </el-table-column>
      <el-table-column
        label="身份证号"
        prop="idcardNo">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  props: {
    memberHistoryInfoTableData: {
      type: Array,
      required: true
    }
  },
  data () {
    return {
      currentPage: 1
    }
  },
  methods: {
    judgeTradeType (value) {
      let judgeTradeType = {
        1: '销售',
        2: '充值',
        3: '结算',
        4: '补卡'
      }
      return judgeTradeType[value] ? judgeTradeType[value] : value
    },
    judgePayStatus (value) {
      let judgePayStatusMap = {
        'WAIT_PAY': '待支付',
        'PAYED': '已支付',
        'CLOSED': '已关闭',
        'CANCELED': '已取消',
        'REFUNDED': '已退款',
        'REFUNDING': '退款中'
      }
      return judgePayStatusMap[value] ? judgePayStatusMap[value] : value
    },
    judgePayStatusLabel (value) {
      let judgePayStatusLabelMap = {
        'WAIT_PAY': 'primary',
        'PAYED': 'success',
        'CLOSED': 'info',
        'CANCELED': 'info',
        'REFUNDED': 'danger',
        'REFUNDING': 'warning'
      }
      return judgePayStatusLabelMap[value] ? judgePayStatusLabelMap[value] : value
    }
  }
}
</script>
