index.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. import {
  2. meetingInServiceList,
  3. checkMeetingInServiceList
  4. } from '../../../utils/api/meeting'
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. list: [],
  11. //tab的current
  12. currentPage: 0,
  13. searchData: {
  14. data: {
  15. status: null,
  16. },
  17. pageNum: 1,
  18. pageSize: 8,
  19. },
  20. total: null,
  21. type: ''
  22. },
  23. // 获取列表 type-> 1:初始化 2:下拉加载 currentPage-> 0全部1审核中2通过3不通过
  24. getList(type) {
  25. let {
  26. searchData,
  27. list,
  28. currentPage,
  29. item
  30. } = this.data
  31. if (currentPage == 0) {
  32. searchData.data.status = null
  33. } else {
  34. searchData.data.status = currentPage
  35. }
  36. searchData.pageNum = type === 1 ? 1 : (searchData.pageNum + 1)
  37. this.setData({
  38. 'searchData.pageNum': searchData.pageNum
  39. })
  40. wx.showLoading({
  41. title: '加载中',
  42. })
  43. if (this.data.type == 'order-audit') {
  44. checkMeetingInServiceList(searchData).then(res => {
  45. list = type === 1 ? res.data.records : list.concat(res.data.records)
  46. this.setData({
  47. list: list,
  48. total: res.data.total,
  49. })
  50. wx.hideLoading()
  51. })
  52. } else {
  53. let data = {
  54. meetingRecordId: item.meetingRecordId,
  55. status: searchData.data.status
  56. }
  57. meetingInServiceList(data).then(res => {
  58. list = type === 1 ? res.data : list.concat(res.data)
  59. this.setData({
  60. list: list,
  61. total: res.data.total,
  62. })
  63. wx.hideLoading()
  64. })
  65. }
  66. },
  67. // scrollView触底事件
  68. reachBottom(e) {
  69. this.getList(e.currentTarget.dataset.type)
  70. },
  71. //获得切换tab的index
  72. changeSwiper(e) {
  73. var {
  74. currentPage
  75. } = this.data;
  76. switch (e.currentTarget.dataset.type) {
  77. case 'click':
  78. currentPage = e.currentTarget.dataset.index
  79. break;
  80. case 'slide':
  81. currentPage = e.detail.current
  82. break;
  83. default:
  84. break;
  85. };
  86. this.setData({
  87. currentPage
  88. })
  89. this.getList(1)
  90. },
  91. /**
  92. * 生命周期函数--监听页面加载
  93. */
  94. onLoad(options) {
  95. let item = {}
  96. if (options.item) {
  97. item = JSON.parse(options.item)
  98. }
  99. this.setData({
  100. type: options.type,
  101. item: item
  102. })
  103. },
  104. /**
  105. * 生命周期函数--监听页面初次渲染完成
  106. */
  107. onReady() {
  108. },
  109. /**
  110. * 生命周期函数--监听页面显示
  111. */
  112. onShow() {
  113. this.getList(1)
  114. },
  115. /**
  116. * 生命周期函数--监听页面隐藏
  117. */
  118. onHide() {
  119. },
  120. /**
  121. * 生命周期函数--监听页面卸载
  122. */
  123. onUnload() {
  124. },
  125. /**
  126. * 页面相关事件处理函数--监听用户下拉动作
  127. */
  128. onPullDownRefresh() {
  129. },
  130. /**
  131. * 页面上拉触底事件的处理函数
  132. */
  133. onReachBottom() {
  134. },
  135. /**
  136. * 用户点击右上角分享
  137. */
  138. onShareAppMessage() {
  139. }
  140. })