<template>
  <div>
    <el-page-header
      @back="goBack"
      class="header"
      :content="$t('分享统计详情')"
    ></el-page-header>
    <div class="app-container">
      <!-- 列表 -->
      <el-table v-loading="loading" :data="list">
        <el-table-column :label="$t('序号')" align="center" prop="id" />
        <el-table-column
          :label="$t('操作人')"
          align="center"
          prop="memberName"
        />
        <el-table-column
          :label="$t('分类')"
          align="center"
          :prop="isChinese ? 'typeZh' : 'typeEn'"
        />
        <el-table-column :label="$t('分享ID')" align="center" prop="code" />
        <el-table-column
          :label="$t('标题')"
          align="center"
          :prop="isChinese ? 'titleZh' : 'titleEn'"
        />
        <el-table-column
          :label="$t('操作时间')"
          align="center"
          prop="createTime"
          width="180"
        >
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.createTime) }}</span>
          </template>
        </el-table-column>
        <el-table-column
          :label="$t('点击时间')"
          align="center"
          prop="createTime"
          width="180"
        >
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.triggerTime) || "--" }}</span>
          </template>
        </el-table-column>
        <el-table-column :label="$t('积分')" align="center" prop="score" />
      </el-table>
      <!-- 分页组件 -->
      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.page"
        :limit.sync="queryParams.rows"
        @pagination="getList"
      />
    </div>
  </div>
</template>

<script>
import { getShareRecordDetails } from "@/api/ecw/memberManagement";
import { getDictDatas, DICT_TYPE } from "@/utils/dict";
export default {
  name: "details",
  components: {},
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 字典类型列表
      list: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      dateRangeCreateTime: [],
      // 查询参数
      queryParams: {
        page: 1,
        rows: 10,
        id: "",
      },
      // 表单参数
      form: {},
      // 表单校验
    };
  },
  created() {
    this.queryParams.id = this.$route.query.id;
    this.getList();
  },
  computed: {
    isChinese() {
      return this.$i18n.locale === "zh_CN";
    },
  },
  methods: {
    goBack() {
      this.$router.back();
    },
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 处理查询参数
      let params = { ...this.queryParams };
      // 执行查询
      getShareRecordDetails(params).then((response) => {
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    /** 取消按钮 */

    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.page = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRangeCreateTime = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
  },
};
</script>
<style scoped>
.header {
  padding-top: 40px;
  padding-left: 20px;
}
</style>
