extenduser.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. this.setData({
  12. Containnerheight: main.getWindowHeight(),
  13. ArrMenu: [
  14. { Name: "打开过", Selected: 1 },
  15. { Name: "报过名", Selected: 0 },
  16. { Name: "已续费", Selected: 0 }
  17. ],
  18. Filter1: ArrFilter1[0],
  19. Filter2: ArrFilter2[0],
  20. });
  21. this.init();
  22. },
  23. init: function () {
  24. var that = this;
  25. main.getData('GetIntroducerUserList?UserID=' + app.globalData.userInfo.UserID, function (data) {
  26. wx.hideLoading();
  27. if (data) {
  28. AllList = data;
  29. that.setData({
  30. List: data,
  31. });
  32. }
  33. });
  34. },
  35. changeMenu: function (e) {
  36. var that = this;
  37. var id = e.currentTarget.dataset.id;
  38. for (var i = 0; i < 3; i++) {
  39. if (id == i)
  40. that.data.ArrMenu[i].Selected = 1;
  41. else
  42. that.data.ArrMenu[i].Selected = 0;
  43. }
  44. var list = [];
  45. for (var i = 0; i < AllList.length; i++) {
  46. if (id == 1) {
  47. if (AllList[i].IsMember == 1)
  48. list.push(AllList[i]);
  49. }
  50. else if (id == 2) {
  51. if (AllList[i].IsPay == 1)
  52. list.push(AllList[i]);
  53. }
  54. else
  55. list.push(AllList[i]);
  56. }
  57. that.setData({
  58. ArrMenu: that.data.ArrMenu,
  59. List: list,
  60. Filter1: ArrFilter1[0],
  61. Filter2: ArrFilter2[0],
  62. });
  63. },
  64. filterData1: function (e) {
  65. var that = this;
  66. wx.showActionSheet({
  67. itemList: ArrFilter1,
  68. success(res) {
  69. var list = [];
  70. for (var i = 0; i < AllList.length; i++) {
  71. if (res.tapIndex == 1) {
  72. if (AllList[i].IsMember == 0)
  73. list.push(AllList[i]);
  74. }
  75. else
  76. list.push(AllList[i]);
  77. }
  78. that.setData({
  79. Filter1: ArrFilter1[res.tapIndex],
  80. List: list,
  81. });
  82. },
  83. })
  84. },
  85. filterData2: function (e) {
  86. var that = this;
  87. wx.showActionSheet({
  88. itemList: ArrFilter2,
  89. success(res) {
  90. var list = [];
  91. for (var i = 0; i < AllList.length; i++) {
  92. if (res.tapIndex == 1) {
  93. if (AllList[i].IsPay == 0)
  94. list.push(AllList[i]);
  95. }
  96. else
  97. list.push(AllList[i]);
  98. }
  99. that.setData({
  100. Filter2: ArrFilter2[res.tapIndex],
  101. List: list,
  102. });
  103. },
  104. })
  105. },
  106. onShareAppMessage: function () {
  107. return {
  108. title: app.globalData.ShareTitle,
  109. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  110. imageUrl: app.globalData.ShareImage,
  111. }
  112. },
  113. });