// pages/indexPages/ssqhPages/success/success.js import { xcxsxph } from "../../../../apis/index" Page({ /** * 页面的初始数据 */ data: { business: {}, infos: {}, nowTime: "", timer: null }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { let that = this that.init(options) that.setData({ nowTime: that.getTime() }) }, init(e) { let that = this if (e) { if (e.business) { that.setData({ business: JSON.parse(e.business) }) } } let infos = wx.getStorageSync('QH') that.setData({ infos: infos }) wx.removeStorageSync('QH') }, brush() { let that = this let infos = that.data.infos wx.showLoading({ title: '正在刷新...', }) xcxsxph({ bsfwtDm: infos.bsfwtDm, phhm: infos.ticketNum, qpsj: infos.createTime }).then(res => { wx.hideLoading() if (res.code == 200) { if (res.data.phzt == 0) { that.setData({ infos: res.data }) } else { if (res.data.fwztDm == 0) { wx.showModal({ title: '提示', content: '当前已叫到您的号码,请立即前往' + res.data.ckhm + "窗口进行办理业务。", }) } else { wx.showModal({ title: '提示', content: '当前号码已经叫过了,请前往' + res.data.ckhm + "窗口进行咨询。" }) } } } else { wx.showToast({ title: res.msg || res.message, icon: "none", duration: 5000 }) } }) }, lookCl() { let that = this wx.navigateTo({ url: '../../workGuide/workGuide?business=' + JSON.stringify(that.data.business), }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, getTime() { let date = new Date() let y = date.getFullYear() let m = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 let d = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() let h = date.getHours() < 10 ? '0' + date.getHours() : date.getHours() let mm = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes() let ss = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds() return y + '-' + m + '-' + d + ' ' + h + ':' + mm + ':' + ss }, /** * 生命周期函数--监听页面显示 */ onShow() { let that = this let timer = that.data.timer clearInterval(timer) timer = setInterval(() => { that.setData({ nowTime: that.getTime() }) }, 1000); that.setData({ timer: timer }) }, /** * 生命周期函数--监听页面隐藏 */ onHide() { let that = this let timer = that.data.timer clearInterval(timer) that.setData({ timer: null }) }, /** * 生命周期函数--监听页面卸载 */ onUnload() { let that = this let timer = that.data.timer clearInterval(timer) that.setData({ timer: null }) }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })