my-group.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. // pages/groupPage/my-group/my-group.js
  2. import httpRequestApi from '../../../utils/APIClient';
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. myGroupList: [],
  9. typeOf:'',
  10. title: '',
  11. headTextOne: '',
  12. headTextTwo: '',
  13. content: [],
  14. productId: '',
  15. orderId: '',
  16. groupId: ''
  17. },
  18. //跳转到团购详情页
  19. collageDetails: function ({currentTarget}) {
  20. const orderId = currentTarget.dataset.orderid;
  21. const num = currentTarget.dataset.num;
  22. console.log(num)
  23. if(!num) {
  24. wx.navigateTo({
  25. url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}`
  26. })
  27. }
  28. },
  29. /**
  30. * 生命周期函数--监听页面加载
  31. */
  32. onLoad: function (options) {
  33. httpRequestApi.getMygroup().success((res) => {
  34. if(!res.data.data.list){
  35. return
  36. }
  37. console.log('我的团', res.data.data.list)
  38. this.setData({
  39. myGroupList: res.data.data.list
  40. })
  41. res.data.data.list.forEach(element => {
  42. console.log(element.status)
  43. if(element.status == 'successed') {
  44. this.setData({
  45. productId: element.productId,
  46. orderId: element.id,
  47. groupId: element.groupId
  48. })
  49. if(wx.getStorageSync(uid) == element.organizer) {
  50. this.setData({
  51. typeOf: 'success',
  52. title: '恭喜 !',
  53. headTextOne: '您发起的团购拼团成功',
  54. content: [
  55. {
  56. text: "领袖体质魅力无穷!",
  57. color: "#000"
  58. },
  59. {
  60. text: " 您可以继续发起新的团购,",
  61. color: "#000"
  62. },
  63. {
  64. text: " 不再需要支付本课程费用,拼团成功,",
  65. color: "#FF9B00"
  66. },
  67. {
  68. text: " 您将得到xxx元奖励。",
  69. color: "#FF0000"
  70. }
  71. ],
  72. })
  73. }else {
  74. this.setData({
  75. typeOf: 'success',
  76. title: '拼团成功 ! ',
  77. headTextOne: '您参与的团购拼团成功',
  78. headTextTwo: '订单号:12344',
  79. content: [
  80. {
  81. text: "感谢团长的分享",
  82. color: "#000"
  83. },
  84. {
  85. text: " 您也可以发起新的团购分享给需要的朋友们,",
  86. color: "#000"
  87. },
  88. {
  89. text: "作为新的发起人,您无需在支付本课程费用;",
  90. color: "#FF0000"
  91. },
  92. {
  93. text: "团购成功,您将得到xxx元奖励。",
  94. color: "#FF0000"
  95. }
  96. ],
  97. })
  98. }
  99. }
  100. });
  101. }).fail( error => {
  102. console.log('错误', error)
  103. })
  104. },
  105. //再次发起团
  106. group: function () {
  107. // wx.showModal({
  108. // title: '提示',
  109. // content: '再次发起团',
  110. // success (res) {
  111. // if (res.confirm) {
  112. // console.log('用户点击确定')
  113. // } else if (res.cancel) {
  114. // console.log('用户点击取消')
  115. // }
  116. // }
  117. // })
  118. const productId = this.data.productId;
  119. const groupId = this.data.groupId;
  120. const id = this.data.orderId;
  121. wx.navigateTo({
  122. url: `/pages/groupPage/make-money/make-money?productId=${productId}&id=${id}&groupId=${groupId}`
  123. })
  124. },
  125. /**
  126. * 生命周期函数--监听页面初次渲染完成
  127. */
  128. onReady: function () {
  129. },
  130. /**
  131. * 生命周期函数--监听页面显示
  132. */
  133. onShow: function () {
  134. },
  135. /**
  136. * 生命周期函数--监听页面隐藏
  137. */
  138. onHide: function () {
  139. },
  140. /**
  141. * 生命周期函数--监听页面卸载
  142. */
  143. onUnload: function () {
  144. },
  145. /**
  146. * 页面相关事件处理函数--监听用户下拉动作
  147. */
  148. onPullDownRefresh: function () {
  149. },
  150. /**
  151. * 页面上拉触底事件的处理函数
  152. */
  153. onReachBottom: function () {
  154. },
  155. /**
  156. * 用户点击右上角分享
  157. */
  158. onShareAppMessage: function () {
  159. }
  160. })