<template>
    <div class="l_group">
        <div class="headbox">
            <div class="r_btn">
                <div class="btn" @click="goto('/pagesB/orderingfood/activationcode')">生成激活码</div>
            </div>
            <div class="tit">团队人数</div>
            <div class="usernum dinB">{{ num.team }}</div>
            <div class="tabs flex_r flex_jse">
                <div class="tab" @click="getTeamList(s)" :class="{active:type==s}" v-for="(i,s) in num.tab" :key="s">{{ i }}</div>
            </div>
        </div>
        <div class="list">
            <div class="user_info flex_r flex_jb" v-for="(i,s) in users" :key="s">
                <img class="userimg" :src="i.head_pic" />
                <div class="u_info">
                    <div class="p1">{{ i.nickname || num.tab[type] }}</div>
                    <div class="p1">手机号：{{ i.mobile }}</div>
                    <div class="p3">加入时间：{{ i.create_time }}</div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import { post } from "@/request/api.js";
export default {
    name: "l_group",
    props: {},
    components: {},
    data() {
        return {
            num: {},
            type: '',
            users: []
        };
    },
    methods: {
        getTeamNum() {
            post("local/getTeamNum").then(res => {
                if (res.code == 0) {
                    this.num = res.data
                    for (const key in res.data.tab) {
                        this.getTeamList(key);
                        break;
                    }
                }
            })
        },
        getTeamList(type) {
            this.type = type;
            post("local/getTeamList",{type}).then(res => {
                if (res.code == 0) {
                    this.users = res.data
                }
            })
        },
    },
    onLoad(da) {
        this.getTeamNum();
    },
    onShow() {},
    mounted() {},
};
</script>
<style scoped lang='scss'>
.headbox {
    background-color: #18bb88;
    height: 400rpx;
    padding: 30rpx 36rpx;
    position: relative;

    .r_btn {
        text-align: right;
        margin-bottom: 20rpx;
    }

    .btn {
        display: inline-block;
        color: #fff;
        font-size: 28rpx;
        padding: 6rpx 32rpx;
        border-radius: 8rpx;
        background-color: #d3aa79;
    }

    .tit {
        color: #fff;
        font-size: 40rpx;
    }

    .usernum {
        color: #fff;
        font-size: 56rpx;
        margin-top: 30rpx;
        text-align: center;
    }
}
.tabs{
    width: 100%;
    position: absolute;
    left: 0;
    bottom: 0;
    .tab{
        padding: 18rpx 60rpx;
        background-color: #d3aa79;
        border-radius: 16rpx 16rpx 0 0;
        color: #fff;
        &.active{
            background-color: #fff;
            color: #000;
        }
    }
}
.user_info{
    padding: 38rpx 32rpx;
    border-bottom: 1px solid #e5e5e5;
    .userimg{
        width: 160rpx;
        height: 160rpx;
        border-radius: 10rpx;
    }
    .u_info{
        width: calc(100% - 160rpx);
        padding: 4rpx 0 4rpx 30rpx;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        .p1{
            font-size: 36rpx;
        }
        .p3{
            font-size: 28rpx;
            color: #999;
        }
    }
}
</style>