<template>
    <view class="visitor">
        <view class="visits-time">{{ accDateTime }}</view>
        <template>
            <visits-cell
                @handlerVisits="handlerVisits"
                :visits-info="visitsInfo"
                v-for="visitsInfo in visitsList"
                :key="visitsInfo.userID"
            />
        </template>
    </view>
</template>

<script>
import VisitsCell from '../components/visits-cell.vue'
export default {
    components: {
        VisitsCell
    },
    data() {
        return {
            visitsList: [],
            accDateTime: '',
            userInfo: {}
        }
    },
    onLoad(options) {
        this.accDateTime = options.accDateTime
    },
    mounted() {
        this.userInfo = uni.getStorageSync('userInfo')
        this.getVisitesClubList()
    },
    onReachBottom() {
    },
    onPullDownRefresh() {
    	//下拉刷新
    	this.getVisitesClubList()
    	uni.stopPullDownRefresh()
    },
    methods: {
        handlerVisits($event) {
            uni.setStorageSync('visitsInfo', JSON.stringify($event))
            this.$api.navigateTo(
                '/pages/seller/notice/service/visits_details?spId=' +
                    this.userInfo.serviceProviderId +
                    '&clubId=' +
                    $event.clubId +
                    '&accessTime=' +
                    $event.accessTime.substr(0, 10)
            )
        },
        async getVisitesClubList() {
            const { data } = await this.SellerService.getVisitesClubList({
                spId: this.userInfo.serviceProviderId,
                accDateTime: this.accDateTime
            })
            this.visitsList = data
        }
    }
}
</script>

<style lang="scss">
page {
    background-color: #f7f7f7;
}
.visitor {
    .visits-time {
        font-size: 32rpx;
        font-weight: bold;
        color: #333333;
        padding: 40rpx 0 24rpx 16rpx;
    }
}
</style>
