<template>
  <div id="userAdmin">
    <el-row>
      <el-col :span="24" class="userInfo">
        <el-col :span="24" class="top">
          <span>用户列表</span>
        </el-col>
        <el-col :span="24" class="info">
          <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="待审用户" name="first">
              <el-col :span="24" class="userList" v-for="(item, index) in userList" :key="index">
                <el-col :span="20" class="name"> 登录名称：登录名称 </el-col>
                <el-col :span="4" class="date">
                  2020-02-06
                </el-col>
                <el-col :span="12" class="left">
                  <el-col :span="6" style="margin:0 10px 0 0;">
                    <el-image style="width:110px;height:110px;" :src="item.img_path"></el-image>
                  </el-col>
                  <el-col :span="17" class="leftInfo">
                    <p>{{ item.name }}</p>
                    <p>类别：{{ item.role === '1' ? '管理员' : item.role === '2' ? '个人' : item.role === '3' ? '企业管理员' : '未选择' }}</p>
                    <p>电话：{{ item.phone }}</p>
                  </el-col>
                </el-col>
                <el-col :span="12" class="right">
                  <el-link :underline="false">审核用户</el-link>
                </el-col>
              </el-col>
              <el-col :span="24" class="page">
                <el-pagination
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange"
                  :current-page="currentPage1"
                  layout="total, prev, pager, next, jumper"
                  :total="userListTotal"
                >
                </el-pagination>
              </el-col>
            </el-tab-pane>
            <el-tab-pane label="已审用户" name="second">
              <el-col :span="24" class="userList" v-for="(item, index) in adminList" :key="index">
                <el-col :span="20" class="name"> 登录名称：登录名称 </el-col>
                <el-col :span="4" class="date">
                  2020-02-06
                </el-col>
                <el-col :span="12" class="left">
                  <el-col :span="6" style="margin:0 10px 0 0;">
                    <el-image style="width:110px;height:110px;" :src="item.img_path"></el-image>
                  </el-col>
                  <el-col :span="17" class="leftInfo">
                    <p>{{ item.name }}</p>
                    <p>类别：{{ item.role === '1' ? '管理员' : item.role === '2' ? '个人' : item.role === '3' ? '企业管理员' : '未选择' }}</p>
                    <p>电话：{{ item.phone }}</p>
                  </el-col>
                </el-col>
                <el-col :span="12" class="right">
                  <el-link :underline="false">查看详情</el-link><br />
                  <el-link :underline="false" @click="handleDelete(item.id)">删除用户</el-link>
                </el-col>
              </el-col>
              <el-col :span="24" class="page">
                <el-pagination
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange"
                  :current-page="currentPage2"
                  layout="total, prev, pager, next, jumper"
                  :total="adminListTotal"
                >
                </el-pagination>
              </el-col>
            </el-tab-pane>
          </el-tabs>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'userAdmin',
  props: {
    userList: null,
    userListTotal: null,
    adminList: null,
    adminListTotal: null,
  },
  components: {},
  data: () => ({
    activeName: 'first',
    currentPage1: 1,
    currentPage2: 1,
  }),
  created() {},
  computed: {},
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    handleDelete(id) {
      this.$emit('delete', { id });
    },
  },
};
</script>

<style lang="less" scoped>
p {
  padding: 0;
  margin: 0;
}
.top {
  height: 60px;
  border-bottom: 1px solid #215299;
  line-height: 60px;
}
.top span {
  display: inline-block;
  width: 130px;
  height: 60px;
  text-align: center;
  line-height: 60px;
  background-color: #215299;
  color: #fff;
}
.info {
  padding: 20px;
}
.userList {
  height: 190px;
  border: 1px solid #ccc;
  margin: 0 0 15px 0;
}
.userList .name {
  height: 40px;
  line-height: 40px;
  background-color: #fafafa;
  color: #888;
  padding: 0 10px;
}
.userList .date {
  height: 40px;
  line-height: 40px;
  background-color: #fafafa;
  color: #888;
}
.userList .left {
  height: 110px;
  margin: 19px 0;
  border-right: 2px solid #ccc;
}
.userList .left .leftInfo p {
  margin: 10px 0;
}
.userList .right {
  height: 110px;
  margin: 19px 0;
  padding: 0 30px;
}
.adminList {
  height: 190px;
  border: 1px solid #ccc;
}
.page {
  height: 30px;
  text-align: center;
}
</style>
