微信支付完成 vue 页面不跳转问题

遇到的问题是 vue 调用微信支付 回调成功以后,页面路由不跳转。

解决的办法是用window.location.href

/**
* @method 支付费用方法
* @param data:后台返回的支付对象,(详情微信公众号支付API中H5提交支付);
*/
onBridgeReady(params){
var vm = this;
WeixinJSBridge.invoke(
'getBrandWCPayRequest',params,
function(res){
// 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
// if(localStorage.getItem('activityId')=='4'){
// alert(JSON.stringify(res));
// }
var temp =res.err_msg;
if(temp.indexOf('ok')>-1){
// this.$router.push('/payShare');
window.location.href = "https://www.lnart.com/vipidea-subscribe/index.html#/payShare"
}else{
alert("支付失败")
}
// if(res.err_msg == "get_brand_wcpay_request:ok" ){
// this.$router.push('/payShare');
// this.addaddress();
// window.location.href = "https://www.lnart.com/vipidea-subscribe/index.html#/payShare"
// }else{
// this.$message({
// message: '支付失败',
// type: 'warning'
// });
// }
}
);
},
 

猜你喜欢

转载自www.cnblogs.com/wupeng88/p/11780338.html