success.js 4.1 KB

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