var data = {
userCarIds: newArrlist, //商品id
addressId: this.data.addressId, //地址id
userCouponId: this.data.cut, //优惠券id
}
apis.CreateOrderByUserCar(data).then(res => {//支付提交接口(返回支付接口需要的5个字段
) wx.requestPayment({//调用微信支付
timeStamp: res.data.payEntity.timeStamp,
nonceStr: res.data.payEntity.nonceStr,
package: res.data.payEntity.package,
signType: 'MD5',
paySign: res.data.payEntity.paySign,
success(res) {
wx.redirectTo({
url: '/pages/order/order?id=' + 2,//支付成功返回待发货页面(自定义)
})
},
fail(err) {
console.log(err);
if (err.errMsg == "requestPayment:fail cancel") {
wx.navigateTo({
url: '/pages/order/order?id=' + 1,//支付失败执行代码
})
}
}
})
})