<!--
 * @Author: ch
 * @Date: 2022-05-08 01:11:33
 * @LastEditors: ch
 * @LastEditTime: 2022-05-09 22:27:35
 * @Description: file content
-->
<template>
	<div class="c-white-main" style="padding-top:350px">
		<img class="icon" src="@/assets/img/order/pay_success.png" />
		<p>交易成功</p>
		<div>
			<UiButton type="grey" @click="goHome" :radius="true">返回首页</UiButton>
		</div>
	</div>
</template>
<script>
import UiButton from '../../components/UiButton.vue';
import {ApiGetOrderPaySatus} from '@/plugins/api/order';
export default {
	components: { UiButton },
	data(){
		return {
			orderInfo : {},
			reuqestNum : 0
		}
	},
	methods:{
		async getOrderInfo(){
			this.reuqestNum++;
			const {error, result} = await ApiGetOrderPaySatus({orderId : this.$route.query.id});
			if(error){
				this.$message.warning(error.message);
				return false
			}
			if(!result.isSuccess && this.reuqestNum < 5){
				setTimeout(()=>{
					this.getOrderInfo();
				}, 1000)
				return false;
			}
			this.orderInfo = result;
		},
		goHome(){
			this.$router.replace('/');
		}
	}
}
</script>
<style lang="scss" scoped>
.c-white-main{
	text-align: center;
	padding-bottom: 40px;
}
.icon{
	width: 239px;
}
p{
	margin: 10px 0 25px 0;
	color: #999;
}
</style>