<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>请等待</title>
	<style>
	 * {
            padding: 0;
            margin: 0;
        }

        html,
        body {
            height: 100%;
			-webkit-background-size: cover;
			-moz-background-size: cover;
			-o-background-size: cover;
			background-size: cover;
            position: relative;
        }
		.page{
            overflow: auto;
            margin: auto;
            text-align: center;
            position: absolute;
            top:40%;
            left: 20%;
		}
        .page span{
            font-size:22px;
            line-height:40px;
            display: block;

        }
        .page .text{
            background:rgba(51,51,51,0.9);
            padding: 10px;
            border-radius: 5px;
            color:#fff;
        }

		.page img{
			position:absolute;
			display:block;
			width:60%;
			top:15%;
		}
        #second{
            font-size:25px;
        }
		.page .button{
			position:absolute;
			top:55%;
			height:30px;
			width:100%;
		}
		.page .button p{
			width:60%;
			font-size:20px;
			line-height:40px;
			text-align:center;
			background-color:#38B2FF;
			border-radius:3px;
			color:#fff;	
		}
		
	</style>
</head>
<body>

	<div class="page">

            <span class="text">书币充值中,请勿退出...<span id="second">9</span></span>

	</div>
</body>
<script src="//apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
	window.onload = function(){
		interval();
		var time;
		var num;
		function interval(){
			num = parseInt(document.getElementById('second').innerHTML);
			    time = setInterval(function(){
				if(num < 0){
					clearInterval(time);
					location.href = "{!! $url !!}";
				}else{
					ajax();
					document.getElementById('second').innerHTML = num--
				}
			},1000)
		}
		
		function ajax(){
			$.ajax({
				url:"/api/order/issuccess",
				data:{
					order:"{{ $order }}"
				},
				success:function(res){
					if(res['code'] == 0){
						clearInterval(time);
						location.href = "{!! $url !!}";
						
					}
					
				}
			});
		}
	}
</script>
</html>	
	