// pages/salesOrderMan/info.js const app = getApp() var QRCode = require('../../utils/weapp-qrcode.js'); Page({ /** * 页面的初始数据 */ data: { info: {}, orderStatusArray:[], //订单状态 orderTypeArray:[],//订单类型 }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { //字典数据 let treeData = app.globalData.treeArr for (const element of treeData) { let arrStr; switch (element.dictValue) { case 'order_status': arrStr = "orderStatusArray"; break; case 'order_type': arrStr = "orderTypeArray"; break; } this.setData({ [arrStr]: element.children }) } //获取详情 var pages = getCurrentPages(); var prevPage = pages[pages.length - 2]; let getInfo = prevPage.data.resData[options.index] this.setData({ info:getInfo }) if(getInfo.orderStatus == '3'){ this.makeCode(JSON.stringify({ "id": getInfo.id, "orderName":getInfo.orderName, "orderNumber":getInfo.orderNumber, "type":'1' })) } }, // 二维码 makeCode(data) { var qrcode; qrcode = new QRCode('canvas', { text: data, width: 220, height: 220, colorDark: "#000000", colorLight: "#ffffff", correctLevel: QRCode.CorrectLevel.H, }); qrcode.makeCode(data); }, //查询详情 getInfo: function (id) { //详情 app.request.GET({ url: app.API.appointDetail, page: this, params: { 'id': id }, successFun: true }).then(res => { let getInfo = res.data.data; this.setData({ info: getInfo, accessControlAuth:JSON.parse(getInfo.accessControlAuth) }) }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })