var localPaymentWay = "25"; var localOrderId = ""; var localOrderCode = ""; var localTotalPrice = ""; function changePaymentWay(type){ localPaymentWay = type; } $(function(){ var member = userInfo.getMember(); $("#accountBalance").html("¥"+member.accountBalance); //if(util.getLSItem("terminalType")=="mobile"){ // $("#alipayRadio").css("display","inline-block"); // $("#alipaySpan").css("display","inline-block"); //}else{ // $("#wechatRadio").css("display","inline-block"); // $("#wechatSpan").css("display","inline-block"); //} var obj = util.getQueryString(); localOrderId = obj.id; getPaymentOrderInfo(obj.id); }); function getPaymentOrderInfo(id){ //查询订单详情 util.sendAjax({ url:'/finance/order/'+id, data:{}, async:false, type:'GET', cache:false, success:function(json){ if(json.rc ==0){ localOrderCode = json.data.orderCode; localTotalPrice = json.data.totalPrice; $("#orderCode").html("订单编号:"+json.data.orderCode); $("#totalPrice").html("订单总额:"+json.data.totalPrice+" 元"); $("#createDate").html("提交时间:"+json.data.addTime); if(json.data.isMatch=="0"){ if(util.getLSItem("terminalType")=="mobile"){ $("#alipayRadio").css("display","inline-block"); $("#alipaySpan").css("display","inline-block"); }else{ $("#wechatRadio").css("display","inline-block"); $("#wechatSpan").css("display","inline-block"); } } }else{ layer.open({ content: "获取订单信息失败,错误代码:"+json.rc+"错误信息:"+json.msg ,skin: 'msg' ,time: 2 //2秒后自动关闭 }); } } }); } /** * 订单支付 */ function payOrder(){ if(util.getLSItem("terminalType")=="mobile"){ var title = "会员中心移动端订单支付"; var price = localTotalPrice; var describe = "会员中心移动端订单编号:"+localOrderCode+"支付"+localTotalPrice+"元。"; if(localPaymentWay=="1"){ if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { getOrderInfomation(localOrderId, title, price, describe); } else if (/(Android)/i.test(navigator.userAgent)) { window.js.getOrderInfomation(localOrderId, title, price, describe); } }else { util.sendAjax({ url:'open/balpay/pay/'+localOrderId, data:{}, async:false, type:'GET', cache:false, success:function(json){ if(json.rc ==0){ layer.open({ content: "会员余额支付成功!" ,btn: '确定' ,yes: function(index){ window.location.href="myOrders.html"; } }); }else{ layer.open({ content: "会员余额支付失败,错误代码:"+json.rc+"错误信息:"+json.msg ,skin: 'msg' ,time: 2 //2秒后自动关闭 }); } } }); } }else{ if(localPaymentWay=="24"){ window.location.href="http://vip.chongaibao.com/wx/pay/pay.php?orderId=" + localOrderId; }else{ util.sendAjax({ url:'open/balpay/pay/'+localOrderId, data:{}, async:false, type:'GET', cache:false, success:function(json){ if(json.rc ==0){ layer.open({ content: "会员余额支付成功!" ,btn: '确定' ,yes: function(index){ window.location.href="myOrders.html"; } }); }else{ layer.open({ content: "会员余额支付失败,错误代码:"+json.rc+"错误信息:"+json.msg ,skin: 'msg' ,time: 2 //2秒后自动关闭 }); } } }); } } }