<template>
	<view class="success-container">
		<view class="success-icon-wrap">
			<view class="success-icon">
				<text class="success-check">✓</text>
			</view>
		</view>
		
		<view class="success-title">兑换成功</view>
		<view class="success-desc">您的积分兑换订单已提交成功</view>
		
		<view class="success-content">
			<view class="order-card">
				<view class="order-info">
					<view class="order-item">
						<text class="order-label">订单编号</text>
						<text class="order-value">JF{{orderNo}}</text>
					</view>
					<view class="order-item">
						<text class="order-label">兑换时间</text>
						<text class="order-value">{{orderTime}}</text>
					</view>
					<view class="order-item">
						<text class="order-label">消耗积分</text>
						<text class="order-value points">-{{points}} 积分</text>
					</view>
				</view>
			</view>
			
			<view class="action-buttons">
				<view class="btn btn-outline" @click="goBack">
					<text>返回首页</text>
				</view>
				<view class="btn btn-primary" @click="viewOrder">
					<text>查看订单</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				orderNo: '',
				orderTime: '',
				points: 0
			};
		},
		onLoad(options) {
			this.orderNo = options.order_id ;
			this.orderTime = new Date().toLocaleString('zh-CN');
			this.points = options.points || 0;
		},
		methods: {
			goBack() {
				uni.switchTab({
					url:'/pages/index/index'
				})
			},
			viewOrder() {
				uni.navigateTo({
					url:'/pages/user/jf/order'
				})
			}
		}
	};
</script>

<style lang="scss">
	page {
		height: 100%;
		background-color: #F5F5F5;
	}

	.success-container {
		min-height: 100vh;
		display: flex;
		flex-direction: column;
		align-items: center;
		padding: 100rpx 30rpx;
		background: linear-gradient(180deg, #FF6B6B 0%, #FF8E8E 50%, #F5F5F5 50%);
	}

	.success-icon-wrap {
		margin-bottom: 30rpx;
	}

	.success-icon {
		width: 160rpx;
		height: 160rpx;
		background-color: #FFFFFF;
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
		box-shadow: 0 8rpx 30rpx rgba(255, 107, 107, 0.3);
	}

	.success-check {
		font-size: 80rpx;
		color: #52C41A;
		font-weight: bold;
	}

	.success-title {
		font-size: 40rpx;
		font-weight: bold;
		color: #FFFFFF;
		margin-bottom: 15rpx;
		text-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
	}

	.success-desc {
		font-size: 28rpx;
		color: rgba(255, 255, 255, 0.85);
		margin-bottom: 60rpx;
	}

	.success-content {
		width: 100%;
		background-color: #FFFFFF;
		border-radius: 20rpx;
		padding: 40rpx;
		box-shadow: 0 10rpx 40rpx rgba(0, 0, 0, 0.1);
	}

	.order-card {
		margin-bottom: 40rpx;
	}

	.order-info {
		background-color: #F9F9F9;
		border-radius: 15rpx;
		padding: 30rpx;
	}

	.order-item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 15rpx 0;
		
		&:not(:last-child) {
			border-bottom: 1rpx solid #EEEEEE;
		}
	}

	.order-label {
		font-size: 26rpx;
		color: #999999;
	}

	.order-value {
		font-size: 26rpx;
		color: #333333;
		font-weight: 500;
		
		&.points {
			color: #FF4444;
		}
	}

	.action-buttons {
		display: flex;
		gap: 20rpx;
	}

	.btn {
		flex: 1;
		height: 88rpx;
		border-radius: 44rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 30rpx;
		font-weight: 500;
		
		&.btn-outline {
			border: 2rpx solid #DDDDDD;
			color: #666666;
			
			&:active {
				background-color: #F5F5F5;
			}
		}
		
		&.btn-primary {
			background: linear-gradient(135deg, #FF6B6B 0%, #FF4444 100%);
			color: #FFFFFF;
			box-shadow: 0 4rpx 20rpx rgba(255, 68, 68, 0.4);
			
			&:active {
				opacity: 0.9;
				transform: scale(0.98);
			}
		}
	}
</style>