my-group.js 4.2 KB

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