discount-group.js 2.1 KB

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