<template>
    <view class="details">
        <view class="visits-time">{{ accessTime }}</view>
        <template>
            <view class="details-title"><visits-cell @handlerVisits="handlerVisits" :visits-info="visitsInfo" /></view>
        </template>
        <view class="trajectory">
            <Trajectory :trajectory-list="detailList"/>
        </view>
    </view>
</template>

<script>
import VisitsCell from '../components/visits-cell.vue'
import Trajectory from '../components/trajectory.vue'
export default {
    components: {
        VisitsCell,
        Trajectory
    },
    data() {
        return {
            visitsInfo: {},
            accessTime: '', // 访问日期
            spId: '', // 协销id
            clubId: '' ,// 机构id
            detailList: []
        }
    },
    async onLoad(options) {
        this.accessTime = options.accessTime
        this.spId = options.spId
        this.clubId = options.clubId
		const { data } = await this.SellerService.getVisitesClubInfo({accessTime: options.accessTime, spId: options.spId, clubId: options.clubId})
		this.detailList = data
		this.visitsInfo = {
		    image: data[0].image,
		    linkMan: data[0].linkMan,
		    contractMobile: data[0].contractMobile,
		    pageLabel: data[0].pageLabel
		}
		console.log('options', options, 'visitsInfo', data, '详情', this.visitsInfo)
    },
    mounted() {
        this.getVisitesClubDetail()
    },
    methods: {
        handlerVisits($event) {},
        async getVisitesClubDetail() {
            const {data} = await this.SellerService.getVisitesClubInfo({accessTime: this.accessTime, spId: this.spId, clubId: this.clubId})
            this.detailList = data
            this.visitsInfo = {
                image: data[0].image,
                linkMan: data[0].linkMan,
                contractMobile: data[0].contractMobile,
                pageLabel: data[0].pageLabel
            }
            console.log('visitsInfo', data)
        }
    }
}
</script>

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