my-group.js 4.4 KB

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