extenduser.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. var AllList = [],List1=[];
  5. Page({
  6. data: {
  7. },
  8. onLoad: function (options) {
  9. //app.globalData.userInfo.UserID=9;
  10. var pageType = 0;
  11. if (options.PageType == 1) {
  12. pageType = 1;
  13. wx.setNavigationBarTitle({
  14. title: "奖励名单"
  15. });
  16. }
  17. this.setData({
  18. Containnerheight: main.getWindowHeight(),
  19. ArrMenu: [
  20. { Name: "报名了", Selected: 1 },
  21. { Name: "续费了", Selected: 0 }
  22. ],
  23. ArrAward: [
  24. { Name: "等待出账", Remark: "等待用户渡过7天退款期的名单",List:[] },
  25. { Name: "出账", Remark: "已符合奖励条件的名单", List: [] },
  26. { Name: "结算完成", Remark: "已发放奖励的名单", List: [] },
  27. ],
  28. PageType: pageType,
  29. });
  30. if (app.globalData.userInfo.Subscribe == 1) {
  31. this.init();
  32. }
  33. else{
  34. wx.redirectTo({
  35. url: '../../pages/other/userbook',
  36. });
  37. }
  38. },
  39. init: function () {
  40. var that = this;
  41. main.getData('GetIntroducerUserList?UserID=' + app.globalData.userInfo.UserID, function (data) {
  42. wx.hideLoading();
  43. if (data) {
  44. List1=data.List1;
  45. AllList = data.List2;
  46. if (that.data.PageType == 0) {
  47. that.setData({
  48. List: data.List1,
  49. });
  50. }
  51. else {
  52. var sevenday = common.formatTime(common.addDate("d",-7,new Date()));
  53. //console.log(sevenday);
  54. for (var i = 0; i < AllList.length; i++) {
  55. if (AllList[i].IsPay == 1 && AllList[i].IsMember == 1){
  56. var payTime = AllList[i].PayTime;
  57. if (payTime != "1900-01-01 00:00:00"){
  58. if (sevenday < payTime) {
  59. that.data.ArrAward[0].List.push(AllList[i]);
  60. }
  61. else {
  62. if (AllList[i].IsRebate == 0) {
  63. that.data.ArrAward[1].List.push(AllList[i]);
  64. }
  65. else {
  66. that.data.ArrAward[2].List.push(AllList[i]);
  67. }
  68. }
  69. }
  70. }
  71. }
  72. that.setData({
  73. ArrAward: that.data.ArrAward,
  74. });
  75. }
  76. }
  77. });
  78. },
  79. changeMenu: function (e) {
  80. var that = this;
  81. var id = e.currentTarget.dataset.id;
  82. var list = [];
  83. if (id == 0) {
  84. that.data.ArrMenu[0].Selected = 1;
  85. that.data.ArrMenu[1].Selected = 0;
  86. list = List1;
  87. }
  88. else {
  89. that.data.ArrMenu[0].Selected = 0;
  90. that.data.ArrMenu[1].Selected = 1;
  91. list = AllList;
  92. }
  93. that.setData({
  94. ArrMenu: that.data.ArrMenu,
  95. List: list,
  96. });
  97. wx.pageScrollTo({
  98. scrollTop: 0,
  99. });
  100. },
  101. gogoShareUser: function () {
  102. wx.navigateTo({
  103. url: './shareuser',
  104. });
  105. },
  106. onShareAppMessage: function () {
  107. return {
  108. title: app.globalData.ShareTitle,
  109. path: app.globalData.SharePath + '?type=marketing&UserID=' + app.globalData.userInfo.UserID,
  110. imageUrl: app.globalData.uploadImageUrl+"web/program_screenshot_promotion.png",
  111. }
  112. },
  113. });