// pages/member/myOrder/orderVerification/orderVerification.js var app = getApp(); Page({ /** * 页面的初始数据 */ data: { order_id: '', api: "", showQrcode: false, customForm: [], }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { if (options.order_id) { this.setData({ order_id: options.order_id }); } if (options.api) { this.setData({ api: options.api }); } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function() { }, /** * 生命周期函数--监听页面显示 */ onShow: function() { this._initData(); this._verification(); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function() { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { }, /** * 用户点击右上角分享 */ onShareAppMessage: function() { }, _initData() { this.setData({ showQrcode: false, }); }, _verification() { let that = this; let urlStr = app.getNetAddresss(this.data.api); urlStr += '&order_id=' + this.data.order_id; app._getNetWork({ url: urlStr, success: function(resdata) { var res = resdata.data; let form = []; if (res.result == 1) { if (res.data.custom) { form = res.data.custom.form; } that.setData({ qrcode: res.data.miQrCodeUrl, showQrcode: true, customForm: form }); } else { wx.showToast({ title: res.msg, icon: 'none', duration: 1500, success: function() { setTimeout(function() { //要延时执行的代码 wx.navigateBack({ delta: 1 }); }, 1500); //延迟时间 }, }); } }, fail: function(res) { wx.showToast({ icon: 'none', title: res.msg, duration: 1500 }); wx.navigateBack({ delta: 1 }); } }); }, });