<template>
	<view>
		<view>
			<view v-if="listData.address">
				<up-tag text="默认" type="error"></up-tag>
				<view>
					{{listData.address.area}}
				</view>
				<view>
					{{listData.address.name}}
					{{listData.address.telephone}}
				</view>
				<view>
					{{listData.address.address}}
				</view>
			</view>
		</view>
		<view>
			<up-card title="志愿者介绍" :head-style="{ height: '80rpx', padding: '20rpx',}">
				<template #body>
					<view class="card-container">
						<image class="card-image" :src="listData.volunteerInfo.certificationPicture" mode="aspectFill">
						</image>

						<view class="card-info">
							<view class="info-item">{{listData.volunteerInfo.name}}</view>
							<view class="info-item">类别：11</view>
							<view class="info-item">科目：111</view>
							<view class="Telephone">电话：{{listData?.volunteerInfo?.phonenumber}}</view>
							<view class="info-item">住址：{{listData.volunteerInfo.city}}</view>
						</view>

						<view class="card-rating">4.5 评分</view>
					</view>
				</template>
			</up-card>
			<up-card title="技能介绍" :head-style="{ height: '80rpx', padding: '20rpx',}">
				<template #body>
					{{listData.volunteerInfo.remark}}
				</template>
			</up-card>
			<up-card title="证书" :head-style="{ height: '80rpx', padding: '20rpx',}">
				<template #body>
					<image src="../../static/zhiyuanzhe.jpg" mode="" style="width: 100%;"></image>
				</template>
			</up-card>
		</view>

		<view>
			<up-list @scrolltolower="scrolltolower">
				<up-list-item>
					<view class="Wrap-top">
						<text>第一节课</text>
						<text>2025-04-16 08:00</text>
					</view>
					<view class="list-item">
						<image src="/static/img/dd.png" mode="aspectFill" class="item-image"></image>

						<view class="item-info">
							<view class="info-line">姓名：王麻子</view>
							<view class="info-line">类别：刨土豆</view>
							<view class="info-line">技能介绍：11</view>
						</view>
						<view class="item-right">
							<view class="rating">评分：9.5</view>
							<up-tag text="标签" plain size="mini" class="tag"></up-tag>
						</view>
					</view>
				</up-list-item>
			</up-list>
		</view>
	</view>
</template>


<script setup>
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		ref
	} from "vue";
	import {
		orderInfomainOrderId
	} from "@/api/userList.js";

	const listData = ref(); //志愿者详情数据
	
	const mainOrderId = ref(''); //志愿者ID
	// 获取传递的参数
	onLoad(async (options) => {
		mainOrderId.value = options.mainOrderId; // 存储到响应式变量
		const res = await orderInfomainOrderId(mainOrderId.value)
		listData.value = res.data;
		console.log(listData.value, '获取用户详情')
		
	});
</script>

<style scoped>
	.card-container {
		display: flex;
		position: relative;
		padding: 20rpx;
		align-items: flex-start;
		background-color: #fff;
		border-radius: 12rpx;
	}

	/* 左侧图片 */
	.card-image {
		width: 240rpx;
		height: 340rpx;
		border-radius: 12rpx;
		margin-right: 30rpx;
		flex-shrink: 0;
	}

	/* 中间信息区域 */
	.card-info {
		flex: 1;
		padding-right: 100rpx;
	}

	/* 中间信息区域 */
	.card-info {
		flex: 1;
		padding-right: 100rpx;
	}

	.Telephone {
		white-space: nowrap;
		margin-bottom: 24rpx;
		font-size: 28rpx;
		line-height: 1.6;
		color: #333;
	}

	.info-item {
		margin-bottom: 24rpx;
		font-size: 28rpx;
		line-height: 1.6;
		color: #333;
	}

	/* 右上角评分 */
	.card-rating {
		position: absolute;
		top: 20rpx;
		right: 20rpx;
		background-color: #f8f8f8;
		padding: 6rpx 16rpx;
		border-radius: 20rpx;
		font-size: 24rpx;
		color: #ff9900;
		font-weight: bold;
	}



	/* 上课时间 */

	.Wrap-top {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 24rpx 20rpx 0rpx 24rpx;
	}

	.list-item {
		display: flex;
		padding: 24rpx;
		align-items: flex-start;
		gap: 24rpx;
	}

	.item-image {
		width: 160rpx;
		height: 180rpx;
		border-radius: 16rpx;
		object-fit: cover;
	}

	.item-info {
		flex: 1;
		display: flex;
		flex-direction: column;
		gap: 14rpx;
	}

	.info-line {
		font-size: 28rpx;
		color: #333;
		line-height: 1.6;
	}

	.item-right {
		display: flex;
		flex-direction: column;
		align-items: flex-end;
		gap: 16rpx;
		min-width: 160rpx;
	}

	.rating {
		font-size: 28rpx;
		color: #f39c12;
		font-weight: bold;
	}

	.tag {
		transform: scale(0.9);
		/* 缩小标签尺寸 */
	}

	.action-btn {
		margin-top: 18rpx;
		width: 100%;
	}
</style>