<template>
    <div class="right-wrap">
        <div class="myTabs" style="background: #fff;">
            <el-tabs style="padding: 0 20px 40px 20px;" v-model="activeName" @tab-click="handleClick">
                <el-tab-pane label="公司表彰" name="first">
                    <el-empty :image-size="200" v-if="dataList.length < 1"></el-empty>
                    <div v-else class="content-body">
                        <div v-for="(item,index) in dataList" :key="index" class="serie">
                            <div class="badge-icon-list">
                                <div v-for="(childItem,childIndex) in item.recipientsList" :key="childIndex" @click="handleClickCommend(childItem)" class="badge-icon-item">
                                    <div class="badge-item-icon">
                                        <img :src="httpFile + childItem.headImage" style="border-radius: 50%;">
                                    </div> 
                                    <div class="badge-desc">{{ childItem.userName }}</div> 
                                    <div class="obtain-date">
                                        {{ item.title }}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </el-tab-pane>
                <el-tab-pane label="部门表彰" name="second">
                    <el-empty :image-size="200" v-if="dataList.length < 1"></el-empty>
                    <div v-else class="content-body">
                        <div v-for="(item,index) in dataList" :key="index" class="serie">
                            <div class="badge-icon-list">
                                <div v-for="(childItem,childIndex) in item.recipientsList" :key="childIndex" @click="handleClickCommend(childItem)" class="badge-icon-item">
                                    <div class="badge-item-icon">
                                        <img :src="httpFile + childItem.headImage" style="border-radius: 50%;">
                                    </div> 
                                    <div class="badge-desc">{{ childItem.userName }}</div> 
                                    <div class="obtain-date">
                                        {{ item.title }}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </el-tab-pane>
                <el-tab-pane label="客户表彰" name="third">
                    <el-empty :image-size="200" v-if="dataList.length < 1"></el-empty>
                    <div v-else class="content-body">
                        <div v-for="(item,index) in dataList" :key="index" class="serie">
                            <div class="badge-icon-list">
                                <div v-for="(childItem,childIndex) in item.recipientsList" :key="childIndex" @click="handleClickCommend(childItem)" class="badge-icon-item">
                                    <div class="badge-item-icon">
                                        <img :src="httpFile + childItem.headImage" style="border-radius: 50%;">
                                    </div> 
                                    <div class="badge-desc">{{ childItem.userName }}</div> 
                                    <div class="obtain-date">
                                        {{ item.title }}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </el-tab-pane>

            </el-tabs>
        </div>

    </div>
</template>
<script scoped>
import { commendPage } from "@/api/allApi";
export default {
    data() {
        return {
            httpFile:'',
            dataList:[],
            activeName: 'first',
        };
    },
    created() {
        this.getList(32);
    },
    methods: {
        handleClickCommend(val) {
            debugger
            console.log(val);
            this.$router.push({
                path: '/home/commend/commendDetail',
                query: {
                    id: val.commendId,
                    loginId:val.loginId
                }
            });
        },
        getList(val){
            commendPage({type:val}).then(response=>{
                this.httpFile = response.data.data.httpFile;
                this.dataList = response.data.data.items;
            })
        },
        handleClick(tab, event) {
            var name = tab.name;
            if(name=='first'){
                this.getList(32);
            }
            if(name=='second'){
                this.getList(31);
            }
            if(name=='third'){
                this.getList(33);
            }
        },
        
    }
};
</script>
<style scoped>
.right-wrap {
    width: 100%;
}
.myPage {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.gainList_container {
    min-height: 560px;
}
.gainList_container .gains_wrapper {
    position: relative;
    box-sizing: border-box;
    padding-top: 20px;
    padding-left: 20px;
}
.gainList_container .gains_wrapper .list {
    display: flex;
    flex-wrap: wrap;
    margin: -20px 0 0 -20px;
}
.item.isVirtual{
    background: #f7f8fa;
    border: 1px solid #e5e6eb;
}
.item {
    display: flex;
    align-items: center;
    flex: 0 1 auto;
    width: calc(50% - 30px);
    min-width: 410px;
    height: 116px;
    padding-right: 6px;
    background: #fff;
    border: 1px solid #e5e6eb;
    box-sizing: border-box;
    border-radius: 4px;
    margin-right: 20px;
    margin-top: 20px;
}
.item .img-wapper {
    width: 114px;
    height: 114px;
    margin-right: 16px;
    background: #f7f8fa;
    display: flex;
    align-items: center;
    justify-content: center;
}
.item .img-wapper .item-icon {
    max-width: 72px;
    max-height: 72px;
}
.item .main {
    flex: auto;
}
.item .date, .item .goods_name {
    overflow: hidden;
    text-overflow: ellipsis;
}
.item .goods_name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    font-size: 16px;
    line-height: 24px;
    color: #252933;
    padding-bottom: 4px;
}
.item p {
    margin: 0;
}
.item .date {
    white-space: nowrap;
    font-size: 14px;
    line-height: 22px;
    color: #8a919f;
}
.item .buttons {
    margin-top: 8px;
    margin-left: -8px;
    display: flex;
    align-items: center;
}
.item .button-item.actived {
    background: #f2f3f5;
    color: #8a919f;
}
.item .button-item {
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 13px;
    padding: 0 8px;
    height: 26px;
    margin-left: 8px;
    font-weight: 500;
    background: #f2f3f5;
    border-radius: 50px;
    color: #8a919f;
    white-space: nowrap;
    border: none;
}
.item .arrow {
    width: 12px;
    height: 12px;
    margin-left: 2px;
    transform: rotate(-90deg);
}
svg:not(:root) {
    overflow: hidden;
}
.item .button-item svg path {
    fill: currentColor;
}
.status{
    margin-right: 30px;
    font-size: 13px;
}
.status.bottom{
    margin-top: 55px;
}
.status .use-btn {
    color: #1e80ff;
}
.timeline-container{
    margin: 0 auto;
}
.timeline-entry-list{
    margin-right: 17.5rem;
    border-radius: 2px;
    width: 720px;
    position: relative;
}
.entry-list-container{
    background-color: #fff;
    border-radius: 4px;
    min-height: 500px;
}
.entry-list-container .tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #e5e6eb;
    overflow: hidden;
}

.tab-header .tab-title {
    white-space: nowrap;
    font-size: 18px;
    font-weight: 600;
}
.content-body {
  padding: 10px 20px 16px;
}
.serie{
    margin: 0 0 40px;
}
.serie .serie-title{
    height: 32px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin-bottom: 20px;
}
.serie .serie-title .title{
    font-style: normal;
    font-weight: 600;
    font-size: 20px;
    color: #1d2129;
    margin: 0 16px;
}
.serie .serie-title .series-left, .serie .serie-title .series-right{
    width: 16px;
    height: 2px;
}
img {
    border-style: none;
}
.serie .badge-icon-list{
    display: grid;
    justify-content: space-between;
    grid-template-columns: repeat(auto-fill,150px);
    grid-gap: 10px 20px;
    flex-wrap: wrap;
}
.serie .badge-icon-list .badge-icon-item{
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    width: 150px;
    font-style: normal;
    font-weight: 400;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.serie .badge-icon-list .badge-icon-item .badge-item-icon{
    width: 65px;
    height: 65px;
}
.serie .badge-icon-list .badge-icon-item .badge-item-icon .not-obtain{
    filter: grayscale(100%);
}
.serie .badge-icon-list .badge-icon-item .badge-item-icon img{
    width: 100%;
    height: 100%;
}
.serie .badge-icon-list .badge-icon-item .badge-desc{
    /* margin-top: -10px; */
    text-align: center;
    color: #1d2129;
    font-size: 16px;
    line-height: 28px;
}
.serie .badge-icon-list .badge-icon-item .obtain-date{
    font-size: 14px;
    text-align: center;
    color: #86909c;
    height: 24px;
    line-height: 24px;
}
</style>