extenduser.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. const ArrFilter1 = ["全部", "仅看未报名"];
  5. const ArrFilter2 = ["全部", "仅看未续费"];
  6. var AllList = [];
  7. Page({
  8. data: {
  9. },
  10. onLoad: function (options) {
  11. var pageType = 0;
  12. if (options.PageType == 1) {
  13. pageType = 1;
  14. wx.setNavigationBarTitle({
  15. title: "奖励名单"
  16. });
  17. }
  18. this.setData({
  19. Containnerheight: main.getWindowHeight(),
  20. ArrMenu: [
  21. { Name: "打开过", Selected: 1 },
  22. { Name: "报过名", Selected: 0 },
  23. { Name: "已续费", Selected: 0 }
  24. ],
  25. Filter1: ArrFilter1[0],
  26. Filter2: ArrFilter2[0],
  27. ArrAward: [
  28. { Name: "等待出账", Remark: "等待用户渡过7天退款期的名单",List:[] },
  29. { Name: "出账", Remark: "已符合奖励条件的名单", List: [] },
  30. { Name: "结算完成", Remark: "已发放奖励的名单", List: [] },
  31. ],
  32. PageType: pageType,
  33. });
  34. this.init();
  35. },
  36. init: function () {
  37. var that = this;
  38. main.getData('GetIntroducerUserList?UserID=' + app.globalData.userInfo.UserID, function (data) {
  39. wx.hideLoading();
  40. if (data) {
  41. AllList = data;
  42. if (that.data.PageType == 0) {
  43. that.setData({
  44. List: data,
  45. });
  46. }
  47. else {
  48. var sevenday = common.formatTime(common.addDate("d",-7,new Date()));
  49. for (var i = 0; i < AllList.length; i++) {
  50. if (AllList[i].IsPay == 1 && AllList[i].IsMember == 1){
  51. var payTime = AllList[i].PayTime;
  52. if (sevenday < payTime) {
  53. that.data.ArrAward[0].List.push(AllList[i]);
  54. }
  55. else {
  56. if (AllList[i].IsRebate == 0) {
  57. that.data.ArrAward[1].List.push(AllList[i]);
  58. }
  59. else {
  60. that.data.ArrAward[2].List.push(AllList[i]);
  61. }
  62. }
  63. }
  64. }
  65. that.setData({
  66. ArrAward: that.data.ArrAward,
  67. });
  68. }
  69. }
  70. });
  71. },
  72. changeMenu: function (e) {
  73. var that = this;
  74. var id = e.currentTarget.dataset.id;
  75. for (var i = 0; i < 3; i++) {
  76. if (id == i)
  77. that.data.ArrMenu[i].Selected = 1;
  78. else
  79. that.data.ArrMenu[i].Selected = 0;
  80. }
  81. var list = [];
  82. for (var i = 0; i < AllList.length; i++) {
  83. if (id == 1) {
  84. if (AllList[i].IsMember == 1)
  85. list.push(AllList[i]);
  86. }
  87. else if (id == 2) {
  88. if (AllList[i].IsPay == 1)
  89. list.push(AllList[i]);
  90. }
  91. else
  92. list.push(AllList[i]);
  93. }
  94. that.setData({
  95. ArrMenu: that.data.ArrMenu,
  96. List: list,
  97. Filter1: ArrFilter1[0],
  98. Filter2: ArrFilter2[0],
  99. });
  100. wx.pageScrollTo({
  101. scrollTop: 0,
  102. });
  103. },
  104. filterData1: function (e) {
  105. var that = this;
  106. wx.showActionSheet({
  107. itemList: ArrFilter1,
  108. success(res) {
  109. var list = [];
  110. for (var i = 0; i < AllList.length; i++) {
  111. if (res.tapIndex == 1) {
  112. if (AllList[i].IsMember == 0)
  113. list.push(AllList[i]);
  114. }
  115. else
  116. list.push(AllList[i]);
  117. }
  118. that.setData({
  119. Filter1: ArrFilter1[res.tapIndex],
  120. List: list,
  121. });
  122. },
  123. })
  124. },
  125. filterData2: function (e) {
  126. var that = this;
  127. wx.showActionSheet({
  128. itemList: ArrFilter2,
  129. success(res) {
  130. var list = [];
  131. for (var i = 0; i < AllList.length; i++) {
  132. if (res.tapIndex == 1) {
  133. if (AllList[i].IsPay == 0 && AllList[i].IsMember == 1)
  134. list.push(AllList[i]);
  135. }
  136. else if (AllList[i].IsMember == 1)
  137. list.push(AllList[i]);
  138. }
  139. that.setData({
  140. Filter2: ArrFilter2[res.tapIndex],
  141. List: list,
  142. });
  143. },
  144. })
  145. },
  146. onShareAppMessage: function () {
  147. return {
  148. title: app.globalData.ShareTitle,
  149. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  150. imageUrl: app.globalData.ShareImage,
  151. }
  152. },
  153. });