<template>
  <div class="container">
    <!-- 选择图片的弹框 -->
    <el-dialog :title="collectFansDlgText" :visible.sync="iscollectFansDlgShow" width="50%" :before-close="handleClose" draggable :close-on-click-modal="false" :modal-append-to-body="false" center>
      <div>
        <el-table :data="tableData" style="width: 100%; margin-bottom: 20px" border>
          <el-table-column prop="RealName" align="center" label="姓名"></el-table-column>
          <el-table-column prop="CompanyName" align="center" label="公司名称"></el-table-column>
          <el-table-column prop="SellerName" align="center" label="所属销售"></el-table-column>
          <el-table-column width="160" prop="CreateTime" align="center" :label="this.collectFansDlgText == '收藏详情' ? '收藏时间' : '关注时间'"></el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="handleClose">关闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { raiInterface } from "@/api/api.js";

export default {
  name: "",
  components: {},
  props: {
    iscollectFansDlgShow: {
      type: Boolean,
      default: false,
    },
    collectFansDlgText: {
      type: String,
      default: "",
    },
    collectFansDlgItem: {
      type: Object,
      default: "",
    },
  },
  data() {
    return {
      tableData: [],
    };
  },
  computed: {},
  watch: {
    iscollectFansDlgShow: {
      handler(newVal) {
        newVal && this.getTableList();
      },
    },
  },
  created() {},
  mounted() {},
  methods: {
    // 关闭弹框
    handleClose() {
      this.$emit("update:iscollectFansDlgShow", false);
      this.$emit("update:collectFansDlgText", "");
      this.$emit("update:collectFansDlgItem", {});
    },
    // 获取表格数据
    async getTableList() {
      const res =
        this.collectFansDlgText == "收藏详情"
          ? await raiInterface.getYanxuanSpecialCollect({
              SpecialId: this.collectFansDlgItem.Id,
            })
          : await raiInterface.getYanxuanSpecialFans({
              SpecialAuthorId: this.collectFansDlgItem.Id,
            });
      if (res.Ret === 200) {
        this.tableData = res.Data.List || [];
      }
    },
  },
};
</script>
<style scoped lang="scss"></style>
