<?php
require 'config.php';
if (empty($_POST)) $_POST = $_GET;  //如果为GET方式访问
$payid = $_POST['payid'];
$money = $_POST['money'];
$actorid = $_POST['actorid'];
$serverid = $_POST['serverid'];
$rolename = $_POST['actorname'];
$accounts = $_POST["username"];
$gameprops="元宝";
if(!empty($payid) && $payid==100 && $money==28){
    //28元元宝月卡 $payid==100
    $gameprops="元宝月卡";
}else if(!empty($payid) && $payid==101 && $money==88){
    //88元特权月卡 $payid==101
    $gameprops="特权月卡";
}
$account =  $gameprops."_".$serverid."_".$rolename;
?>
<!DOCTYPE html>
<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<title>充值中心</title>
		<link rel="stylesheet" href="static/css/alert.css">
		<style>
			body {
				background-color: #f6f6f6;
				font-family: Tahoma, '黑体', Geneva, sans-serif;
				font-weight: 500;
				letter-Spacing: 0px
			}
			
			.title {
				width: 100%;
				height: 50px;
				line-height: 40px;
				box-sizing: border-box;
				padding: 0px 10px;
				line-height: 50px;
				font-size: 14px;
				color: #505050;
			}
			
			.paybox {
				width: 100%;
				height: 149px;
				box-sizing: border-box;
				padding: 0px 20px;
			}
			
			.paybox_cc {
				width: 100%;
				height: 100%;
				overflow: hidden;
				background-color: #fff;
				border-radius: 10px;
				box-sizing: border-box;
				box-shadow: #d6d6d6 1px 1px 5px 2px;
				padding: 0px 10px;
			}
			
			.paybox_pan {
				width: 100%;
				height: 50px;
				line-height: 50px;
				position: relative;
				overflow: hidden;
				font-size: 14px;
				box-sizing: border-box;
				border-bottom: 1px solid #e9e9e9;
			}
			
			.paybox_pan_s1 {
				position: absolute;
				left: 10px;
				color: #434343;
			}
			
			.paybox_pan_s2 {
				position: absolute;
				right: 10px;
				color: #818181;
			}
			
			.paysid {
				width: 100%;
				height: 199px;
				box-sizing: border-box;
				padding: 0px 20px;
			}
			
			.paysid_cc {
				width: 100%;
				overflow: hidden;
				background-color: #fff;
				border-radius: 10px;
				box-sizing: border-box;
				box-shadow: #d6d6d6 1px 1px 5px 2px;
				padding: 10px;
			}
			
			.paysid_s1 {
				position: absolute;
				width: 50px;
				height: 50px;
				overflow: hidden;
			}
			
			.paysid_s1 img {
				width: 30px;
				margin-top: 10px;
				margin-left: 7.5px;
				border-radius: 7px;
			}
			
			.paysid_s2 {
				position: absolute;
				left: 50px;
				overflow: hidden;
			}
			
			.paysid_s3 {
				position: absolute;
				right: 0;
				width: 50px;
				height: 50px;
				overflow: hidden;
				text-align: right;
			}
			
			.paysid_s3 img {
				height: 15px;
				margin-top: 17.5px;
				margin-right: 15px;
			}
			
			.pay_btn {
				width: 70%;
				text-align: center;
				height: 40px;
				line-height: 40px;
				margin-left: 15%;
				margin-top: 30px;
				border: 0;
				outline: none;
				background-color: #fe8f1c;
				color: #fff;
				font-size: 16px;
				border-radius: 5px;
			}
			
			.sms {
				width: 100%;
				box-sizing: border-box;
				font-size: 14px;
				padding: 10px 15px;
				text-align: justify;
				word-break: break-all;
				color: #6c6c6c;
			}
			
			.sms p {
				margin-top: 10px;
			}
			/*顶部标题栏*/
			header{
				width: 100%;
				height: 2rem;
				line-height:2rem;
				overflow: hidden;
			}
			.title-box {
				display:flex;
				background: #65BF67;
				padding:0 10px;
				color: #fff;
			}
			.title-box a{
				 color: #fff;
			}
			.title-left{
				text-align: left;
				display:flex;
			}
			 
			.title-right{
				display: flex;
				align-items: center;
				text-align: right;
			}
			 
			.title-center {
				flex:1;
				text-align: center;
			}
			.title-right img{height:25px;}
		</style>
		<script type="text/javascript" src="static/js/jquery.min.js"></script>
		<script type="text/javascript" src="static/js/alert.js"></script>
	</head>

	<body style="">
		<!--头部  star-->
		<!--<header>
			<div class="title-box">
				<span class="title-left"></span>
				<a class="title-center">充值中心</a>
				<a href="javascript:close();" class="title-right"><img src="static/img/close.png"></a>
			</div>
		</header>-->
		<!--头部 end-->
		<div class="box">
			<form action="<?php echo $payurl;?>" method="post" onsubmit="return checkFrom()">
			<div class="title">购买信息</div>
			<div class="paybox">
				<div class="paybox_cc">
					<div class="paybox_pan">
						<div class="paybox_pan_s1">充值角色</div>
						<div class="paybox_pan_s2"><?php echo $rolename?></div>
					</div>
					<div class="paybox_pan">
						<div class="paybox_pan_s1">购买道具</div>
						<div class="paybox_pan_s2"><?php echo $gameprops?></div>
					</div>
					<div class="paybox_pan">
						<div class="paybox_pan_s1">充值金额</div>
						<div class="paybox_pan_s2" style="color: red;font-weight: bold;font-size: 16px;"><?php echo $money?>元</div>
					</div>
				</div>
			</div>
			<div class="title">支付方式</div>
			<div class="paysid">
				<div class="paysid_cc">
					<div class="paybox_pan" onclick="paysgin(1)">
						<div class="paysid_s1">
							<img src="static/img/alipay.png">
						</div>
						<div class="paysid_s2">支付宝</div>
						<div class="paysid_s3">
							<img id="payid1" src="static/img/gouxuan.png">
						</div>
					</div>
					<div class="paybox_pan" onclick="paysgin(2)">
						<div class="paysid_s1">
							<img src="static/img/wxpay.png">
						</div>
						<div class="paysid_s2">微信支付</div>
						<div class="paysid_s3">
							<img id="payid2" src="static/img/quxiao.png">
						</div>
					</div>					
				</div>
			</div>
			<input type='hidden' name='money' value ='<?php echo $money;?>'/>
            <input type='hidden' name='account' value ='<?php echo $account;?>'/>
			<input type="hidden" id="paytype" name="paytype" value="1">
			<button class="pay_btn" type="submit">立即支付</button>
			</form>
		</div>
		<script type="text/javascript">
			var danxuan = 'static/img/quxiao.png';
			var xuanzhong = 'static/img/gouxuan.png';		
			function paysgin(s) {								
				for(x = 1; x < 3; x++) {
					if(x == s) {
						document.getElementById("payid" + x).src = xuanzhong;
						document.getElementById("paytype").value = s;
					} else {
						document.getElementById("payid" + x).src = danxuan;
					}
				}
			}
			//验证表单
			function checkFrom(){
				//充值账号
				var account=$("input[name='account']").val();
				if(account==''){
					$.alert("充值账号不能为空");
					return false;
				}
				//支付金额
				var money = $("input[name='money']").val();
				var regNumber=/^(?!(0[0-9]{0,}$))[0-9]{1,}[.]{0,}[0-9]{0,}$/;
				if(regNumber.test(money)==false){
					$.alert('金额必须为大于0的数字');
					$("input[name='money']").focus();
					return false;
				}
                return true;
            }
			function close(){
				//关闭父窗口
				window.parent.document.getElementById('dialog').style.display = 'none'
			}
		</script>

	</body>

</html>