PC端 微信支付 扫码之后页面跳转处理


其实就是用Ajax异步刷新去后台轮询、


if(payType == 'wxPay'){
    		$.ajax({
    	        url: "********",
    	        type: "post",
    	        data: {
    	        	oId: oId
    	        },
    	        success: function(result) {
    	            if(result == 'orderError'){
    	            	alert("订单信息异常...");
    	            	return false;
    	            }else{
    	            	var url = result;
    	            	jQuery('#qrcode').qrcode(url);
    	            	$(".orderBoxPay").hide();
    	            	$(".wxpay-box").slideDown("fast");
			            $(".markall").css({
			                display:"block",
			                height:document.body.clientHeight+"px",
			            });
			            
			            var repeat = 200;  // 限制执行次数为200次
			            var timer = setInterval(function() {    
			                if (repeat == 0) {
			                    clearInterval(timer);
			                    //处理页面提示信息
			                } else {
			                	//Ajax后台轮询 查询订单状态
			                	$.ajax({
					    	        url: "${path}/pages/order/checkOrderStatus",
					    	        type: "post",
					    	        data: {
					    	        	oId: oId
					    	        },
					    	        success: function(result) {
					    	            if(result == '1'){
					    	            	clearInterval(timer);
					    	            	window.location.href = "********";
					    	            }
					    	        }
					    	    });
			                	
			                    repeat--;
			                }
			            }, 3000);//3秒执行一次 总共200次 10分钟
    	            }
    	        }
    	    });
    	}


你可能感兴趣的:(其他)