extenduser.js 4.4 KB

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