invite_users.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. var app = getApp()
  2. const util = require('../../utils/utils.js');
  3. Page({
  4. data: {
  5. list: [],
  6. yaoqing: false,
  7. user_list: [],
  8. condition: '',
  9. invite_new_users_configs_id: ''
  10. },
  11. onLoad: function (options) {
  12. app.request('/pages/inviteNewusersConfigs', '', 'GET').then(res => {
  13. console.log(res)
  14. if (res.statusCode == 200) {
  15. this.setData({
  16. list: res.data.dynamic_item,
  17. condition: res.data.condition,
  18. invite_new_users_configs_id: res.data.id
  19. })
  20. }
  21. })
  22. app.request('/user/getInviteUsers', '', 'GET').then(res => {
  23. console.log(res)
  24. if (res.statusCode == 200) {
  25. this.setData({
  26. user_list: res.data.data
  27. })
  28. }
  29. })
  30. },
  31. get: util.throttle(function (e) {
  32. console.log(e)
  33. var gift_num = e.currentTarget.dataset.gift_num,
  34. gift_id = e.currentTarget.dataset.gift_id,
  35. gift_type = e.currentTarget.dataset.give_type,
  36. num = e.currentTarget.dataset.num,
  37. invite_new_users_configs_id = this.data.invite_new_users_configs_id;
  38. console.log(gift_type)
  39. var data = {
  40. 'invite_new_users_configs_id': invite_new_users_configs_id,
  41. 'num': num,
  42. 'gift_type': gift_type,
  43. 'gift_id': gift_id,
  44. 'gift_num': gift_num
  45. }
  46. app.request('/user/getInviteNewUsersReward', data, 'POST').then(res => {
  47. console.log(res)
  48. if (res.statusCode == 200) {
  49. // this.setData({user_list:res.data.data})
  50. wx.showToast({
  51. title: '领取成功',
  52. icon: 'none'
  53. })
  54. }
  55. })
  56. }, 2000),
  57. yaoqing: function () {
  58. this.setData({
  59. yaoqing: true
  60. })
  61. },
  62. cancel: function () {
  63. this.setData({
  64. yaoqing: false
  65. })
  66. },
  67. poster: function () {
  68. this.setData({
  69. yaoqing: false
  70. })
  71. wx.navigateTo({
  72. url: '/pages/poster/poster',
  73. })
  74. },
  75. onReady: function () {
  76. },
  77. onShow: function () {
  78. },
  79. onHide: function () {
  80. },
  81. onUnload: function () {
  82. },
  83. onPullDownRefresh: function () {
  84. },
  85. onReachBottom: function () {
  86. },
  87. onShareAppMessage: function (options) {
  88. var that = this;
  89. // 设置菜单中的转发按钮触发转发事件时的转发内容
  90. return{
  91. title: "我分享了一个大礼包,快来领取吧~", // 默认是小程序的名称(可以写slogan等)
  92. path: '/pages/index/index?scene='+wx.getStorageSync('user_ID'), // 默认是当前页面,必须是以‘/’开头的完整路径
  93. imageUrl: 'http://resource.bike.hanyiyun.com/weapp/yaoqing.png', //自定义图片路径,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
  94. }
  95. }
  96. })