pdjl.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. // pages/recordPages/pdjl/pdjl.js
  2. import {
  3. xcxsxph
  4. } from "../../../apis/index"
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. infos: {},
  11. nowTime: "",
  12. timer: null
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad(options) {
  18. let that = this
  19. that.init(options)
  20. that.setData({
  21. nowTime: that.getTime()
  22. })
  23. },
  24. init(e) {
  25. let that = this
  26. if (e) {
  27. if (e.infos) {
  28. let infos = JSON.parse(e.infos)
  29. that.setData({
  30. infos: infos
  31. })
  32. that.sx()
  33. }
  34. }
  35. },
  36. sx() {
  37. let that = this
  38. let infos = that.data.infos
  39. wx.showLoading({
  40. title: '加载中...',
  41. })
  42. xcxsxph({
  43. bsfwtDm: infos.bsfwtDm,
  44. phhm: infos.ticketNum,
  45. qpsj: infos.createTime
  46. }).then(res => {
  47. wx.hideLoading()
  48. if (res.code == 200) {
  49. that.setData({
  50. infos: res.data
  51. })
  52. if (res.data.phzt == 0) {} else {
  53. if (res.data.fwztDm == 0) {
  54. wx.showModal({
  55. title: '提示',
  56. content: '当前已叫到您的号码,请立即前往' + res.data.ckhm + "窗口进行办理业务。",
  57. })
  58. } else {
  59. wx.showModal({
  60. title: '提示',
  61. content: '当前号码已经叫过了,请前往' + res.data.ckhm + "窗口进行咨询。"
  62. })
  63. }
  64. }
  65. } else {
  66. wx.showToast({
  67. title: res.msg || res.message,
  68. icon: "none",
  69. duration: 5000
  70. })
  71. }
  72. })
  73. },
  74. getTime() {
  75. let date = new Date()
  76. let y = date.getFullYear()
  77. let m = date.getMonth() + 1 < 10 ? '0' + date.getMonth() + 1 : date.getMonth() + 1
  78. let d = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
  79. let h = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
  80. let mm = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
  81. let ss = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
  82. return y + '-' + m + '-' + d + ' ' + h + ':' + mm + ':' + ss
  83. },
  84. /**
  85. * 生命周期函数--监听页面初次渲染完成
  86. */
  87. onReady() {
  88. },
  89. /**
  90. * 生命周期函数--监听页面显示
  91. */
  92. onShow() {
  93. let that = this
  94. let timer = that.data.timer
  95. clearInterval(timer)
  96. timer = setInterval(() => {
  97. that.setData({
  98. nowTime: that.getTime()
  99. })
  100. }, 1000);
  101. that.setData({
  102. timer: timer
  103. })
  104. },
  105. /**
  106. * 生命周期函数--监听页面隐藏
  107. */
  108. onHide() {
  109. let that = this
  110. let timer = that.data.timer
  111. clearInterval(timer)
  112. that.setData({
  113. timer: null
  114. })
  115. },
  116. /**
  117. * 生命周期函数--监听页面卸载
  118. */
  119. onUnload() {
  120. let that = this
  121. let timer = that.data.timer
  122. clearInterval(timer)
  123. that.setData({
  124. timer: null
  125. })
  126. },
  127. /**
  128. * 页面相关事件处理函数--监听用户下拉动作
  129. */
  130. onPullDownRefresh() {
  131. },
  132. /**
  133. * 页面上拉触底事件的处理函数
  134. */
  135. onReachBottom() {
  136. },
  137. /**
  138. * 用户点击右上角分享
  139. */
  140. onShareAppMessage() {
  141. }
  142. })