make-money.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. // pages/groupPage/make-money/make-money.js
  2. import httpRequestApi from '../../../utils/APIClient';
  3. import util from '../../../utils/util';
  4. const app = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. organizer: {},
  11. groupPurchaseInfo: {},
  12. joinUserList: [],
  13. surplusList: [],
  14. timeList: [],
  15. productId: '',
  16. orderId: '',
  17. groupId: '',
  18. organizerUid: '',
  19. orderList: {}
  20. },
  21. //显示分享页
  22. share: function () {
  23. this.shareDialog = this.selectComponent("#share-dialog");
  24. const data = {
  25. avatar: this.data.organizer.avatar,
  26. author: this.data.organizer.wechatName,
  27. iconImg: this.data.groupPurchaseInfo.bgImg,
  28. title: this.data.groupPurchaseInfo.productTitle,
  29. path: `pages/groupPage/group-details/group-details`,
  30. scene: `QR${this.data.orderId}`,
  31. groupPurchaseInfo: this.data.groupPurchaseInfo,
  32. groupType: this.data.groupOsType
  33. }
  34. this.shareDialog.share(data);
  35. },
  36. /**
  37. * 生命周期函数--监听页面加载
  38. */
  39. onLoad: function (options) {
  40. // if (app.globalData.isIOS) {
  41. // wx.redirectTo({
  42. // url: '../../index/index'
  43. // })
  44. // return
  45. // }
  46. wx.setNavigationBarTitle({
  47. title: '小学课文朗读配音'
  48. })
  49. console.log(options.id);
  50. if(!options.id) {
  51. return false;
  52. }
  53. const orderId = options.id;
  54. const productId = options.productId;
  55. const groupId = options.groupId;
  56. this.setData({
  57. orderId,
  58. productId,
  59. groupId
  60. })
  61. httpRequestApi.getMygroupInfo(orderId).success( res => {
  62. console.log('支付详情', res.data.data);
  63. const groupOrder = res.data.data.groupPurchaseOrder;
  64. const surplusNum = groupOrder.headcount - groupOrder.joinCount;
  65. this.setData({
  66. organizerUid: groupOrder.organizer,
  67. orderList: res.data.data
  68. })
  69. for(var i = 0; i < surplusNum; i++) {
  70. this.data.surplusList.push(1);
  71. }
  72. //时间转换
  73. const timeList = util.lastHoursInGroup(res.data.data.groupPurchaseOrder.closeTime - res.data.data.currentTime);
  74. console.log(timeList)
  75. this.setData({
  76. groupPurchaseInfo: res.data.data.groupPurchaseInfo,
  77. organizer: res.data.data.organizer,
  78. surplusNum,
  79. joinUserList: res.data.data.joinUserList,
  80. surplusList: this.data.surplusList,
  81. timeList,
  82. productId: res.data.data.groupPurchaseOrder.productId,
  83. groupId: res.data.data.groupPurchaseOrder.groupId,
  84. groupOsType: res.data.data.groupPurchaseOrder.os
  85. })
  86. }).fail( error => {
  87. console.log('错误', error)
  88. })
  89. },
  90. /**
  91. * 生命周期函数--监听页面初次渲染完成
  92. */
  93. onReady: function () {
  94. },
  95. /**
  96. * 生命周期函数--监听页面显示
  97. */
  98. onShow: function () {;
  99. },
  100. /**
  101. * 生命周期函数--监听页面隐藏
  102. */
  103. onHide: function () {
  104. },
  105. /**
  106. * 生命周期函数--监听页面卸载
  107. */
  108. onUnload: function () {
  109. },
  110. /**
  111. * 页面相关事件处理函数--监听用户下拉动作
  112. */
  113. onPullDownRefresh: function () {
  114. },
  115. /**
  116. * 页面上拉触底事件的处理函数
  117. */
  118. onReachBottom: function () {
  119. },
  120. /**
  121. * 用户点击右上角分享
  122. */
  123. onShareAppMessage: function () {
  124. // if (ops.from === 'button') {
  125. // console.log(ops.target)
  126. // }
  127. // const productId = this.data.productId;
  128. // const groupId = this.data.groupId;
  129. const id = this.data.orderId;
  130. console.log(id)
  131. return {
  132. title: '老师同学都在玩的配音show,你还在等什么?',
  133. path: `pages/groupPage/group-details/group-details?share=true&shareId=${id}`,
  134. imageUrl: `https://efunbox.lingjiao.cn/reader/resource/share/lesson_${this.data.productId}.jpg`,
  135. // success: function (res) {
  136. // // 转发成功
  137. // console.log("转发成功:" + JSON.stringify(res));
  138. // var shareTickets = res.shareTickets;
  139. // // if (shareTickets.length == 0) {
  140. // // return false;
  141. // // }
  142. // // //可以获取群组信息
  143. // // wx.getShareInfo({
  144. // // shareTicket: shareTickets[0],
  145. // // success: function (res) {
  146. // // console.log(res)
  147. // // }
  148. // // })
  149. // },
  150. fail: function (res) {
  151. // 转发失败
  152. console.log("转发失败:" + JSON.stringify(res));
  153. }
  154. }
  155. }
  156. })