52,797
社区成员
发帖
与我相关
我的任务
分享
if(ptype==1){
fnAjax.appAjax({
url: api_url,
async:false,
data: iPayParam,
success: function (obj) {
if (obj['code'] == 1) {
iPayParam['deal_id'] = obj['payment_index'];
console.log(obj['payment_index']);
//iPayParam['fee'] = obj['payment_fee'];
window.open("/pcmall/Wxpay/example/native.php?payment_index="+obj['payment_index']+"&fee="+obj['payment_fee']);
$('#ceng2').css("display","block");
$('#loadingToast').css("display","none");
} else {
Toast.msg.showByCode(obj['code']);
onSubmit = false;
}
},
error: function (obj) {
onSubmit = true;
Loading.hide();
Toast.msg.error(JSON.stringify(obj));
}
});
}
$submitBtn.click(function () {
Pay.getUserInfo(function () {
if (iPayCash > 0) {
if (AppWeb.inWechat) {
Loading.show();
makeRechargeOrder();
} else {
Loading.show();
makeRechargeOrder();
}
}
});
});
//生成请求支付订单
function makeRechargeOrder() {
if (onSubmit) {
return;
}
var pay_voucher = sSwitch && sSwitch.classList.contains('mui-active') ? iPayVoucher : 0;
var api_url = '';
iPayParam = {
consumer_openid: gOpenId,
type: gOrderType,//订单类型
pay_type: ptype,//支付类型
payment_fee: (iPayCash).mul(0.01),
voucher: (pay_voucher).mul(0.01),
order_id: gOrderId
};
switch (gOrderType) {
case '1':
//商城订单
api_url = '/pcmall/mall.php?c=recharge/recharge_order';
break;
case '2':
//充值订单
api_url = '/pcmall/mall.php?c=recharge/pre_recharge_order'; //
break;
case '3':
//套餐订单
api_url = '/app/mall.php?c=package/package_recharge_order';
break;
case '4':
//一元购
api_url = '/app/mall.php?c=recharge/recharge_orderOneDollarSpike';
iPayParam.url = '/app/mall.php?c=recharge/recharge_orderOneDollarSpike';
iPayParam.activity_type = 1;
iPayParam.type=1;
iPayParam.token=gToken;
iPayParam.device_index=gDeviceIndex;
break;
default:
api_url = '/app/mall.php?c=recharge/recharge_order';
break;
}
if(ptype==1){
fnAjax.appAjax({
url: api_url,
async:false,
data: iPayParam,
success: function (obj) {
if (obj['code'] == 1) {
iPayParam['deal_id'] = obj['payment_index'];
console.log(obj['payment_index']);
//iPayParam['fee'] = obj['payment_fee'];
window.open("http://app.97xgx.com/pcmall/Wxpay/example/native.php?payment_index="+obj['payment_index']+"&fee="+obj['payment_fee']);
$('#ceng2').css("display","block");
$('#loadingToast').css("display","none");
} else {
Toast.msg.showByCode(obj['code']);
onSubmit = false;
}
},
error: function (obj) {
onSubmit = true;
Loading.hide();
Toast.msg.error(JSON.stringify(obj));
}
});
}