<?php
$title='余额充值';
include __DIR__ . '/head.php';
?>
<div class="row">
	<div class="col-xl-12">
		<div class="col">
		    <div class="card">
		        <div class="card-body">

					<div class="row mb-3">
	                    <div class="col-sm-10 offset-sm-2">
							<div class="input-group  mb-3">
								<div class="input-group-text">当前余额</div>
								<input type="text" class="form-control" value="<?php echo $userrow['rmb']?>" disabled="disabled">
								<span class="input-group-text">元</span>
							</div>
	                    </div>
	                </div>
					<div class="row mb-3">
	                    <div class="col-sm-10 offset-sm-2">
							<div class="input-group  mb-3">
								<div class="input-group-text">充值金额</div>
								<input type="number" class="form-control" value="10" name="money" placeholder="Username">
								<span class="input-group-text">元</span>
							</div>
	                    </div>
	                </div>

					<div class="row mb-3">
	                    <div class="col-sm-10 offset-sm-2">
						<?php 
						if($conf['alipay_api'])echo '<span class="btn btn-primary m-b-xs" onclick="dopay(\'alipay\')"><img src="../assets/img/alipay.png" style="width:20px;margin-right:5px;">余额付款</span>&nbsp;';
						if($conf['qqpay_api'])echo '<span class="btn btn-danger m-b-xs" onclick="dopay(\'qqpay\')"><img src="../assets/img/qqpay.png" style="width:20px;margin-right:5px;">QQ钱包</span>&nbsp;';
						if($conf['wxpay_api'])echo '<span class="btn btn-success m-b-xs" onclick="dopay(\'wxpay\')"><img src="../assets/img/wxpay.png" style="width:20px;margin-right:5px;">微信支付</span>&nbsp;';
						?>
	                    </div>
	                </div>
		        <a href="javascript:history.back(-1)">返回上一层</a>
		        </div>
		    </div>
		</div>
	</div>
</div>
		    </div>
		</div>
        <!-- Javascripts -->
        <script src="../assets/js/jquery.min.js"></script>
        <script src="../assets/template/js/core@2.js"></script>
        <script src="../assets/js/bootstrap.min.js"></script>
        <script src="../assets/template/js/feather-icons.js"></script>
        <script src="../assets/template/js/perfect-scrollbar.min.js"></script>
        <script src="../assets/template/js/main.min.js"></script>
        <script src="../assets/layer/layer.js"></script>
    </body>
</html>
<script type="text/javascript">
	function dopay(type){
		var money = $("input[name='money']").val();
		if(money=='' || money==0){layer.alert('充值金额不能为空');return false;}
		var ii = layer.load(2, {shade:[0.1,'#fff']});
		$.get("ajax.php?act=recharge&type="+type+"&money="+money, function(data) {
			if(data.code == 0){
				window.location.href='../other/submit.php?type='+type+'&orderid='+data.trade_no;
			}else{
				layer.close(ii);
				layer.alert(data.msg);
			}
		}, 'json');
	}
</script>