<template>
	<view class="content">
		<view class="container">
			<!-- <view class="my-header">
				<view class="my-icons" @click="goBack"> <uni-icons type="left" size="16"></uni-icons> </view>
				<view class="my-text">支付完成</view>
				<view class="my-icons"></view>
			</view> -->

			<view style="text-align: center;margin-top: 20px;">
				<view style="margin: 0 auto;">
					<image src="../../static/icon/zfcg.png" style="width: 80px; height: 80px; "></image>
				</view>
				<view style="margin: 20px auto;font-size: 16px;color: #22AF5B;">支付成功</view>
				<view class="m_num">￥190.00</view>
				<view class="m_bs">
					<view class="">门店名称</view>
					<view class="">中建锦绣二期站</view>
				</view>
				<view class="x_"></view>
				<view class="m_bs">
					<view class="">交易类型</view>
					<view class="">油品</view>
				</view>
				<view class="m_bs">
					<view class="">支付方式</view>
					<view class="">会员储值卡</view>
				</view>
				<view class="m_bs">
					<view class="">流水编号</view>
					<view class="">xxxxxxxxxxxxxxxx</view>
				</view>

				<view v-if="orderNo" @click="goOrderInfo" style="border: solid 1px #FA6400;margin: 20px auto;width: 70%;
				height: 40px;line-height: 40px;color: #FA6400;">{{timestamp}}s后去评价</view>
				<view v-else @click="goBack" style="border: solid 1px #FA6400;margin: 20px auto;width: 70%;
				height: 40px;line-height: 40px;color: #FA6400;">{{timestamp}}s后返回首页</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				timestamp: 3,
				timer: {},
				orderNo: "",
			}
		},
		onLoad(e) {
			if (e.orderNo) {
				this.orderNo = e.orderNo
			}
			// this.countdown()
		},
		methods: {
			goOrderInfo() {
				clearInterval(this.timer)
				uni.navigateTo({
					url: '/pagesMy/details/details?orderNo=' + this.orderNo,
				})
			},
			// 倒计时刷新
			countdown() {
				let _this = this
				this.timer = setInterval(() => {
					// countdown减1
					_this.timestamp--;
					// 如果倒计时为0，清除定时器
					if (_this.timestamp === 0) {
						if (_this.orderNo) {
							_this.goOrderInfo()
						} else {
							_this.goBack()
						}

						clearInterval(this.timer)
						_this.timestamp = 3
					}
				}, 1000);
			},
			goBack() {
				clearInterval(this.timer)
				uni.reLaunch({
					url: '/pages/index/index'
				})
			}
		}

	}
</script>

<style scoped lang="scss">
	.content {
		background: white;
	}

	.container {
		width: 100%;
		height: 100vh;
		box-sizing: border-box;

	}

	.my-header {
		width: 100%;
		height: 88px;
		background: #ffffff;
		display: flex;
		align-items: center;
		justify-content: space-between;
		color: #000;
		box-sizing: border-box;
		padding: 0px 15px;
		padding-top: 40px;

		.my-icons {
			width: 20px;

		}

		position: fixed;
		top: 0px;
	}

	.m_num {
		font-size: 30px;
		color: #333333;
	}

	.m_bs {
		width: 100%;
		box-sizing: border-box;
		padding: 5px 15px;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.x_ {
		width: 95%;
		border-bottom: 1px solid #EEEEEE;
		margin: 5px auto;
	}
</style>