//提交预约订单 wx.request({ url: 'http://www.pusonglin.cn/app/index.php?i=2&c=entry&do=api&op=addOrder&m=aiunv_book' , data: e.target.dataset, header: { 'content-type' : 'application/json' }, success: function (res) { console.log(res.data) let status = res.data.status; if (status == 1) { console.log( '预定成功' ) wx.showToast({ title: '成功' , icon: 'success' , duration: 2000, success:function(){ console.log( 'haha' ); setTimeout(function () { //要延时执行的代码 wx.switchTab({ url: '../user/user' }) }, 2000) //延迟时间 } }) } if (status == 0) { console.log( '失败' ); } that.setData({ addrArray: res.data }); } }); |
另外,在内页做页面跳转需要用wx.switchTab。
转载自:https://www.cnblogs.com/pansidong/p/7651159.html