<template>
	<view>
		<view class="u-flex-col" style="justify-content: flex-end;align-items: center;margin-top: 100rpx;">
			<image src="/static/images/success.png" style="width: 86rpx;height: 86rpx;" mode=""></image>
			<view class="success">恭喜！密码重置成功</view>
			<view class="fonta" style="margin-top: 26rpx;">
				<text>请牢记新密码，</text>
				<text style="color:rgba(6, 169, 113, 1) ;">{{num}}s</text>
				<text>后自动跳转至首页</text>
			</view>
			<view class="button" @click="accomplish">
				返回首页
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				bookid: '',
				order_on: '',
				total_price: '',
				num: 3,
				timer: null,
			};
		},
		onLoad(options) {
			this.setTime()
		},
		beforeDestroy() {
		  clearInterval(this.timer);　　// 清除定时器
		  this.timer = null;
		},
		methods: {
			accomplish() {
				uni.switchTab({
					url: '/pages/index/index'
				})
			},
			setTime() {
				 this.timer = setInterval(() => {
					this.num--
					if (this.num == 0) {
						this.accomplish()
					}
				}, 1000)
			}
		}
	}
</script>

<style lang="scss">
	.fonta {
		font-size: 24rpx;
		font-family: PingFangSC, PingFang SC;
		font-weight: 400;
		color: #929292;
		margin-top: 36px;
	}

	.one {
		font-size: 26rpx;
		font-family: SFPro, SFPro;
		font-weight: 400;
		color: #222222;
	}

	.button {
		width: 286rpx;
		height: 88rpx;
		background: #F5F5F5;
		border-radius: 8rpx;
		border: 2rpx solid rgba(151, 151, 151, 0.3);
		font-size: 32rpx;
		font-family: PingFangSC, PingFang SC;
		font-weight: 500;
		color: #333333;
		margin-top: 168rpx;
		line-height: 88rpx;
		text-align: center;
	}

	.order {
		margin-top: 62rpx;
	}

	.success {
		font-size: 36rpx;
		font-family: PingFangSC, PingFang SC;
		font-weight: 500;
		color: #222222;
		margin-top: 60rpx;
	}

	.money {
		font-size: 26rpx;
		font-family: JDZhengHT, JDZhengHT;
		font-weight: 400;
		color: #222222;
	}
</style>