meet.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. // pages/my/meet/meet.js
  2. var App = getApp();
  3. const util = require("../../utils/util");
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. tabs: [
  10. {
  11. i: 0,
  12. label: "全部",
  13. },
  14. {
  15. i: 1,
  16. label: "拼团中",
  17. },
  18. {
  19. i: 2,
  20. label: "预约中",
  21. },
  22. {
  23. i: 3,
  24. label: "处理中",
  25. },
  26. {
  27. i: 4,
  28. label: "已完成",
  29. },
  30. ],
  31. currentTab: 0,
  32. meetType: "",
  33. queryPage: {
  34. page: 1,
  35. limit: 10,
  36. },
  37. list: [],
  38. total: null,
  39. totalPage: null,
  40. currPage: null,
  41. nodata: util.nodata(),
  42. },
  43. /**
  44. * 生命周期函数--监听页面加载
  45. */
  46. onLoad(options) {},
  47. /**
  48. * 生命周期函数--监听页面初次渲染完成
  49. */
  50. onReady() {},
  51. /**
  52. * 生命周期函数--监听页面显示
  53. */
  54. onShow() {
  55. this.init();
  56. },
  57. tabChange(e) {
  58. console.log(e);
  59. if (this.data.currentTab == e.currentTarget.dataset.index) {
  60. return;
  61. }
  62. // 0 拼团中 1预约中 2处理中 3已完成
  63. let type = "";
  64. if (e.currentTarget.dataset.index == 0) {
  65. type = "";
  66. } else if (e.currentTarget.dataset.index == 1) {
  67. type = 0;
  68. } else if (e.currentTarget.dataset.index == 2) {
  69. type = 1;
  70. } else if (e.currentTarget.dataset.index == 3) {
  71. type = 2;
  72. } else {
  73. type = 3;
  74. }
  75. this.setData({
  76. currentTab: e.currentTarget.dataset.index,
  77. meetType: type,
  78. });
  79. this.init();
  80. },
  81. toMeetDetail(e) {
  82. wx.navigateTo({
  83. url:
  84. "/meet/meet/detail?meetId=" +
  85. e.currentTarget.dataset.meetid +
  86. "&expertId=" +
  87. e.currentTarget.dataset.expertid,
  88. });
  89. },
  90. init() {
  91. this.setData({
  92. list: [],
  93. queryPage: {
  94. page: 1,
  95. limit: 10,
  96. },
  97. });
  98. this.getlist();
  99. },
  100. // 约见列表
  101. getlist() {
  102. if (this.data.queryPage.page > 1) {
  103. if (this.data.total > 0 && this.data.currPage == this.data.totalPage) {
  104. wx.showToast({
  105. title: "没有更多了~",
  106. icon: "none",
  107. });
  108. return false;
  109. }
  110. }
  111. wx.showLoading({
  112. title: "努力加载中...",
  113. });
  114. App._get(
  115. "myMeet/myAppointmentPage",
  116. {
  117. ...this.data.queryPage,
  118. meetType: this.data.meetType,
  119. memberId: util.getUserId(),
  120. },
  121. (res) => {
  122. if (res.code === 0) {
  123. this.setData({
  124. list: [...this.data.list, ...res.page.list],
  125. total: res.page.totalCount,
  126. totalPage: res.page.totalPage,
  127. currPage: res.page.currPage,
  128. });
  129. wx.hideLoading();
  130. }
  131. },
  132. (err) => {
  133. wx.showToast({
  134. icon: "error",
  135. title: "服务端异常",
  136. });
  137. },
  138. (complete) => {}
  139. );
  140. },
  141. /**
  142. * 生命周期函数--监听页面隐藏
  143. */
  144. onHide() {},
  145. /**
  146. * 生命周期函数--监听页面卸载
  147. */
  148. onUnload() {},
  149. /**
  150. * 页面相关事件处理函数--监听用户下拉动作
  151. */
  152. onPullDownRefresh() {
  153. this.init();
  154. setTimeout(() => {
  155. wx.stopPullDownRefresh();
  156. }, 500);
  157. },
  158. /**
  159. * 页面上拉触底事件的处理函数
  160. */
  161. onReachBottom() {
  162. this.setData({
  163. queryPage: {
  164. page: ++this.data.queryPage.page,
  165. limit: 10,
  166. },
  167. });
  168. this.getlist();
  169. },
  170. /**
  171. * 用户点击右上角分享
  172. */
  173. onShareAppMessage() {},
  174. });