user_index.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. },
  43. onShow:function(){
  44. this.init();
  45. },
  46. init: function () {
  47. var that = this;
  48. if (that.data.AgentCategory == "promotion") {
  49. var url = "GetIntroducerUserList2?ListType=近期报名&AgentCategory=" + that.data.AgentCategory;
  50. url += "&UserID=" + app.globalData.userInfo.UserID;
  51. main.getData(url, function (data) {
  52. if (data) {
  53. that.setData({
  54. NewUserCount: data.List.length,
  55. });
  56. app.globalData.NewUserApplyArray = data;
  57. }
  58. });
  59. }
  60. //历史账单
  61. var url = "GetMiaoguoAgentRecordList?UserID=" + app.globalData.userInfo.UserID + "&AgentCategory=" + that.data.AgentCategory;
  62. main.getData(url, function (data) {
  63. if (data) {
  64. that.setData({
  65. Total: data.Total,
  66. Total1: data.Total1,
  67. Total2: data.Total2,
  68. WithdrawableEarnings: data.WithdrawableEarnings,
  69. });
  70. app.globalData.EarningsList = data;
  71. }
  72. });
  73. //预估新增收益
  74. var url = url="GetMiaoguoEstimatedNewRevenueList?AgentCategory="+that.data.AgentCategory+"&UserID=" + app.globalData.userInfo.UserID+"&IsDue=0";
  75. main.getData(url, function (data) {
  76. if (data) {
  77. that.setData({
  78. EstimatedNewRevenueTotal: Math.round(data.Total),
  79. });
  80. app.globalData.EstimatedNewRevenue = data;
  81. }
  82. });
  83. //可提现收益
  84. var url = url="GetMiaoguoEstimatedNewRevenueList?AgentCategory="+that.data.AgentCategory+"&UserID=" + app.globalData.userInfo.UserID+"&IsDue=1";
  85. main.getData(url, function (data) {
  86. if (data) {
  87. that.setData({
  88. WithdrawableEarningsTotal: Math.round(data.Total),
  89. });
  90. app.globalData.WithdrawableEarnings = data;
  91. }
  92. });
  93. },
  94. onPullDownRefresh: function () {
  95. wx.stopPullDownRefresh();
  96. this.init();
  97. },
  98. goto: function (e) {
  99. var url = e.currentTarget.dataset.url;
  100. var gotoType = e.currentTarget.dataset.type;
  101. if (!gotoType) {
  102. wx.navigateTo({
  103. url: url,
  104. });
  105. } else {
  106. wx.redirectTo({
  107. url: url,
  108. })
  109. }
  110. },
  111. gotoIndex: function () {
  112. wx.reLaunch({
  113. url: '../../pages/index/index',
  114. })
  115. },
  116. onShareAppMessage: function () {
  117. return {
  118. title: app.globalData.ShareTitle,
  119. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  120. imageUrl: app.globalData.ShareImage,
  121. }
  122. },
  123. })