selectBusiness.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // pages/indexPages/selectBusiness/selectBusiness.js
  2. import {
  3. xcxywfl
  4. } from "../../../apis/index"
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. type: null,
  11. businessTitles: [],
  12. businessTitlesIndex: 0,
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad(options) {
  18. let that = this
  19. that.init(options)
  20. that.getBusiness()
  21. },
  22. init(e) {
  23. let that = this
  24. if (e) {
  25. if (e.type) {
  26. that.setData({
  27. type: e.type
  28. })
  29. if (e.type == 1) {
  30. wx.setNavigationBarTitle({
  31. title: '预约取号',
  32. })
  33. }
  34. if (e.type == 2) {
  35. wx.setNavigationBarTitle({
  36. title: '手机取号',
  37. })
  38. }
  39. }
  40. }
  41. },
  42. getBusiness() {
  43. let that = this
  44. wx.showLoading({
  45. title: '加载中...',
  46. })
  47. let myHall = wx.getStorageSync('MY_HALL')
  48. xcxywfl({
  49. bsfwtDm: myHall.bsfwtDm
  50. }).then(res => {
  51. wx.hideLoading()
  52. if (res.code == 200) {
  53. that.setData({
  54. businessTitles: res.list
  55. })
  56. } else {
  57. wx.showToast({
  58. title: res.msg || res.message,
  59. icon: "none",
  60. duration: 5000
  61. })
  62. }
  63. })
  64. },
  65. selectBusinessTitle(e) {
  66. let that = this
  67. let index = e.currentTarget.dataset.index
  68. let item = e.currentTarget.dataset.item
  69. that.setData({
  70. businessTitlesIndex: index
  71. })
  72. },
  73. next(e) {
  74. let ywdx = e.currentTarget.dataset.ywdx
  75. let ywxx = e.currentTarget.dataset.ywxx
  76. let type = this.data.type
  77. let business = {
  78. ywId: ywdx.id,
  79. ywmc: ywdx.ywmc,
  80. ywxxId: ywxx.id,
  81. ywxxmc: ywxx.ywmc
  82. }
  83. wx.navigateTo({
  84. url: '../workGuide/workGuide?type=' + type + '&business=' + JSON.stringify(business),
  85. })
  86. },
  87. /**
  88. * 生命周期函数--监听页面初次渲染完成
  89. */
  90. onReady() {
  91. },
  92. /**
  93. * 生命周期函数--监听页面显示
  94. */
  95. onShow() {
  96. },
  97. /**
  98. * 生命周期函数--监听页面隐藏
  99. */
  100. onHide() {
  101. },
  102. /**
  103. * 生命周期函数--监听页面卸载
  104. */
  105. onUnload() {
  106. },
  107. /**
  108. * 页面相关事件处理函数--监听用户下拉动作
  109. */
  110. onPullDownRefresh() {
  111. },
  112. /**
  113. * 页面上拉触底事件的处理函数
  114. */
  115. onReachBottom() {
  116. },
  117. /**
  118. * 用户点击右上角分享
  119. */
  120. onShareAppMessage() {
  121. }
  122. })