service.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. // pages/my/service/service.js
  2. const App = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. meetId: null,
  9. detail: {},
  10. groupList: [],
  11. refuseContent: null,
  12. queryPage: {
  13. page: 1,
  14. limit: 10,
  15. },
  16. list: [],
  17. total: null,
  18. totalPage: null,
  19. currPage: null,
  20. isShowContact: false,
  21. user: wx.getStorageSync("USER"),
  22. },
  23. /**
  24. * 生命周期函数--监听页面加载
  25. */
  26. onLoad(options) {
  27. console.log(options);
  28. this.setData({
  29. meetId: options.meetId,
  30. });
  31. this.getDetail(options.meetId);
  32. },
  33. /**
  34. * 生命周期函数--监听页面初次渲染完成
  35. */
  36. onReady() {
  37. this.popup2 = this.selectComponent("#popup2");
  38. },
  39. /**
  40. * 生命周期函数--监听页面显示
  41. */
  42. onShow() {},
  43. getDetail(meetId) {
  44. wx.showLoading({
  45. title: "努力加载中...",
  46. });
  47. App._get(
  48. `myMeet/myAppointmentInfo`,
  49. {
  50. meetId: meetId,
  51. id: this.data.user.id,
  52. },
  53. (res) => {
  54. if (res.code === 0) {
  55. this.setData({
  56. detail: res.data,
  57. groupList: res.data.meetPeopleBOList,
  58. });
  59. if (res.data.process >= 3) {
  60. this.getExperience(res.data.meetId);
  61. }
  62. }
  63. },
  64. (err) => {},
  65. (complete) => {
  66. setTimeout(() => {
  67. wx.hideLoading();
  68. }, 500);
  69. }
  70. );
  71. },
  72. // 获取心得分享
  73. getExperience(meetId) {
  74. if (this.data.queryPage.page > 1) {
  75. if (this.data.total > 0 && this.data.currPage == this.data.totalPage) {
  76. wx.showToast({
  77. title: "没有更多了~",
  78. icon: "none",
  79. });
  80. return false;
  81. }
  82. }
  83. wx.showLoading({
  84. title: "努力加载中...",
  85. });
  86. App._get(
  87. "meetevaluation/evaluatePage",
  88. {
  89. meetId: meetId,
  90. ...this.data.queryPage,
  91. },
  92. (res) => {
  93. if (res.code === 0) {
  94. this.setData({
  95. list: [...this.data.list, ...res.page.list],
  96. total: res.page.totalCount,
  97. totalPage: res.page.totalPage,
  98. currPage: res.page.currPage,
  99. });
  100. }
  101. },
  102. (err) => {},
  103. (complete) => {
  104. setTimeout(() => {
  105. wx.hideLoading();
  106. }, 500);
  107. }
  108. );
  109. },
  110. agreeHandle() {
  111. if (this.data.detail.groupWay == 1 && this.data.detail.process == 0) {
  112. wx.showToast({
  113. icon: "none",
  114. title: "请等待拼团成功",
  115. });
  116. return false;
  117. }
  118. wx.requestSubscribeMessage({
  119. tmplIds: ["LyWMllU4dWpy1Y8tS39EhOBLUSQWmUb_yDFKoJojKq8"],
  120. success: (success) => {},
  121. fail: (fail) => {},
  122. complete: (complete) => {
  123. console.log("查看");
  124. wx.showLoading({
  125. title: "处理中...",
  126. });
  127. App._put_form(
  128. "expert_workbench/agreeToAsk",
  129. "",
  130. {
  131. id: this.data.user.id,
  132. meetId: this.data.meetId,
  133. },
  134. (res) => {
  135. if (res.code === 0) {
  136. this.getDetail(this.data.meetId);
  137. wx.hideLoading();
  138. wx.showToast({
  139. title: "操作成功",
  140. });
  141. }
  142. },
  143. (err) => {},
  144. (complete) => {}
  145. );
  146. },
  147. });
  148. },
  149. toCustomer() {
  150. wx.navigateTo({
  151. url: "/pages/my/myCustomer/myCustomer",
  152. });
  153. },
  154. contactUser() {
  155. this.setData({
  156. isShowContact: true,
  157. });
  158. },
  159. cancelContact() {
  160. this.setData({
  161. isShowContact: false,
  162. });
  163. },
  164. contactPhone(e) {
  165. console.log(e, 1111);
  166. wx.makePhoneCall({
  167. phoneNumber: e.currentTarget.dataset.phone,
  168. });
  169. this.setData({
  170. isShowContact: false,
  171. });
  172. },
  173. refuseHandle() {
  174. this.popup2.showPopup();
  175. },
  176. _error() {
  177. console.log("返回");
  178. this.popup2.hidePopup();
  179. },
  180. _success() {
  181. if (!this.data.refuseContent) {
  182. wx.showToast({
  183. icon: "error",
  184. title: "请填写拒绝原因",
  185. });
  186. return false;
  187. }
  188. wx.showLoading({
  189. title: "处理中...",
  190. });
  191. App._put_form(
  192. "expert_workbench/refuseToAsk",
  193. "",
  194. {
  195. id: this.data.user.id,
  196. denialReason: this.data.refuseContent,
  197. meetId: this.data.meetId,
  198. },
  199. (res) => {
  200. if (res.code === 0) {
  201. this.getDetail(this.data.meetId);
  202. this.popup2.hidePopup();
  203. wx.hideLoading();
  204. wx.showToast({
  205. title: "操作成功",
  206. });
  207. }
  208. },
  209. (err) => {},
  210. (complete) => {}
  211. );
  212. },
  213. /**
  214. * 生命周期函数--监听页面隐藏
  215. */
  216. onHide() {},
  217. /**
  218. * 生命周期函数--监听页面卸载
  219. */
  220. onUnload() {},
  221. /**
  222. * 页面相关事件处理函数--监听用户下拉动作
  223. */
  224. onPullDownRefresh() {},
  225. /**
  226. * 页面上拉触底事件的处理函数
  227. */
  228. onReachBottom() {
  229. this.setData({
  230. queryPage: {
  231. page: ++this.data.queryPage.page,
  232. limit: 10,
  233. },
  234. });
  235. if (this.data.detail.process >= 3) {
  236. this.getExperience(this.meetId);
  237. }
  238. },
  239. /**
  240. * 用户点击右上角分享
  241. */
  242. onShareAppMessage() {},
  243. });