<template>
	<view>
		<view class="content">

			<u-icon name="checkmark-circle" size="90" color="#EF9525"></u-icon>
			<view class="h3">您已经{{option}}成功</view>
			<view class="p">即将跳转到{{tips}} {{time}} s</view>
		</view>
		<view class="pinkBtn" @click="goHome">返回首页</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tips: "参观预约",
				time: 3,
				option:"预约"
			}
		},
		onLoad(options) {
			let that = this;
			if (options.from) {
				var url = "";
				if (options.from == "visit") {
					this.tips = "参观预约";
					url = "/pages/order/visitorderinfo?id=" + options.id
				} else if (options.from == "activity") {
					this.tips = "活动预约";
					url = "/pages/order/activityorderinfo?id=" + options.id
				} else if (options.from == "park") {
					this.tips = "车位预约";
					url = "/pages/order/parkorderinfo?id=" + options.id
				} else if (options.from == "feed") {
					this.tips = "首页";
					this.option = "提交"
					url = ""
				}


				if (url == "") {
					var t = setInterval(function() {
						if (that.time > 1)
							that.time = that.time - 1;
					}, 1000)
					setTimeout(function() {
						that.goHome();
						clearInterval(t);
					}, 3000)
				} else {
					var t = setInterval(function() {
						if (that.time > 0)
							that.time = that.time - 1;
					}, 1000)
					setTimeout(function() {
						uni.redirectTo({
							url: url
						})
						clearInterval(t);
					}, 3000)
				}
			}

		},
		methods: {
			goHome() {
				uni.switchTab({
					url: "/pages/index/index"
				})
			}
		}
	}
</script>


<style lang="scss" scoped>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding-top: 90px;
	}

	.successBox {

		.iconfont {
			color: #00CCB9;
			font-size: 180rpx;
		}

		.h3 {
			font-size: 40rpx;
			font-weight: 500;
			color: #333333;
			margin-top: 40rpx;
		}

		.p {
			font-size: 28rpx;
			font-weight: 400;
			color: #333333;
			margin-top: 24rpx;
		}

	}

	.pinkBtn {
		width: 670rpx;
		height: 88rpx;
		background-image: linear-gradient(45deg, #EF9525 0%, #EF9525 100%);
		border-radius: 44rpx;
		font-size: 36rpx;
		font-weight: 500;
		color: #FFFFFF;
		text-align: center;
		line-height: 88rpx;
		margin: 80rpx auto;
	}
</style>
