user_index.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. IsPromotion: false,
  7. },
  8. onLoad: function (options) {
  9. var that = this;
  10. var isPromotion = false;
  11. var title = "秒过大使计划";
  12. var backColor = "#FFB808";
  13. var frontColor = "#000000";
  14. var frontColor2 = "#2e2e2e";
  15. if (options.AgentCategory == "promotion") {
  16. isPromotion = true;
  17. title = "秒过推广计划";
  18. backColor = "#FC7406";
  19. frontColor = "#ffffff";
  20. frontColor2 = "#ffffff";
  21. }
  22. that.setData({
  23. Containnerheight: main.getWindowHeight(),
  24. IsPromotion: isPromotion,
  25. BackColor: backColor,
  26. User: app.globalData.userInfo,
  27. AgentCategory: options.AgentCategory,
  28. FrontColor: frontColor2,
  29. });
  30. wx.setNavigationBarTitle({
  31. title: title
  32. });
  33. wx.setBackgroundColor({
  34. backgroundColor: backColor,
  35. });
  36. wx.setNavigationBarColor({
  37. backgroundColor: backColor,
  38. backgroundColorTop: backColor,
  39. backgroundColorBottom: backColor,
  40. frontColor: frontColor,
  41. });
  42. this.init();
  43. },
  44. init: function () {
  45. var that = this;
  46. if (that.data.AgentCategory == "promotion") {
  47. var url = "GetIntroducerUserList2?ListType=近期报名";
  48. url += "&UserID=" + app.globalData.userInfo.UserID;
  49. main.getData(url, function (data) {
  50. if (data) {
  51. that.setData({
  52. NewUserCount: data.List.length,
  53. });
  54. app.globalData.NewUserApplyArray = data;
  55. }
  56. });
  57. }
  58. var url = "GetMiaoguoAgentRecordList?UserID=" + app.globalData.userInfo.UserID + "&AgentCategory=" + that.data.AgentCategory;
  59. main.getData(url, function (data) {
  60. if (data) {
  61. that.setData({
  62. Total: data.Total,
  63. Total1: data.Total1,
  64. Total2: data.Total2,
  65. WithdrawableEarnings: data.WithdrawableEarnings,
  66. });
  67. app.globalData.EarningsList = data;
  68. }
  69. });
  70. //预估新增收益
  71. var url = url="GetMiaoguoEstimatedNewRevenueList?AgentCategory="+that.data.AgentCategory+"&UserID=" + app.globalData.userInfo.UserID+"&IsDue=0";
  72. main.getData(url, function (data) {
  73. if (data) {
  74. that.setData({
  75. EstimatedNewRevenueTotal: Math.round(data.Total),
  76. });
  77. app.globalData.EstimatedNewRevenue = data;
  78. }
  79. });
  80. //可提现收益
  81. var url = url="GetMiaoguoEstimatedNewRevenueList?AgentCategory="+that.data.AgentCategory+"&UserID=" + app.globalData.userInfo.UserID+"&IsDue=1";
  82. main.getData(url, function (data) {
  83. if (data) {
  84. that.setData({
  85. WithdrawableEarningsTotal: Math.round(data.Total),
  86. });
  87. app.globalData.WithdrawableEarnings = data;
  88. }
  89. });
  90. },
  91. onPullDownRefresh: function () {
  92. wx.stopPullDownRefresh();
  93. this.init();
  94. },
  95. goto: function (e) {
  96. var url = e.currentTarget.dataset.url;
  97. var gotoType = e.currentTarget.dataset.type;
  98. if (!gotoType) {
  99. wx.navigateTo({
  100. url: url,
  101. });
  102. } else {
  103. wx.redirectTo({
  104. url: url,
  105. })
  106. }
  107. },
  108. gotoIndex: function () {
  109. wx.reLaunch({
  110. url: '../../pages/index/index',
  111. })
  112. },
  113. onShareAppMessage: function () {
  114. return {
  115. title: app.globalData.ShareTitle,
  116. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  117. imageUrl: app.globalData.ShareImage,
  118. }
  119. },
  120. })