<template>
    <view class="self-order">
        <view class="type-tabs">
            <u-tabs :scrollable="true" lineColor="#C30D23" :activeStyle="{ color: '#C30D23', fontWeight: 'bold' }" :list="types"
            @click="changeType" :current="current" />
        </view>

        <My_listbox ref="List" @getlist="getList" :bottomHeight="70">
            <List :list="list"></List>
        </My_listbox>
    </view>
</template>

<script>
import { onLoad } from 'uview-ui/libs/mixin/mixin';
import List from '../mySubscription/list.vue';
export default {
    components:{List},
    data () {
        return {
            current:0,
            content: {
                "pageNumber": 1,
                "pageSize": 20,
                "where": {
                    "type": "",
                }
            },
            list:[],
            types:[]
        }
    },
    methods: {
        changeType (type) {
            this.current = type.index
            this.content.where.type = type.value
            this.getList(true)
        },
        getList(init = false) {
            return new Promise((resolve, reject) => {
                if (this.paging(this.content, init)) return resolve();
                this.$Http.basic({
                    "id": "20240513154802",
                    content: this.content
                }).then(res => {
                    this.$refs.List.setHeight()
                    this.$refs.List.RefreshToComplete()
                    console.log("获取预约名单列表", res)
                    resolve();
                    if (this.cutoff(res.msg)) return;
                    this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
                    this.content = this.$refs.List.paging(this.content, res)
                })
            })
        },
        callPhoneFun (phonenumber) {
            this.callPhone(phonenumber)
        }
    },
    created() {
        this.getCustomClass('appointmenttype').then(res => {
            res.forEach(v => v.name = v.remarks)
            res.unshift({name:'全部',value:''})
            this.types = res
            console.log(this.types,'分类');
        })
        this.getList()
    },
    onLoad (option) {
        uni.setNavigationBarTitle({
            title:'预约名单',
        })
    }
}
</script>

<style lang="scss">
    
</style>