<template>
	<view class="order-detail-container">
		<!-- 日期信息 -->
		<view class="order-date">
			<view class="order-date-icon">
				<u-icon name="calendar" color="#FFAA48" size="20"></u-icon>
			</view>
			<view class="order-date-text">{{ orderDate }}</view>
		</view>
		
		<!-- 个人信息区域 -->
		<view class="order-section">
			<view class="order-section-title">个人信息</view>
			<view class="order-section-content">
				<view class="order-image-item">
					<view class="order-image-label">手套照片 (共2张)</view>
					<view class="order-image-container">
						<image class="order-image" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/gloves.jpg" mode="aspectFill"></image>
					</view>
				</view>
				<view class="order-image-item">
					<view class="order-image-label">鞋套照片 (共2张)</view>
					<view class="order-image-container">
						<image class="order-image" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/shoes.jpg" mode="aspectFill"></image>
					</view>
				</view>
			</view>
		</view>
		
		<!-- 宠物状况记录 -->
		<view class="order-section">
			<view class="order-section-title">宠物状况记录</view>
			<view class="order-section-content">
				<view class="pet-record" v-for="(pet, index) in pets" :key="index">
					<view class="pet-name">{{ pet.name }} (共{{ pet.photoCount }}张)</view>
					<view class="pet-images">
						<view class="pet-image-container" v-for="(photo, photoIndex) in pet.photos" :key="photoIndex">
							<image class="pet-image" :src="photo" mode="aspectFill"></image>
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<!-- 基础服务记录 -->
		<view class="order-section">
			<view class="order-section-title">基础服务记录</view>
			<view class="order-section-content">
				<view class="service-record" v-for="(service, index) in services" :key="index">
					<view class="service-name">{{ service.name }}</view>
					<view class="service-comparison">
						<view class="service-before-after">
							<view class="service-image-container">
								<image class="service-image" :src="service.beforeImage" mode="aspectFill"></image>
								<view class="service-image-label">前</view>
							</view>
							<view class="service-image-container">
								<image class="service-image" :src="service.afterImage" mode="aspectFill"></image>
								<view class="service-image-label">后</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<!-- 定制服务记录 -->
		<view class="order-section">
			<view class="order-section-title">定制服务记录</view>
			<view class="order-section-content">
				<view class="custom-service">
					<view class="custom-service-item">
						<view class="custom-service-name">遛狗 (5-30分钟)</view>
						<view class="custom-service-images">
							<image class="custom-service-image" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/dog1.jpg" mode="aspectFill"></image>
							<image class="custom-service-image" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/dog2.jpg" mode="aspectFill"></image>
							<image class="custom-service-image" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/dog3.jpg" mode="aspectFill"></image>
						</view>
					</view>
					<view class="custom-service-item">
						<view class="custom-service-name">梳毛 (5-30分钟)</view>
						<view class="custom-service-images">
							<image class="custom-service-image" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/cat1.jpg" mode="aspectFill"></image>
							<image class="custom-service-image" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/cat2.jpg" mode="aspectFill"></image>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				orderId: null,
				orderDate: '2024年12月08日',
				pets: [
					{
						name: '小汪',
						photoCount: 2,
						photos: [
							'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/dog1.jpg',
							'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/dog2.jpg'
						]
					},
					{
						name: 'Billion',
						photoCount: 2,
						photos: [
							'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/cat1.jpg',
							'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/cat2.jpg'
						]
					}
				],
				services: [
					{
						name: '猫粮前后对比',
						beforeImage: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/food_before.jpg',
						afterImage: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/food_after.jpg'
					},
					{
						name: '水碗前后对比',
						beforeImage: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/water_before.jpg',
						afterImage: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/water_after.jpg'
					},
					{
						name: '猫砂盆 厚度前后对比',
						beforeImage: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/litter_before.jpg',
						afterImage: 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/litter_after.jpg'
					}
				]
			}
		},
		onLoad(options) {
			if (options.orderId) {
				this.orderId = options.orderId;
				// 这里可以根据orderId加载订单详情数据
				this.loadOrderDetail();
			}
		},
		methods: {
			loadOrderDetail() {
				// 这里可以调用API获取订单详情
				// 示例代码，实际项目中需要替换为真实API调用
				/*
				getOrderDetail(this.orderId).then(res => {
					if (res && res.code === 200) {
						this.orderDate = res.data.orderDate;
						this.pets = res.data.pets;
						this.services = res.data.services;
					}
				});
				*/
			}
		}
	}
</script>

<style lang="scss">
.order-detail-container {
	padding: 15px;
	background-color: #f5f5f7;
	min-height: 100vh;
}

.order-date {
	display: flex;
	align-items: center;
	padding: 10px 15px;
	background-color: #fff;
	border-radius: 8px;
	margin-bottom: 15px;
	
	.order-date-icon {
		margin-right: 10px;
	}
	
	.order-date-text {
		color: #333;
		font-size: 16px;
		font-weight: 500;
	}
}

.order-section {
	background-color: #fff;
	border-radius: 8px;
	margin-bottom: 15px;
	overflow: hidden;
	
	.order-section-title {
		padding: 12px 15px;
		border-bottom: 1px solid #f0f0f0;
		color: #333;
		font-size: 16px;
		font-weight: 500;
		position: relative;
		
		&::before {
			content: '';
			position: absolute;
			left: 0;
			top: 12px;
			height: 16px;
			width: 4px;
			background-color: #ffaa48;
			border-radius: 0 2px 2px 0;
		}
	}
	
	.order-section-content {
		padding: 15px;
	}
}

.order-image-item {
	margin-bottom: 15px;
	
	.order-image-label {
		color: #666;
		font-size: 14px;
		margin-bottom: 8px;
	}
	
	.order-image-container {
		display: flex;
		flex-wrap: wrap;
		gap: 10px;
		
		.order-image {
			width: 100px;
			height: 100px;
			border-radius: 4px;
			object-fit: cover;
		}
	}
}

.pet-record {
	margin-bottom: 20px;
	
	.pet-name {
		color: #333;
		font-size: 15px;
		font-weight: 500;
		margin-bottom: 10px;
	}
	
	.pet-images {
		display: flex;
		flex-wrap: wrap;
		gap: 10px;
		
		.pet-image-container {
			.pet-image {
				width: 100px;
				height: 100px;
				border-radius: 4px;
				object-fit: cover;
			}
		}
	}
}

.service-record {
	margin-bottom: 20px;
	
	.service-name {
		color: #333;
		font-size: 15px;
		font-weight: 500;
		margin-bottom: 10px;
	}
	
	.service-comparison {
		.service-before-after {
			display: flex;
			gap: 15px;
			
			.service-image-container {
				position: relative;
				
				.service-image {
					width: 120px;
					height: 120px;
					border-radius: 4px;
					object-fit: cover;
				}
				
				.service-image-label {
					position: absolute;
					bottom: 0;
					left: 0;
					background-color: rgba(0,0,0,0.5);
					color: #fff;
					padding: 2px 8px;
					font-size: 12px;
					border-radius: 0 0 0 4px;
				}
			}
		}
	}
}

.custom-service {
	.custom-service-item {
		margin-bottom: 15px;
		
		.custom-service-name {
			color: #333;
			font-size: 15px;
			font-weight: 500;
			margin-bottom: 10px;
		}
		
		.custom-service-images {
			display: flex;
			flex-wrap: wrap;
			gap: 10px;
			
			.custom-service-image {
				width: 100px;
				height: 100px;
				border-radius: 4px;
				object-fit: cover;
			}
		}
	}
}
</style>