subCardDetails.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. // pages/subCardDetails/subCardDetails.js
  2. import {
  3. get,
  4. post
  5. } from '../../../utils/http.js'
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. pageData: {},
  12. recommendList: [],
  13. descList: [],
  14. id: 0,
  15. store_id: 0,
  16. storeId: '',
  17. btnDisabled:false //功能完毕按钮失效
  18. },
  19. /**
  20. * 生命周期函数--监听页面加载
  21. */
  22. onLoad(options) {
  23. this.setData({
  24. id: options.id,
  25. store_id: options.store_id,
  26. storeId: wx.getStorageSync('store_id'),
  27. })
  28. // 查询次卡详情
  29. this.cardDetails()
  30. },
  31. // 查询次卡详情
  32. cardDetails(){
  33. let { id } = this.data
  34. get('v2/api/user/card/info',{
  35. id
  36. },(res) => {
  37. console.log(res);
  38. this.setData({
  39. pageData: res.data
  40. })
  41. // 查询次卡推荐商品
  42. this.cardRecommend()
  43. })
  44. },
  45. // 查询次卡推荐商品
  46. cardRecommend(){
  47. let { storeId } = this.data
  48. get('v2/api/card/recommend',{
  49. card_id: this.data.pageData.card_id,
  50. store_id:storeId
  51. },(res) => {
  52. console.log(res,'cardRecommend')
  53. this.setData({
  54. recommendList: res.data.list
  55. })
  56. })
  57. },
  58. // 跳转到项目详情
  59. jumpProject(e){
  60. let {total_num,used_num} = e.currentTarget.dataset.project
  61. if(total_num-used_num==0){
  62. return
  63. }
  64. let project_id = e.currentTarget.dataset.project.project_id
  65. wx.navigateTo({
  66. url: `/pages/projectDetail/projectDetail?source=project&id=${project_id}&store_id=${this.data.storeId}`,
  67. })
  68. },
  69. // 跳转美妆产品
  70. jumpBeautyMakeup(e){
  71. let id = e.currentTarget.dataset.id
  72. wx.navigateTo({
  73. url: `/pages/projectDetail/projectDetail?source=goods&id=${id}&store_id=${this.data.storeId}`,
  74. })
  75. },
  76. /**
  77. * 生命周期函数--监听页面初次渲染完成
  78. */
  79. onReady() {
  80. },
  81. /**
  82. * 生命周期函数--监听页面显示
  83. */
  84. onShow() {
  85. },
  86. /**
  87. * 生命周期函数--监听页面隐藏
  88. */
  89. onHide() {
  90. },
  91. /**
  92. * 生命周期函数--监听页面卸载
  93. */
  94. onUnload() {
  95. },
  96. /**
  97. * 页面相关事件处理函数--监听用户下拉动作
  98. */
  99. onPullDownRefresh() {
  100. },
  101. /**
  102. * 页面上拉触底事件的处理函数
  103. */
  104. onReachBottom() {
  105. },
  106. /**
  107. * 用户点击右上角分享
  108. */
  109. onShareAppMessage() {
  110. }
  111. })