<template>
  <div v-loading="loading">
    <el-table :data="retData.Data" size="medium" :height="$getHeight(100)" row-key="Id" border>
      <el-table-column prop="CreateTime" label="注册时间"></el-table-column>
      <el-table-column prop="LoginCode" label="会员号"></el-table-column>
      <el-table-column prop="RestAmount" label="测试限额/领用数">
        <template slot-scope="scope">        
          {{scope.row.TestCountLimit==0?'3':scope.row.TestCountLimit}}/{{scope.row.UseTestCount==0?'--':scope.row.UseTestCount}}
        </template>
      </el-table-column>
      <el-table-column prop="Name" label="姓名"></el-table-column>
      <el-table-column prop="id_code" label="身份证号"></el-table-column>
      <el-table-column prop="is_verify" label="实名状态"></el-table-column>
      <el-table-column label="操作" width="400px">
        <template slot-scope="scope">
          <span v-if="scope.row.ManagerId == 0" class="handel cursor edit" @click="getUser(scope.row)">领取用户</span>
          <span v-if="scope.row.ManagerId != 0">已领取</span>
        </template>
      </el-table-column>
    </el-table>
    <div class="block" style="text-align:center;">
     <p>共 {{retData.TotalCount}} 条</p>
    </div>
  </div>
</template>
<script>
export default {
  name: "userregister",
  data() {
    return {
      isRoot:false,
      loading: false,
      retData: { TotalCount: 0, Data: [] },
    };
  },
  created () {
    this.$store.commit('setCurrentNav', '用户管理>>领取用户')
    var currentUser = this.$local.getUserByCache()
    this.IsRoot = currentUser.Manager.IsRootUser
    this.get()

  },
  methods: {
    get() {
      this.$api.get(this.$api.phpURL + "user/user/getRegisterList").then(res => {
        this.retData = res;
      });
    },
    getUser(r) {
      this.$api
        .post(this.$api.phpURL + "user/user/getNewUser", r.Id)
        .then(res => {
          this.get();
        });
    },
  }
}
</script>
<style scoped>
</style>
