<template>
	<view class="default_page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
		<cus-header title='我的订单' bgColor="transparent"></cus-header>
		<image class="top_bg" :src="imgBase+'order_detail_bg.png'" mode="widthFix"></image>
		<view class="top adf">
			<view class="top-left adfac">
				<image :src="imgBase+'order_detail_success.png'"></image>
				<view class="top-left-texts adffc">
					<view class="text">{{statusCfg[orderInfo.status]}}</view>
					<view class="text tip" v-if="orderInfo.status>0">{{statusTip[orderInfo.status]}}</view>
					<view class="text tip adfac" v-else>
						剩余支付时间<text style="margin: 0 4rpx;"></text>
						<u-count-down :time="countDownTime" format="HH:mm:ss" autoStart @finish="finish"></u-count-down>，
						超时将自动取消</view>
				</view>
			</view>
			<view class="top-right">￥{{orderInfo.price}}</view>
		</view>
		<view class="form">
			<view class="form-item adfacjb">
				<view class="form-item-title">订单号</view>
				<view class="form-item-value">{{orderInfo.no}}</view>
			</view>
			<view class="form-item adfacjb">
				<view class="form-item-title">订单类型</view>
				<view class="form-item-value">{{typeCfg[orderInfo.type]}} {{orderInfo.sum}}次</view>
			</view>
			<view class="form-item adfacjb">
				<view class="form-item-title">订单金额</view>
				<view class="form-item-value">￥{{orderInfo.price}}</view>
			</view>
			<view class="form-item adfacjb">
				<view class="form-item-title">下单时间</view>
				<view class="form-item-value">{{'2025-10-10 09:10:11'}}</view>
			</view>
			<view class="form-item adfacjb">
				<view class="form-item-title">有效期至</view>
				<view class="form-item-value">{{orderInfo.date}}</view>
			</view>
		</view>
		<view class="bottom adfacjb">
			<template v-if="orderInfo.status!=0">
				<view class="bottom-default" @click="buyAgain">再次购买</view>
			</template>
			<template v-else>
				<view class="bottom-default half qx" @click="orderCancel">取消</view>
				<view class="bottom-default half" @click="orderPay">去支付</view>
			</template>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				orderInfo:null,
				countDownTime:5 * 60 * 1000,
				statusCfg:{
					0:'待支付',
					1:'已完成',
					2:'已取消'
				},
				typeCfg:{
					1:'基础版',
					2:'专业版'
				},
				statusTip:{
					1:'您的问卷已激活，开始PREILL评估',
					2:'您的订单已取消，可重新购买'
				}
			}
		},
		onLoad(options) {
			if(options.item) this.orderInfo = JSON.parse(decodeURIComponent(options.item))
			console.log(this.orderInfo);
		},
		methods:{
			finish(){
				
			},
			buyAgain(){
				
			},
			orderCancel(){
				
			},
			orderPay(){
				
			},
		}
	}
</script>

<style scoped lang="scss">
	.default_page{
		padding: 0 24rpx 192rpx;
		box-sizing: border-box;
		background: #F7F7F7;
		
		.top_bg{
			width: 100%;
			position: absolute;
			left: 0;
			top: 0;
		}
		
		.top{
			margin-top: 54rpx;
			padding: 0 24rpx;
			position: relative;
			justify-content: space-between;
			&-left{
				image{
					width: 69rpx;
					height: 69rpx;
				}
				&-texts{
					margin-left: 20rpx;
					.text{
						font-family: PingFang-SC, PingFang-SC;
						font-weight: bold;
						font-size: 40rpx;
						color: #002846;
						line-height: 40rpx;
						&.tip{
							font-family: PingFangSC, PingFang SC;
							font-weight: 400;
							font-size: 24rpx;
							color: #667E90;
							line-height: 26rpx;
							margin-top: 24rpx;
						}
					}
				}
			}
			&-right{
				font-family: PingFang-SC, PingFang-SC;
				font-weight: bold;
				font-size: 36rpx;
				color: #002846;
				line-height: 30rpx;
				text-align: right;
			}
		}
		
		.form{
			background: #FFFFFF;
			border-radius: 25rpx;
			margin-top: 54rpx;
			padding: 0 24rpx;
			position: relative;
			&-item{
				box-shadow: inset 0rpx -1rpx 0rpx 0rpx #EFEFEF;
				padding: 34rpx 0;
				&-title{
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 30rpx;
					color: #002846;
					line-height: 30rpx;
				}
				&-value{
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 30rpx;
					color: #667E90;
					line-height: 30rpx;
					text-align: right;
				}
			}
		}
	
		.bottom{
			width: calc(100% - 88rpx);
			height: 88rpx;
			position: fixed;
			left: 44rpx;
			bottom: 54rpx;
			&-default{
				width: 100%;
				height: 88rpx;
				border: 1rpx solid #904A87;
				background: #904A87;
				border-radius: 44rpx;
				font-family: PingFang-SC, PingFang-SC;
				font-weight: bold;
				font-size: 32rpx;
				color: #FFFFFF;
				line-height: 88rpx;
				text-align: center;
				letter-spacing: 2rpx;
				&.half{
					width: calc(50% - 19rpx);
				}
				&.qx{
					color: #657588;
					background: #FFFFFF;
					border: 1rpx solid #CCD4DA;
				}
			}
		}
	}
</style>