<!--订单详情页面-->
<template>
	<view class="main_box">
		<!-- 订单基本信息 -->
		<view class="order_info_card" v-if="orderInfo">
			<view class="order_header">
				<view class="order_no">订单号：{{ orderInfo.order_no }}</view>
				<view class="order_status" :class="orderInfo.status">
					{{ orderInfo.status_text }}
				</view>
			</view>
			
			<view class="order_details">
				<view class="detail_item">
					<view class="detail_label">课程名称</view>
					<view class="detail_value">{{ orderInfo.course_name }}</view>
				</view>
				<view class="detail_item">
					<view class="detail_label">订单金额</view>
					<view class="detail_value amount">¥{{ orderInfo.amount }}</view>
				</view>
				<view class="detail_item">
					<view class="detail_label">下单时间</view>
					<view class="detail_value">{{ orderInfo.created_at }}</view>
				</view>
				<view class="detail_item" v-if="orderInfo.pay_time">
					<view class="detail_label">支付时间</view>
					<view class="detail_value">{{ orderInfo.pay_time }}</view>
				</view>
			</view>
		</view>
		
		<!-- 空状态 -->
		<view class="empty_state" v-if="!loading && !orderInfo">
			<image src="/static/icon-img/empty.png" class="empty_icon"></image>
			<view class="empty_text">暂无订单信息</view>
		</view>
		
		<!-- 加载状态 -->
		<view class="loading_state" v-if="loading">
			<view class="loading_text">加载中...</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			orderInfo: null,
			loading: false,
			orderId: null,
			childId: null
		}
	},
	onLoad(options) {
		this.orderId = options.orderId
		this.childId = options.childId
		this.loadOrderInfo()
	},
	methods: {
		async loadOrderInfo() {
			// 模拟订单详情数据
			this.orderInfo = {
				order_no: 'ORD202401001',
				course_name: '少儿篮球课程包',
				amount: '2880.00',
				status: 'paid',
				status_text: '已支付',
				created_at: '2024-01-01 10:00:00',
				pay_time: '2024-01-01 10:05:00'
			}
		}
	}
}
</script>

<style lang="less" scoped>
.main_box {
	background: #f8f9fa;
	min-height: 100vh;
	padding: 20rpx;
}

.order_info_card {
	background: #fff;
	border-radius: 16rpx;
	padding: 32rpx;
	box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
	
	.order_header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 32rpx;
		padding-bottom: 24rpx;
		border-bottom: 1px solid #f0f0f0;
		
		.order_no {
			font-size: 32rpx;
			font-weight: 600;
			color: #333;
		}
		
		.order_status {
			font-size: 24rpx;
			padding: 8rpx 16rpx;
			border-radius: 12rpx;
			
			&.paid {
				background: rgba(40, 167, 69, 0.1);
				color: #28a745;
			}
			
			&.unpaid {
				background: rgba(220, 53, 69, 0.1);
				color: #dc3545;
			}
		}
	}
	
	.order_details {
		.detail_item {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 20rpx 0;
			border-bottom: 1px solid #f8f9fa;
			
			.detail_label {
				font-size: 28rpx;
				color: #666;
				min-width: 160rpx;
			}
			
			.detail_value {
				font-size: 28rpx;
				color: #333;
				flex: 1;
				text-align: right;
				
				&.amount {
					color: #e67e22;
					font-weight: 600;
				}
			}
		}
	}
}

.empty_state {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 120rpx 0;
	
	.empty_icon {
		width: 160rpx;
		height: 160rpx;
		margin-bottom: 32rpx;
		opacity: 0.3;
	}
	
	.empty_text {
		font-size: 28rpx;
		color: #999;
	}
}

.loading_state {
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 60rpx 0;
	
	.loading_text {
		font-size: 28rpx;
		color: #666;
	}
}
</style>