goldeneggact.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. // customer/pages/goldeneggact/goldeneggact.js
  2. const app = getApp();
  3. const utils = require("../../../utils/http");
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. activityInfo: {},
  10. prizesText: ''
  11. },
  12. /**
  13. * 获取活动详情
  14. */
  15. getActivityInfo() {
  16. var that = this;
  17. utils.$post({
  18. url: app.globalData.webUrl + 'api/lottery/egg_act_detail',
  19. header: {
  20. 'Authorization': 'bearer ' + app.globalData.token
  21. },
  22. data: {},
  23. success: function (res) {
  24. if (res.data.code == '0') {
  25. that.setData({
  26. activityInfo: res.data.data,
  27. prizesText: res.data.data && res.data.data.good.length ? res.data.data.good.map(v => v.good_name).join('/') : '',
  28. })
  29. }
  30. }
  31. })
  32. },
  33. /**
  34. * 员工转发活动记录
  35. */
  36. shareCountRecord() {
  37. var that = this;
  38. utils.$post({
  39. url: app.globalData.webUrl + 'api/lottery/act_forward_log',
  40. header: {
  41. 'Authorization': 'bearer ' + app.globalData.token
  42. },
  43. data: {
  44. actid: that.data.activityInfo.id
  45. },
  46. success: function (res) {
  47. if (res.data.code == '0') {
  48. console.log('成功')
  49. }
  50. }
  51. })
  52. },
  53. /**
  54. * 抽奖客户
  55. */
  56. joinCustomer() {
  57. wx.navigateTo({
  58. url: '/pages/other/other?type=29' + '&actid=' + this.data.activityInfo.id,
  59. })
  60. },
  61. /**
  62. * 我的中奖
  63. */
  64. myWinning() {
  65. wx.showToast({
  66. title: '只有客户可以查看',
  67. icon: 'none'
  68. })
  69. },
  70. /**
  71. * 砸金蛋
  72. */
  73. smashGoldenEgg() {
  74. wx.showToast({
  75. title: '只有客户才能参与活动',
  76. icon: 'none'
  77. })
  78. },
  79. /**
  80. * 生命周期函数--监听页面加载
  81. */
  82. onLoad(options) {
  83. this.getActivityInfo();
  84. },
  85. /**
  86. * 生命周期函数--监听页面初次渲染完成
  87. */
  88. onReady() {
  89. },
  90. /**
  91. * 生命周期函数--监听页面显示
  92. */
  93. onShow() {
  94. },
  95. /**
  96. * 生命周期函数--监听页面隐藏
  97. */
  98. onHide() {
  99. },
  100. /**
  101. * 生命周期函数--监听页面卸载
  102. */
  103. onUnload() {
  104. },
  105. /**
  106. * 页面相关事件处理函数--监听用户下拉动作
  107. */
  108. onPullDownRefresh() {
  109. },
  110. /**
  111. * 页面上拉触底事件的处理函数
  112. */
  113. onReachBottom() {
  114. },
  115. /**
  116. * 用户点击右上角分享
  117. */
  118. onShareAppMessage() {
  119. this.shareCountRecord();
  120. let uid = app.globalData.currentUserId ? app.globalData.currentUserId : app.globalData.personMsg.id;
  121. return {
  122. title: this.data.activityInfo.title,
  123. imageUrl: '',
  124. path: '/share/pages/eggsactivity/eggsactivity?uid=' + uid + '&clientype=' + app.globalData.clientype + '&actid=' + this.data.activityInfo.id,
  125. };
  126. }
  127. })