<template>
<div class="list">
        <div class="system-table-search">
      <div class="flex-h">
        <div class="flex-item flex-h">
          <el-button size="mini" type="success" @click='activityLiest'>返回</el-button>
        </div>
      </div>
      <div class="moreFilter"></div>
    </div>
  <el-table
    :data="list || []"
    style="width: 100%">
    <el-table-column
      prop="name"
      label="姓名">
    </el-table-column>
    <el-table-column
      prop="phone"
      label="手机号">
    </el-table-column>
    <el-table-column
      prop="createDate"
      label="报名时间">
      <template slot-scope="scope">
        <span>{{ formateDate(scope.row.createDate)}}</span>
      </template>
    </el-table-column>
  </el-table>
  <el-pagination
    small
    style="margin-top:10px;"
    layout="prev, pager, next"
    :current-page.sync="filterData.pageNum"
    :pageSize="filterData.pageSize"
    :total="filterData.total || 0"
    @current-change="getPageList" >
  </el-pagination>
</div>
</template>

<script>
import dayjs from 'dayjs'
import { createNamespacedHelpers } from "vuex";
const { mapActions: mapActivity } = createNamespacedHelpers("activity");

export default {
  name: "consultant-list",
  data() {
    return {
      filterData: {
        name: "",
        phone: "",
        buildingId:'',
        pageNum:1,
        pageSize:10,
        total:0,
        dynamicId:'',
      },
      list:[],
    };
  },
  computed: {},
  methods: {
    ...mapActivity([
        "getSignList"
    ]),
    getList() {
      this.getSignList(this.filterData,this.filterData.pageSize,this.filterData.pageNum).then(res => {
          this.list = res.list.data
          this.filterData.pageSize =res.pageSize 
          this.filterData.pageNum =res.pageNum
          this.filterData.total =res.total
        }).catch(err => {
          this.$notify.error(err.msg || err.message);
        });
    },
    // 活动列表
    activityLiest(){
     this.$router.push({ name: "activity-list" });
    },
    getPageList(){
       this.getList();
    },
    formateDate(dt) {
      return !dt ? '' : dayjs(dt).format('YYYY-MM-DD HH:mm')
    },
  },
  created() {
    this.filterData.dynamicId = this.$route.query.id
    this.getList();
  }
};
</script>

<style lang="scss" scoped>
.list {
  .header {
    width: 50px;
    height: 50px;
    border-radius: 50%;
  }
}
.system-table-search {
  width: calc(100% - 40px);
  margin: 20px auto 0;
}

.system-table-search li {
  margin-right: 20px;
}

.system-table-search ul {
  font-size: 0;
  white-space: nowrap;
}

.system-table-search ul > li {
  display: inline-block;
}

.flex-h {
  display: flex;
  align-items: center;
}

.flex-item {
  flex: 1;
  -webkit-flex: 1;
  position: relative;
  overflow: hidden;
}
</style>
