<!--
 * @Descripttion: 当前组件信息
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2019-10-25 14:05:56
 * @LastEditors: 无尘
 * @LastEditTime: 2019-11-05 10:39:08
 -->
<!--
  <card-record-table :activeTab="activeTab" :tableData="tableData"></card-record-table>
  import cardRecordTable from '@/components/app/card-record-table
 -->

<template>
  <div class="card-record-table m-t-20">
    <el-table class="select-table" ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: calc(100% - 3px);">
      <el-table-column prop="" label="卡券名称" show-overflow-tooltip>
        <template slot-scope="scope">
          {{ scope.row.cardName }}
        </template>
      </el-table-column>
      <el-table-column prop="" label="" width="96">
        <template slot="header" slot-scope="scope">
          <el-tooltip class="item" effect="dark" content="发送卡券数量，包含扫码发券数" placement="right">
            <span style="cursor: pointer;">发送数量<i class="el-icon-info font-12 color-606266"></i></span>
          </el-tooltip>
        </template>
        <template slot-scope="scope">
          {{ scope.row.issuingQuantity }}
        </template>
      </el-table-column>
      <el-table-column prop="" label="领取数量">
        <template slot-scope="scope">{{ scope.row.getedQuantity }}</template>
      </el-table-column>
      <el-table-column prop="" label="领取率">
        <template slot-scope="scope">{{ scope.row.getedRate | percenteNum }}</template>
      </el-table-column>
      <el-table-column prop="" label="使用数量">
        <template slot-scope="scope">
          <div>{{ scope.row.usageQuantity }}</div>
        </template>
      </el-table-column>
      <el-table-column prop="" label="核销率">
        <template slot-scope="scope">
          <div>{{ scope.row.verificationRate | percenteNum }}</div>
        </template>
      </el-table-column>
      <el-table-column prop="" label="销售额">
        <template slot-scope="scope">
          <div>{{ scope.row.saleAmount }}</div>
        </template>
      </el-table-column>
      <el-table-column width="150">
        <template slot="header" slot-scope="scope">
          <el-tooltip class="item" effect="dark" content="导购发送卡券的总人数统计，次日刷新" placement="right">
            <span style="cursor: pointer;">导购发送卡券人数<i class="el-icon-info font-12 color-606266"></i></span>
          </el-tooltip>
        </template>
        <template slot-scope="scope">
          {{ scope.row.sendMemberCount }}
        </template>
      </el-table-column>
      <el-table-column prop="" width="200" label="操作" fixed="right">
        <template slot-scope="scope">
          <el-button type="text" @click="toSendDetail(scope.$index, scope.row, '1')">发送记录</el-button>
          <el-button type="text" @click="toSendDetail(scope.$index, scope.row, '2')">领取记录</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  name: 'card-record-table',
  props: {
    tableData: {
      type: [Array, Object],
      default() {
        return [];
      }
    },
    activeTab: {
      type: [String, Number],
      default() {
        return '52';
      }
    }
  },
  data() {
    return {};
  },
  filters: {
    percenteNum(val) {
      return val > 0 ? Number(val * 100).toFixed(2) + '%' : Number(val).toFixed(2) + '%';
    }
  },
  methods: {
    /**
     * 发送记录
     */
    toSendDetail(index, row, tabType) {
      const that = this;
      that.$router.push(`/${tabType == 1 ? 'cardSendRecord' : 'cardGetRecord'}?activeTab=${that.activeTab}&appIcon=${this.$route.query.appIcon}&coupCardId=${row.coupCardId}`);
    }
  }
};
</script>
<style lang="scss" scoped>
.card-record-table {
  width: 100%;
}
</style>
