wx.redirectTo
我在电脑端的微信开发者工具中正常跳转,但是手机扫码预览不跳转;
求教,有谁遇到过类似问题吗
wx.requestPayment的fail在真机测试中未触发。以下为实例代码
-----------------------------------------------------------------
wx.request({
url: ‘*****************’,
data: {
openid: openidGet,
out_trade_no: that.data.OrderNumber,
vipmeal_name: that.data.name,
price: that.data.payment
},
method: ‘POST’, // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
header: {
‘content-type’: ‘application/x-www-form-urlencoded’
},
success: function (res) {
//返回正确的预支付交易后调起支付
var appid = res.data.Wechat.PayForm.APPID;
var timeT = res.data.Wechat.PayForm.Timestamp;
var noceStrT = res.data.Wechat.PayForm.Noncestr;
var prepayIDT = res.data.Wechat.PrepayID;
wx.requestPayment({
appId: appid,
timeStamp: timeT,
nonceStr: noceStrT,
package: “prepay_id=” + prepayIDT,
signType: ‘MD5’,
paySign: res.data.Wechat.PayForm.Sign,
success: function (res) {
// success
wx.redirectTo({
url: ‘…/my/paySuccess/paySuccess?orderNumber=’ + that.data.OrderNumber
})
},
fail: function (res) {
// fail
console.log("-----fail-----",res)
wx.redirectTo({
url: ‘…/my/payDefeat/payDefeat?orderNumber=’ + that.data.OrderNumber + ‘&payment=’ + that.data.payment
})
},
complete: function (res) {
// complete
}
})
},
fail: function (res) {
// fail
},
complete: function (res) {
// complete
}
});