// pages/indexPages/workGuide/workGuide.js import { xcxqh, xcxxdzl } from "../../../apis/index" Page({ /** * 页面的初始数据 */ data: { type: null, business: {}, guideList: [], sfYy: false }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { let that = this that.init(options) }, init(e) { let that = this if (e) { if (e.type) { that.setData({ type: e.type }) if (e.type == 1) { wx.setNavigationBarTitle({ title: '预约取号', }) } if (e.type == 2) { wx.setNavigationBarTitle({ title: '手机取号', }) } } if (e.business) { that.setData({ business: JSON.parse(e.business) }) that.getBusiness() } } }, getBusiness() { let that = this wx.showLoading({ title: '正在查询所需资料...', }) xcxxdzl({ ywxxId: that.data.business.ywxxId }).then(res => { wx.hideLoading() if (res.code == 200) { that.setData({ guideList: res.list }) } else { wx.showToast({ title: res.msg || res.message, icon: "none", duration: 5000 }) } }) }, look(e) { let item = e.currentTarget.dataset.item wx.downloadFile({ url: 'https://smzc-1253299035.cos.ap-nanjing.myqcloud.com/printFile/04801d95d4a24092b96a58d5bab32f14.pdf', success: function (res) { const filePath = res.tempFilePath wx.openDocument({ filePath: filePath, success: function (res) { console.log('打开文档成功') } }) } }) }, toYy() { let that = this wx.navigateTo({ url: '../yyqhPages/selectTime/selectTime?business=' + JSON.stringify(that.data.business), }) }, toPd() { let that = this let sfYy = that.data.sfYy if (!sfYy) { that.setData({ sfYy: true }) wx.showLoading({ title: '正在取号...', }) xcxqh({ ywId: that.data.business.ywId, ywxxId: that.data.business.ywxxId, unionid: wx.getStorageSync('PUBLIC_ID').unionid }).then(res => { that.setData({ sfYy: false }) wx.hideLoading() if (res.code == 200) { wx.setStorageSync('QH', res.data) wx.reLaunch({ url: '../ssqhPages/success/success?business=' + JSON.stringify(that.data.business), }) } else { wx.showToast({ title: res.msg || res.message, icon: "none", duration: 5000 }) } }) } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })