workGuide.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. // pages/indexPages/workGuide/workGuide.js
  2. import {
  3. xcxqh,
  4. xcxxdzl
  5. } from "../../../apis/index"
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. type: null,
  12. business: {},
  13. guideList: [],
  14. sfYy: false
  15. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. onLoad(options) {
  20. let that = this
  21. that.init(options)
  22. },
  23. init(e) {
  24. let that = this
  25. if (e) {
  26. if (e.type) {
  27. that.setData({
  28. type: e.type
  29. })
  30. if (e.type == 1) {
  31. wx.setNavigationBarTitle({
  32. title: '预约取号',
  33. })
  34. }
  35. if (e.type == 2) {
  36. wx.setNavigationBarTitle({
  37. title: '手机取号',
  38. })
  39. }
  40. }
  41. if (e.business) {
  42. that.setData({
  43. business: JSON.parse(e.business)
  44. })
  45. that.getBusiness()
  46. }
  47. }
  48. },
  49. getBusiness() {
  50. let that = this
  51. wx.showLoading({
  52. title: '正在查询所需资料...',
  53. })
  54. xcxxdzl({
  55. ywxxId: that.data.business.ywxxId
  56. }).then(res => {
  57. wx.hideLoading()
  58. if (res.code == 200) {
  59. that.setData({
  60. guideList: res.list
  61. })
  62. } else {
  63. wx.showToast({
  64. title: res.msg || res.message,
  65. icon: "none",
  66. duration: 5000
  67. })
  68. }
  69. })
  70. },
  71. look(e) {
  72. let item = e.currentTarget.dataset.item
  73. wx.downloadFile({
  74. url: 'https://smzc-1253299035.cos.ap-nanjing.myqcloud.com/printFile/04801d95d4a24092b96a58d5bab32f14.pdf',
  75. success: function (res) {
  76. const filePath = res.tempFilePath
  77. wx.openDocument({
  78. filePath: filePath,
  79. success: function (res) {
  80. console.log('打开文档成功')
  81. }
  82. })
  83. }
  84. })
  85. },
  86. toYy() {
  87. let that = this
  88. wx.navigateTo({
  89. url: '../yyqhPages/selectTime/selectTime?business=' + JSON.stringify(that.data.business),
  90. })
  91. },
  92. toPd() {
  93. let that = this
  94. let sfYy = that.data.sfYy
  95. if (!sfYy) {
  96. that.setData({
  97. sfYy: true
  98. })
  99. wx.showLoading({
  100. title: '正在取号...',
  101. })
  102. xcxqh({
  103. ywId: that.data.business.ywId,
  104. ywxxId: that.data.business.ywxxId,
  105. unionid: wx.getStorageSync('PUBLIC_ID').unionid
  106. }).then(res => {
  107. that.setData({
  108. sfYy: false
  109. })
  110. wx.hideLoading()
  111. if (res.code == 200) {
  112. wx.setStorageSync('QH', res.data)
  113. wx.reLaunch({
  114. url: '../ssqhPages/success/success?business=' + JSON.stringify(that.data.business),
  115. })
  116. } else {
  117. wx.showToast({
  118. title: res.msg || res.message,
  119. icon: "none",
  120. duration: 5000
  121. })
  122. }
  123. })
  124. }
  125. },
  126. /**
  127. * 生命周期函数--监听页面初次渲染完成
  128. */
  129. onReady() {
  130. },
  131. /**
  132. * 生命周期函数--监听页面显示
  133. */
  134. onShow() {
  135. },
  136. /**
  137. * 生命周期函数--监听页面隐藏
  138. */
  139. onHide() {
  140. },
  141. /**
  142. * 生命周期函数--监听页面卸载
  143. */
  144. onUnload() {
  145. },
  146. /**
  147. * 页面相关事件处理函数--监听用户下拉动作
  148. */
  149. onPullDownRefresh() {
  150. },
  151. /**
  152. * 页面上拉触底事件的处理函数
  153. */
  154. onReachBottom() {
  155. },
  156. /**
  157. * 用户点击右上角分享
  158. */
  159. onShareAppMessage() {
  160. }
  161. })