master
zhengchanglong 5 years ago
parent 0b188b12bb
commit d9e75cd4c0

@ -34,13 +34,13 @@
<div class="flat-box"> <div class="flat-box">
<div class="flat-info"> <div class="flat-info">
<div>充值金额</div> <div>充值金额</div>
<input type="text" name="pay_amount" placeholder="请输入金额最低金额1元"> <input type="text" class="rcmoney" name="pay_amount" placeholder="请输入金额最低金额1元">
</div> </div>
</div> </div>
<div class="flat-box"> <div class="flat-box">
<div class="flat-info"> <div class="flat-info">
<div>充值账户</div> <div>获得平台币</div>
<span>22</span> <input type="text" class="rcplatform" name="balance" readonly placeholder="" value="">
</div> </div>
</div> </div>
</div> </div>
@ -48,13 +48,13 @@
<div class="flat-box"> <div class="flat-box">
<div class="flat-info"> <div class="flat-info">
<div>充值账户</div> <div>充值账户</div>
<span>Zz1213</span> <span>{:session('suser_auth.account')}</span>
</div> </div>
</div> </div>
<div class="flat-box"> <div class="flat-box">
<div class="flat-info"> <div class="flat-info">
<div>选择游戏</div> <div>选择游戏</div>
<select name="" id=""> <select name="" id="game_id">
<option value="">请选择游戏</option> <option value="">请选择游戏</option>
<option value="">落梦星辰</option> <option value="">落梦星辰</option>
</select> </select>
@ -103,7 +103,7 @@
</div> </div>
</div> </div>
<div class="alipay"> <div class="alipay" id="ch_weixin">
<div class="alipay_img"> <div class="alipay_img">
<img src="__IMG__/weixin.png" alt=""> <img src="__IMG__/weixin.png" alt="">
<div class="img_text"> <div class="img_text">
@ -119,6 +119,173 @@
</div> </div>
<div class="payment_btn">立即充值</div> <div class="payment_btn">立即充值</div>
</div> </div>
<!--<div class="popmsg pop-dialog"></div>-->
</body> </body>
<script type="text/javascript" src="__JS__/recharge.js"></script> <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('.jsinfo');
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);
sib.val(ratio+'折');
if (rc) {
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('.jsinfo'),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)){
$.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> </html>
Loading…
Cancel
Save