discount-group.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // pages/groupPage//discount-group/discount-group.js
  2. import httpRequestApi from '../../../utils/APIClient';
  3. const app = getApp()
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. recommendList: []
  10. },
  11. //点击跳转到团购详情
  12. groupDetail:function ({currentTarget}) {
  13. const productId = currentTarget.dataset.productid;
  14. const id = currentTarget.dataset.id;
  15. const groupId = currentTarget.dataset.groupid;
  16. const ind = currentTarget.dataset.ind;
  17. //const groupType = this.data.groupData.recommendList[ind].groupType;
  18. wx.navigateTo({
  19. url: `/pages/groupPage/group-details/group-details?productId=${productId}&id=${id}&groupId=${groupId}`
  20. })
  21. // if(groupType === "PROMOTION") {
  22. // wx.navigateTo({
  23. // url: `/pages/groupPage/make-money/make-money?productId=${productId}&id=${id}&groupId=${groupId}`
  24. // })
  25. // }else {
  26. // wx.navigateTo({
  27. // url: `/pages/groupPage/group-details/group-details?productId=${productId}&id=${id}&groupId=${groupId}`
  28. // })
  29. // }
  30. },
  31. /**
  32. * 生命周期函数--监听页面加载
  33. */
  34. onLoad: function (options) {
  35. if (app.globalData.isIOS) {
  36. wx.redirectTo({
  37. url: '../../index/index'
  38. })
  39. return
  40. }
  41. wx.setNavigationBarTitle({
  42. title: '优惠团购'
  43. })
  44. //优惠内容
  45. httpRequestApi.getGroupList().success( (res) => {
  46. console.log('推荐团购',res.data.data)
  47. this.setData({
  48. recommendList: res.data.data
  49. })
  50. }).fail((error) => {
  51. console.log('错误',error)
  52. })
  53. },
  54. /**
  55. * 生命周期函数--监听页面初次渲染完成
  56. */
  57. onReady: function () {
  58. },
  59. /**
  60. * 生命周期函数--监听页面显示
  61. */
  62. onShow: function () {
  63. },
  64. /**
  65. * 生命周期函数--监听页面隐藏
  66. */
  67. onHide: function () {
  68. },
  69. /**
  70. * 生命周期函数--监听页面卸载
  71. */
  72. onUnload: function () {
  73. },
  74. /**
  75. * 页面相关事件处理函数--监听用户下拉动作
  76. */
  77. onPullDownRefresh: function () {
  78. },
  79. /**
  80. * 页面上拉触底事件的处理函数
  81. */
  82. onReachBottom: function () {
  83. },
  84. /**
  85. * 用户点击右上角分享
  86. */
  87. onShareAppMessage: function () {
  88. }
  89. })