<template>
	<view style="background-color: #242A38; height: auto; min-height: 100vh;">
		<view class="w750 padding flex-col align-center " style="min-height: 100%;">
			<view class="response padding bg-white margin-bottom border-bottom" style="border-radius: 20rpx;"
				v-for="(item, index) in appointmentList" :key="index">
				<view class="margin-bottom flex-row justify-between">
					<text>预约时间:{{item.appointmentDate}} {{ item.appointmentInterval }}</text>
					<text>预约科目:{{item.category}}</text>
				</view>

				<view class="flex-row justify-between">
					<text>预约人:{{item.realName}}</text>

					<text>预约电话:{{item.phoneNumber}}</text>
				</view>
			</view>
			<u-empty mode="list" v-if="appointmentList.length == 0" marginTop="150" iconSize="200" textSize="30rpx">
			</u-empty>
		</view>
	</view>

</template>
<script>
	export default {
		data() {
			return {
				imagesUrl: getApp().globalData.config.imagesUrl,
				baseUrl: getApp().globalData.config.baseUrl,
				appointmentList: [],
				user: {},
				loadingShow: true,
				isLoadMore: false, //是否加载中
				params: {
					pageSize: 10,
					pageNum: 1,
				},
				status: 'loadmore',
			};
		},
		onLoad() {
			this.getAppointmentList()
		},
		onReachBottom() {
			if (!this.isLoadMore) { //此处判断，上锁，防止重复请求
				this.status = 'loading';
				this.isLoadMore = true
				this.params.pageNum++
				this.getAppointmentList()
			}
		},
		methods: {
			// 获取用户信息
			async getUserInfo() {
				const res = await this.$request({
					url: '/getInfo',
				})
				if (res.code == 200 && res.hasOwnProperty('user')) {
					this.user = res.user
				}
			},
			// 获取预约记录
			async getAppointmentList() {
				const res = await this.$request({
					url: '/system/schoolAppointmentInfo/getAppointmentList',
					data: this.params
				})
				this.appointmentList = this.appointmentList.concat(res.rows);

				if (res.rows.length < this.params.pageSize) { //判断接口返回数据量小于请求数据量，则表示此为最后一页
					this.status = 'nomore';
					this.isLoadMore = true
				} else {
					this.isLoadMore = false
				}

				this.loadingShow = false

			},
		},
	};
</script>
<style scoped lang="scss">
	page {
		min-height: 100vh;
	}

	.goodList {
		margin: 20rpx auto 0;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		width: 700rpx;

		.goods {
			width: 100%;
			display: flex;
			flex-direction: row;
			align-items: center;
			background-color: rgba(255, 255, 255, 1);
			border-radius: 10px;
			width: 690rpx;
			height: 217rpx;
			margin-bottom: 20rpx;

			.goodTitle {}

			.goodImg {
				border-radius: 25rpx;
				margin: 20rpx;
			}
		}
	}

	.nickname-pop {
		width: 680rpx;
		padding: 70rpx 50rpx 0rpx;
		background: #242a38;
		border-radius: 10rpx;
	}

	.nickname-input {
		width: 100%;
		font-size: 26rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.nickname-label {
		font-size: 30rpx;
		display: block;
		margin-bottom: 20rpx;
		text-align: center;
		color: #d2c3af;
	}

	.input-style {
		border-bottom: 1px solid #d2c3af;
		display: block;
		width: 100%;
		height: 60rpx;
		color: #d2c3af;
	}

	.button-style {
		width: 600rpx;
		margin: 40rpx auto;
	}
</style>