successOrder.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. import {
  2. get,
  3. post
  4. } from "../../../utils/http"
  5. // subPackagesB/pages/groupOrder/groupOrder.js
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. GroupOrderList: '', //拼团记录详情
  12. userGroupId: '', //用户拼团ID
  13. store_id: '', //店铺ID
  14. original_price: '', //原价
  15. goods_id: '', //商品ID
  16. source: '', //商品类型
  17. grouping_id: '', //拼团记录ID
  18. groupID: '', //拼团活动ID
  19. },
  20. /**
  21. * 生命周期函数--监听页面加载
  22. */
  23. onLoad(options) {
  24. console.log(options);
  25. this.setData({
  26. store_id: wx.getStorageSync('store_id'),
  27. goods_id: options.goods_id,
  28. original_price: options.original_price,
  29. source: options.source,
  30. grouping_id: options.grouping_id,
  31. groupID: options.groupID
  32. })
  33. // 获取拼团记录详情
  34. this.getGroupOrderDetail()
  35. },
  36. /**
  37. * 生命周期函数--监听页面初次渲染完成
  38. */
  39. onReady() {
  40. },
  41. /**
  42. * 生命周期函数--监听页面显示
  43. */
  44. onShow() {
  45. },
  46. /**
  47. * 生命周期函数--监听页面隐藏
  48. */
  49. onHide() {
  50. },
  51. /**
  52. * 生命周期函数--监听页面卸载
  53. */
  54. onUnload() {
  55. },
  56. /**
  57. * 页面相关事件处理函数--监听用户下拉动作
  58. */
  59. onPullDownRefresh() {
  60. },
  61. /**
  62. * 页面上拉触底事件的处理函数
  63. */
  64. onReachBottom() {
  65. },
  66. /**
  67. * 用户点击右上角分享
  68. */
  69. onShareAppMessage(res) {
  70. if (res.from == 'button') {
  71. console.log(res.target, res)
  72. }
  73. return {
  74. title: this.data.GroupOrderList.share_text, //分享内容标题
  75. path: `/subPackagesB/pages/groupDetail/groupDetail?isShare=true&&id=${this.data.groupID}&&grouping_id=${this.data.grouping_id}`, //这里是被分享的人点击进来之后的页面
  76. imageUrl: this.data.GroupOrderList.share_image //这里是图片的路径
  77. }
  78. },
  79. // 获取拼团记录详情
  80. getGroupOrderDetail() {
  81. get('v2/api/grouping/log_info', {
  82. id: this.data.grouping_id
  83. }, (res) => {
  84. if (res.code == 200) {
  85. console.log(res);
  86. this.setData({
  87. GroupOrderList: res.data,
  88. userGroupId: res.data.id
  89. })
  90. }
  91. })
  92. },
  93. // 取消拼团
  94. cancelGroup() {
  95. let that = this
  96. post('v2/api/grouping/cancel', {
  97. id: that.data.grouping_id
  98. }, (res) => {
  99. wx.showToast({
  100. title: '取消成功',
  101. success: setTimeout(function () {
  102. wx.redirectTo({
  103. url: `/subPackagesB/pages/GroupConfirm/GroupConfirm?store_id=${that.data.store_id}&&productId=${that.data.goods_id}&&source=${that.data.source}&&groupPrice=${that.data.original_price}&&isGrouping=false`,
  104. })
  105. },2000)
  106. })
  107. })
  108. }
  109. })