<!--
 * @Descripttion: 当前组件信息
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2019-11-15 10:10:08
 * @LastEditors: 无尘
 * @LastEditTime: 2019-11-15 11:46:16
 -->
<!--
<point-log></point-log>

import pointLog from '@/components/data-details/point-log.vue';
-->
<template>
  <div class="point-log">
    <el-table class="select-table" ref="multipleTable" :data="tableData" tooltip-effect="dark" :style="{ width: '100%', minHeight: tableH }">
      <el-table-column prop="" label="奖励时间" show-overflow-tooltip>
        <template slot-scope="scope">{{ scope.row.phoneNumber || '--' }}</template>
      </el-table-column>
      <el-table-column prop="" label="奖励来源" show-overflow-tooltip>
        <template slot-scope="scope">{{ scope.row.storeName || '--' }}</template>
      </el-table-column>
      <el-table-column label="受邀人信息" show-overflow-tooltip>
        <template slot-scope="scope">
          <div class="cell">
            <img src="" alt="" />><span class="font-14 color-606266">{{ scope.row.name || '--' }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="" label="奖励额度" show-overflow-tooltip>
        <template slot-scope="scope">{{ scope.row.storeName || '--' }}</template>
      </el-table-column>
    </el-table>
    <div class="block common-wrap__page text-right m-t-24" v-if="tableData.length != 0">
      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[20, 40, 60, 80]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"> </el-pagination>
    </div>
  </div>
</template>
<script>
import { getRequest } from '@/api/api';
import errMsg from '@/common/js/error';
export default {
  name: 'point-log',
  data() {
    return {
      // 分页参数
      tableData: [],
      currentPage: 1,
      pageSize: 20,
      total: 0
    };
  },
  methods: {
    /**
     * 分页---页码变化
     */
    handleSizeChange(val) {
      const that = this;
      that.pageSize = val;
      that.getTableList();
    },

    /**
     * 分页---当前页变化
     */
    handleCurrentChange(val) {
      const that = this;
      that.currentPage = val;
      that.getTableList();
    },

    /**
     * 获取列表数据
     */
    getTableList() {
      const that = this;
      let para = {
        activityId: that.$route.query.activityId,
        pageNum: that.currentPage,
        pageSize: that.pageSize,
      };
      getRequest('/sharing-core-web/pag-activity-invited-log', para)
        .then(res => {
          let resData = res.data;
          if (resData.errorCode == 1) {
            that.tableData = resData.result.result || [];
            that.total = resData.result.totalCount;
            return false;
          }
          errMsg.errorMsg(resData);
        })
        .catch(function(error) {
          that.$message.error({
            duration: 1000,
            message: error.message
          });
        });
    }
  }
};
</script>
<style lang="less" scoped>
.point-log {
  width: 100%;
}
</style>
