You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
3.2 KiB
JavaScript

$(function() {
//钱的数量选择
$(".select-box-soon>div:not(.price-input)").click(function(){
$(this).addClass("selectBg").siblings("div").removeClass("selectBg");
let price = $(this).text().replace("元","");
$('#amount').val(price);
$(".price-show div span").text(price);
$(".price-input input").val("");
});
//输入金额事件
$(".price-input input").bind("input propertychange",function(event){
$(".price-show div span").text($(".price-input input").val());
$('#amount').val($(".price-input input").val());
$(".select-box-soon>div:not(.price-input)").removeClass("selectBg");
});
//支付方式选择
$(".way-select>div").click(function(){
$(this).addClass("wayBg").siblings("div").removeClass("wayBg");
let way = $(this).text();
$(".way-show>div>span").text(way);
$("#apitype").val($(this).data('type'));
});
$(".recharge-btn").click(function () {
var that = $('#recharge_form');
if($.trim($("#toaccount2").val()).length == 0){
layer.msg("充值账号不能为空!");
return false;
}
if($.trim($("#retoaccount2").val()) != $.trim($("#toaccount2").val())){
layer.msg("两次账号不相同!");
return false;
}
if(parseFloat($("#amount").val()) <=0){
layer.msg("充值金额不正确");
return false;
}
var apitype = $("#apitype").val();
if (apitype == 'weixin') {
var loading = new Cute.ui.dialog().loading('加载中...',{mask:true});
Cute.api.post("/media.php/Recharge/beginPay",that.serialize(), function(json){
loading.close();
if(json.status > 0){
that.dialog = new Cute.ui.dialog().layer('微信扫码支付',{
content: json.html,
mask: true,
open:{
// callback: function(){
// that.timer = setInterval(function(){
// Cute.api.post('pay/wx_order_query',{'order_no':json.data.out_trade_no}, function(data){
// if(data.status > 0){
// pay_callback();
// clearInterval(that.timer);
// }
// });
// },4000);
// }
},
buttons: [{
title: '已完成支付',
type: 'main',
close: true,
// func: function(){
// location.href = "/account/order.html";
// }
}, {
title: '重新选择',
type: 'cancel',
close: true
}]
});
}else{
new Cute.ui.dialog().alert(json.info);
}
});
} else {
$("#recharge_form").submit();
}
});
});