|
|
<!DOCTYPE html>
|
|
|
<html lang="en">
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
|
<title>充值中心</title>
|
|
|
<script src="__JS__/jquery-1.11.3.min.js"></script>
|
|
|
<script type="text/javascript" src="__JS__/getRem.js"></script>
|
|
|
<link rel="stylesheet" type="text/css" href="__CSS__/reset.css">
|
|
|
<link rel="stylesheet" type="text/css" href="__CSS__/foot_tabbar.css">
|
|
|
<link rel="stylesheet" type="text/css" href="__CSS__/recharge.css">
|
|
|
</head>
|
|
|
<body>
|
|
|
<div class="recharge">
|
|
|
<div class="recharge-heard">
|
|
|
<!-- 子页公共头部 -->
|
|
|
<div class="subpage-heard">充值中心
|
|
|
<a href="{:U('/User/index')}" class="arrows"></a>
|
|
|
</div>
|
|
|
<div class="recharge-tabbar">
|
|
|
<li class="selected" name="currency">平台币充值</li>
|
|
|
<li name="iscurrency">折扣充值</li>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="content">
|
|
|
|
|
|
<div class="recharge-flat" >
|
|
|
<form class="" id="form1" action="{:U('User/recharge')}" method="post">
|
|
|
<div class="flat-box">
|
|
|
<div class="flat-info">
|
|
|
<div>充值账户</div>
|
|
|
<input type="hidden" class="txt" name="account" value="{:session('suser_auth.account')}" readonly="readonly" placeholder="请输入充值账户">
|
|
|
<span>{:session('suser_auth.account')}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="flat-box">
|
|
|
<div class="flat-info">
|
|
|
<div>充值金额</div>
|
|
|
<input type="text" class="rcmoney1" name="pay_amount" placeholder="请输入金额,最低金额1元" style="text-align:right;width: 2.88rem">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="flat-box">
|
|
|
<div class="flat-info">
|
|
|
<div>获得平台币</div>
|
|
|
<input type="text" class="rcplatform" name="balance" readonly placeholder="" value="" style="text-align:right;">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="recharge-payment">
|
|
|
<div class="title">请选择支付方式</div>
|
|
|
<div class="alipay">
|
|
|
<div class="alipay_img">
|
|
|
<img src="__IMG__/zhifubaozhifu.png" alt="">
|
|
|
<div class="img_text">
|
|
|
<div>支付宝支付</div>
|
|
|
<div>推荐支付宝用户使用</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="radio_select">
|
|
|
<input id="zhifubao" name="way" type="radio" value="1" checked>
|
|
|
<label for="zhifubao" class="radio-label"></label>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
<div class="alipay" id="ch_weixin">
|
|
|
<div class="alipay_img">
|
|
|
<img src="__IMG__/weixin.png" alt="">
|
|
|
<div class="img_text">
|
|
|
<div>微信支付</div>
|
|
|
<div>推荐微信用户使用</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="radio_select">
|
|
|
<input id="weixin" name="way" type="radio" value="2" >
|
|
|
<label for="weixin" class="radio-label"></label>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div style="text-align: center;">
|
|
|
<input type="hidden" name="spendType" value="1">
|
|
|
<div class="payment_btn" style="margin-left: 1rem;">
|
|
|
确认支付</div>
|
|
|
</div>
|
|
|
</form>
|
|
|
</div>
|
|
|
<div class="recharge-discount" style="display: none;">
|
|
|
<form class="" id="form2" action="{:U('User/recharge')}" method="post">
|
|
|
<div class="flat-box">
|
|
|
<div class="flat-info">
|
|
|
<div>充值账户</div>
|
|
|
<input type="hidden" class="txt" name="account" value="{:session('suser_auth.account')}" readonly="readonly" placeholder="请输入充值账户">
|
|
|
<span>{:session('suser_auth.account')}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="flat-box">
|
|
|
<div class="flat-info">
|
|
|
<div>选择游戏</div>
|
|
|
<select name="game_id" id="game_id">
|
|
|
<option value="">请选择游戏</option>
|
|
|
<volist name="gameList" id="vo">
|
|
|
<option value="{$vo.id}" data-radio="{$vo.bind_recharge_discount}">{$vo.game_name}</option>
|
|
|
</volist>
|
|
|
</select>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="flat-box">
|
|
|
<div class="flat-info">
|
|
|
<div>充值金额</div>
|
|
|
<input type="text" class="txt rcmoney" id="pay_amount" name="pay_amount" placeholder="请输入金额,最低金额1元" style="width:2.88rem;text-align:right;">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="flat-box">
|
|
|
<div class="flat-info">
|
|
|
<div>折扣比例</div>
|
|
|
<input type="text" class="txt discount" value="" readonly style="color: #FE9C22;text-align:right;">
|
|
|
|
|
|
<input class="rcratio" name="ratio" type="hidden" value="" style="text-align:right;">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="flat-box">
|
|
|
<div class="flat-info">
|
|
|
<div>实付金额</div>
|
|
|
<input type="text" class="txt realmoney" name="realmoney" readonly style="text-align:right;">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="flat-box">
|
|
|
<div class="flat-info">
|
|
|
<div>获得绑币</div>
|
|
|
<input type="text" class="txt rcplatform" name="rcplatform" readonly style="text-align:right;">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="recharge-payment">
|
|
|
<div class="title">请选择支付方式</div>
|
|
|
<div class="alipay">
|
|
|
<div class="alipay_img">
|
|
|
<img src="__IMG__/zhifubaozhifu.png" alt="">
|
|
|
<div class="img_text">
|
|
|
<div>支付宝支付</div>
|
|
|
<div>推荐支付宝用户使用</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="radio_select">
|
|
|
<input id="zhifubao1" name="way" type="radio" value="1" checked>
|
|
|
<label for="zhifubao1" class="radio-label"></label>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
<div class="alipay" id="ch_weixin1">
|
|
|
<div class="alipay_img">
|
|
|
<img src="__IMG__/weixin.png" alt="">
|
|
|
<div class="img_text">
|
|
|
<div>微信支付</div>
|
|
|
<div>推荐微信用户使用</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="radio_select">
|
|
|
<input id="weixin1" name="way" type="radio" value="2" >
|
|
|
<label for="weixin1" class="radio-label"></label>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div style="text-align: center;">
|
|
|
<input type="hidden" name="spendType" value="1">
|
|
|
<div class="payment_btn" style="margin-left: 1rem;">
|
|
|
确认支付</div>
|
|
|
</div>
|
|
|
</form>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
<!--<div class="popmsg pop-dialog"></div>-->
|
|
|
</body>
|
|
|
<script type="text/javascript" src="__JS__/recharge.js"></script>
|
|
|
<script src="__JS__/pop.lwx.min.js"></script>
|
|
|
<script>
|
|
|
$(function() {
|
|
|
//var popmsg = $('.popmsg').pop();
|
|
|
if (isWeiXin() || !is_mobile()) {
|
|
|
$('#ch_weixin').hide();
|
|
|
$("#recharge_weixin").hide();
|
|
|
}
|
|
|
if(isWeiXin()){
|
|
|
//popmsg.msg('请点击右上角按钮,选择在浏览器中打开去充值');
|
|
|
alert('请点击右上角按钮,选择在浏览器中打开去充值');
|
|
|
}
|
|
|
$('.jstab .btn').click(function() {
|
|
|
var that = $(this),parent = that.closest('.jstab'),sib=parent.siblings('.jslist');
|
|
|
parent.find('.btn').removeClass('active');
|
|
|
var index = that.addClass('active').closest('li').index();
|
|
|
sib.find('.t-tabpan').eq(index).addClass('active').siblings().removeClass('active');
|
|
|
return false;
|
|
|
});
|
|
|
$('.jssbtn').click(function() {
|
|
|
var that = $(this);
|
|
|
if (that.hasClass('on')) {
|
|
|
that.removeClass('on');
|
|
|
} else {
|
|
|
that.closest('.table').find('.jssbtn').removeClass('on');
|
|
|
that.addClass('on');
|
|
|
}
|
|
|
});
|
|
|
$('#game_id').change(function() {
|
|
|
var that = $(this),cur = that.find('option:selected');
|
|
|
var ratio = cur.attr('data-radio');
|
|
|
var parent = that.closest('.recharge-discount');
|
|
|
var rr = parent.find('.rcratio');
|
|
|
var sib = rr.siblings('input');
|
|
|
var rm = parent.find('.realmoney');
|
|
|
var rc = parent.find('.rcmoney').val();
|
|
|
rr.val('');sib.val('');
|
|
|
if (ratio !='0.00' && ratio != '') {
|
|
|
rr.val(ratio);
|
|
|
if (ratio) {
|
|
|
sib.val(ratio+'折');
|
|
|
}
|
|
|
|
|
|
if (rc) {
|
|
|
if (!ratio) {
|
|
|
ratio = 10;
|
|
|
}
|
|
|
var rmnum = Math.floor(ratio*100 * rc/10)/100;
|
|
|
rm.val(rmnum);
|
|
|
}
|
|
|
} else {
|
|
|
sib.val(10+'折');
|
|
|
rr.val(10);
|
|
|
rm.val(rc);
|
|
|
}
|
|
|
});
|
|
|
$('.rcmoney').keyup(function() {
|
|
|
var that = $(this),val = $.trim(that.val()),parent=that.closest('.recharge-discount'),pf=parent.find('.rcplatform');
|
|
|
var rm = parent.find('.realmoney');
|
|
|
if(val == ""){return true;}
|
|
|
if (val) {
|
|
|
if (val>0 && /^(0|[1-9][0-9]*)$/.test(val)) {
|
|
|
pf.val(val);
|
|
|
if (rm) {
|
|
|
var ratio = $.trim(parent.find('.rcratio').val()) || 10;
|
|
|
var rmnum = Math.floor(ratio*100 * val/10)/100;
|
|
|
rm.val(rmnum);
|
|
|
}
|
|
|
} else {
|
|
|
popmsg.msg('请输入非零开头的正整数');that.val('').focus();
|
|
|
pf.val('');if(rm) {rm.val('');}
|
|
|
}
|
|
|
} else {
|
|
|
popmsg.msg('请输入充值金额');that.val('').focus();
|
|
|
pf.val('');if(rm) {rm.val('');}
|
|
|
}
|
|
|
});
|
|
|
$('.rcmoney1').keyup(function() {
|
|
|
var that = $(this),val = $.trim(that.val()),parent=that.closest('.recharge-flat'),pf=parent.find('.rcplatform');
|
|
|
var rm = parent.find('.realmoney');
|
|
|
if(val == ""){return true;}
|
|
|
if (val) {
|
|
|
if (val>0 && /^(0|[1-9][0-9]*)$/.test(val)) {
|
|
|
pf.val(val);
|
|
|
if (rm) {
|
|
|
var ratio = $.trim(parent.find('.rcratio').val()) || 10;
|
|
|
var rmnum = Math.floor(ratio*100 * val/10)/100;
|
|
|
rm.val(rmnum);
|
|
|
}
|
|
|
} else {
|
|
|
popmsg.msg('请输入非零开头的正整数');that.val('').focus();
|
|
|
pf.val('');if(rm) {rm.val('');}
|
|
|
}
|
|
|
} else {
|
|
|
popmsg.msg('请输入充值金额');that.val('').focus();
|
|
|
pf.val('');if(rm) {rm.val('');}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
function isWeiXin(){
|
|
|
var ua = window.navigator.userAgent.toLowerCase();
|
|
|
if(ua.match(/MicroMessenger/i) == 'micromessenger'){
|
|
|
return true;
|
|
|
}else{
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function is_mobile() {
|
|
|
var regex_match = /(nokia|iphone|android|motorola|^mot-|softbank|foma|docomo|kddi|up.browser|up.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte-|longcos|pantech|gionee|^sie-|portalmmm|jigs browser|hiptop|^benq|haier|^lct|operas*mobi|opera*mini|320x320|240x320|176x220)/i;
|
|
|
var u = navigator.userAgent;
|
|
|
if (null == u) {
|
|
|
return true;
|
|
|
}
|
|
|
var result = regex_match.exec(u);
|
|
|
if (null == result) {
|
|
|
return false
|
|
|
} else {
|
|
|
return true
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function validation(obj){
|
|
|
/* var account = obj.find('input[name="account"]').val();*/
|
|
|
var game_id = obj.find('select option:selected').val();
|
|
|
var pay_amount = obj.find('input[name="pay_amount"]').val();
|
|
|
/* if($.trim(account) == ''){
|
|
|
//popmsg.msg('请输入充值账号');
|
|
|
alert("请输入充值账号");
|
|
|
return false;
|
|
|
}*/
|
|
|
if(obj.attr('id') == 'form2' && $.trim(game_id) == ''){
|
|
|
//popmsg.msg('请选择充值游戏');
|
|
|
alert("请选择充值游戏");
|
|
|
return false;
|
|
|
}
|
|
|
if($.trim(pay_amount) == ''){
|
|
|
alert("请输入充值金额");
|
|
|
//popmsg.msg('请输入充值金额');
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
$('.payment_btn').click(function(){
|
|
|
var than = $(this),form = than.closest('form');
|
|
|
if(than.hasClass('disabled')) {
|
|
|
return false;
|
|
|
}
|
|
|
than.addClass('disabled');
|
|
|
if($("#form1 .on").val()==8){
|
|
|
$("#form1").attr("action","{:U('pay/goldpig')}");
|
|
|
if(validation($("#form1"))){
|
|
|
$("#form1").submit();
|
|
|
}else{
|
|
|
than.removeClass('disabled');
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
if($("#form2 .on").val()==8){
|
|
|
$("#form2").attr("action","{:U('pay/goldpig')}");
|
|
|
if(validation($("#form2"))){
|
|
|
$("#form2").submit();
|
|
|
}else{
|
|
|
than.removeClass('disabled');
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
if(validation(form)){
|
|
|
console.log(form.serialize())
|
|
|
$.ajax({
|
|
|
url:form.attr('active'),
|
|
|
type:"post",
|
|
|
dataType:"json",
|
|
|
data:form.serialize(),
|
|
|
success:function(result){
|
|
|
than.removeClass('disabled');
|
|
|
if(result.status == 1){
|
|
|
window.location.href = result.url;
|
|
|
}else{
|
|
|
popmsg.msg(result.info);
|
|
|
}
|
|
|
},
|
|
|
error:function(){
|
|
|
alert("服务端异常");
|
|
|
}
|
|
|
})
|
|
|
}else{
|
|
|
than.removeClass('disabled');
|
|
|
}
|
|
|
return false;
|
|
|
})
|
|
|
});
|
|
|
|
|
|
</script>
|
|
|
</html> |