<!--合同详情页面-->
<template>
	<view class="main_box">
		<!-- 合同基本信息 -->
		<view class="contract_info_card" v-if="contractInfo">
			<view class="contract_header">
				<view class="contract_title">{{ contractInfo.title }}</view>
				<view class="contract_status" :class="contractInfo.status">
					{{ contractInfo.status_text }}
				</view>
			</view>
			
			<view class="contract_details">
				<view class="detail_item">
					<view class="detail_label">合同金额</view>
					<view class="detail_value amount">¥{{ contractInfo.amount }}</view>
				</view>
				<view class="detail_item">
					<view class="detail_label">签订日期</view>
					<view class="detail_value">{{ contractInfo.sign_date }}</view>
				</view>
				<view class="detail_item">
					<view class="detail_label">有效期</view>
					<view class="detail_value">{{ contractInfo.valid_date }}</view>
				</view>
			</view>
		</view>
		
		<!-- 空状态 -->
		<view class="empty_state" v-if="!loading && !contractInfo">
			<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 {
			contractInfo: null,
			loading: false,
			contractId: null,
			childId: null
		}
	},
	onLoad(options) {
		this.contractId = options.contractId
		this.childId = options.childId
		this.loadContractInfo()
	},
	methods: {
		async loadContractInfo() {
			// 模拟合同详情数据
			this.contractInfo = {
				title: '少儿篮球培训合同',
				status: 'active',
				status_text: '有效',
				amount: '2880.00',
				sign_date: '2024-01-01',
				valid_date: '2024-01-01 至 2024-12-31'
			}
		}
	}
}
</script>

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

.contract_info_card {
	background: #fff;
	border-radius: 16rpx;
	padding: 32rpx;
	box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
	
	.contract_header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 32rpx;
		padding-bottom: 24rpx;
		border-bottom: 1px solid #f0f0f0;
		
		.contract_title {
			font-size: 36rpx;
			font-weight: 600;
			color: #333;
		}
		
		.contract_status {
			font-size: 24rpx;
			padding: 8rpx 16rpx;
			border-radius: 12rpx;
			
			&.active {
				background: rgba(40, 167, 69, 0.1);
				color: #28a745;
			}
			
			&.expired {
				background: rgba(220, 53, 69, 0.1);
				color: #dc3545;
			}
		}
	}
	
	.contract_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>