<style lang="scss" scoped>
	@import url("@/asset/css/flex.css");
    .opiSurListBox{
        background: #f5f5f5;
        height: 100vh;
        overflow: hidden;
    }
    .opiSurHeader{
        background: linear-gradient(-30deg, #4779FF, #47A5FF);
    }
    .opiSurTitle view{
        padding: 5rpx 20rpx;
        border: 1px solid #fff;
        background: #fff;
        border-radius: 50rpx;
    }
    .opiSurTitle view.active{
        border: 1px solid #4779FF;
        background: #BED6FF;
        color: #4779FF;
    }
    .opiSurListCenter{
        background: #fff;
        border-radius: 10rpx;
        overflow: hidden;
        box-shadow: 0rpx 3rpx 32rpx 0rpx rgba(71,71,71,0.16);
    }
    
</style>
<template>
    <view class="opiSurListBox column">
        <view class="opiSurHeader">
            <headers :title="pageTitle" color="#fff"></headers>
        </view>
        <view class="opiSurTitle row justify-between PX30 PY20 fz24">
            <view v-for="item in titles"
            :class="[msg.type==item.id?'active':'']"
            @click="newType(item.id)">
                {{ item.name }}({{ item.num }})
            </view>
        </view>
        <scroll-view class="flex1 bgFFF" scroll-y="true"
        :enable-back-to-top="true" :enable-flex="true"
        style="overflow: hidden;">
            <view class="PX30">
                <view v-for="item in list"
                 class="opiSurListCenter fz28 PX20 PY20 MT20 MB30 row justify-between">
                    <view>{{ item.GuestName }}</view>
                    <view>{{ Number(item.ScoreNum)>0?Number(item.ScoreNum).toFixed(1):'未评分' }}</view>
                </view>
                <u-empty v-if="list.length==0" text="暂无数据" mode="data" padding-top="20"></u-empty>
            </view>
            
            <view style="height: 20rpx;"></view>
        </scroll-view>
    </view>
    
</template>
<script>
import headers from "@/components/header/header";
export default {
    components: {
        headers,
    },
    data() {
        return {
            pageTitle: '意见调查',
            titles:[
                {name:'全部',id:1,num:0},
                {name:'已评分',id:2,num:0},
                {name:'未评分',id:3,num:0},
            ],
            msg:{
                type: 1,
                TCIDs: '',
            },
            list: [],
            datas: {},
        }
    },
    onLoad(option){
        if(option.TCIDs){
            this.msg.TCIDs = option.TCIDs
            this.init()
        }
    },
    created() {

    },
    mounted() {

    },
    methods: {
        newType(id){
            this.msg.type = id
            if(id==1) this.list = JSON.parse(JSON.stringify(this.datas.objAll))
            else if(id==2) this.list = JSON.parse(JSON.stringify(this.datas.objScore))
            else if(id==3) this.list = JSON.parse(JSON.stringify(this.datas.objNoScore))
        },
        init() {
            uni.showLoading()
            this.apipost("survey_post_GetTotalListAPP", this.msg, (res) => {
                if (res.resultCode == 1) {
                    this.datas = res.data;
                    this.list = JSON.parse(JSON.stringify(this.datas.objAll))
                    this.titles[0].num = this.datas.objAll.length
                    this.titles[1].num = this.datas.objScore.length
                    this.titles[2].num = this.datas.objNoScore.length
                    uni.hideLoading()
                }
            }, (failed) => {
                uni.hideLoading()
                uni.showToast({
                    title: failed.message,
                    icon: "none",
                });
            }, (error) => {
                uni.hideLoading()
            })
        },
    },
}
</script>