other_list.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. },
  7. onLoad: function (options) {
  8. var that = this;
  9. that.setData({
  10. Containnerheight: main.getWindowHeight(),
  11. ListType:options.ListType,
  12. AgentCategory:options.AgentCategory,
  13. IsWithdraw:false,
  14. IsPromotion:false,
  15. User:app.globalData.userInfo,
  16. RefundTotal:0,
  17. });
  18. wx.setNavigationBarTitle({
  19. title: that.data.ListType
  20. });
  21. this.getList();
  22. },
  23. getList:function(e){
  24. var that = this;
  25. var url="";
  26. if (that.data.ListType=="近期报名"){
  27. that.setData({
  28. Info: app.globalData.NewUserApplyArray,
  29. });
  30. getLen(that,app.globalData.NewUserApplyArray.List);
  31. }
  32. else if (that.data.ListType=="预估新增收益"){
  33. that.setData({
  34. Info: app.globalData.EstimatedNewRevenue,
  35. Len:app.globalData.EstimatedNewRevenue.Length,
  36. Total:"0",
  37. });
  38. getLen(that,app.globalData.EstimatedNewRevenue.List);
  39. }
  40. else if (that.data.ListType=="可提现收益"){
  41. that.setData({
  42. Info: app.globalData.WithdrawableEarnings,
  43. Total:app.globalData.WithdrawableEarnings.Total,
  44. });
  45. getLen(that,app.globalData.WithdrawableEarnings.List);
  46. //查看是否有退款返还奖励
  47. url="GetRefundList?AgentCategory="+that.data.AgentCategory;
  48. url+="&UserID=" + app.globalData.userInfo.UserID;
  49. main.getData(url, function (data) {
  50. if (data) {
  51. var list=data.List;
  52. var num=0,refundTotal=0;
  53. for(var i=0;i<list.length;i++){
  54. if (list[i].IsPay===0 && list[i].Money>0){
  55. num++;
  56. refundTotal+=list[i].Money;
  57. }
  58. }
  59. that.setData({
  60. RefundNum:num,
  61. RefundTotal:refundTotal,
  62. });
  63. }
  64. });
  65. }
  66. else{
  67. if (that.data.ListType=="退款记录")
  68. url="GetRefundList?AgentCategory="+that.data.AgentCategory;
  69. else if (that.data.ListType=="未续费记录")
  70. url="GetIntroducerUserList2?ListType="+that.data.ListType+"&AgentCategory="+that.data.AgentCategory;
  71. else if (that.data.ListType=="报名步骤没做完")
  72. url="GetIntroducerUserList2?ListType="+that.data.ListType+"&AgentCategory="+that.data.AgentCategory;
  73. url+="&UserID=" + app.globalData.userInfo.UserID;
  74. main.getData(url, function (data) {
  75. if (data) {
  76. that.setData({
  77. Info: data,
  78. });
  79. getLen(that,data.List);
  80. }
  81. });
  82. }
  83. function getLen(obj,list){
  84. var len=0;
  85. if (that.data.AgentCategory=="ambassador"){
  86. for(var i=0;i<list.length;i++){
  87. len+=list[i].List.length;
  88. }
  89. }
  90. else
  91. len= list.length;
  92. that.setData({
  93. Len:len,
  94. });
  95. }
  96. },
  97. showWithdraw:function(e){
  98. this.setData({
  99. IsWithdraw:!this.data.IsWithdraw,
  100. TotalAll:common.formatMoney(Number(this.data.Total)-this.data.RefundTotal),
  101. });
  102. },
  103. applyPay:function(e){
  104. var that=this;
  105. if (that.data.Total<1){
  106. wx.showToast({
  107. title: '满1元才能提现',
  108. mask: true,
  109. image: "../../pages/images/universalpic_exclamation_white_120x120.png",
  110. });
  111. }
  112. else{
  113. wx.showLoading({
  114. title: '申请保存中',
  115. mask: true,
  116. });
  117. var url="ApplyWithdraw?UserID="+app.globalData.userInfo.UserID+"&AgentCategory="+that.data.AgentCategory;
  118. main.getData(url, function () {
  119. var url = "GetMiaoguoAgentRecordList?UserID=" + app.globalData.userInfo.UserID + "&AgentCategory=" + that.data.AgentCategory;
  120. main.getData(url, function (data) {
  121. if (data) {
  122. wx.hideLoading();
  123. app.globalData.EarningsList = data;
  124. wx.redirectTo({
  125. url: "earnings_list?IsCheck=0&AgentCategory="+that.data.AgentCategory,
  126. });
  127. }
  128. });
  129. });
  130. }
  131. },
  132. onPullDownRefresh: function () {
  133. wx.stopPullDownRefresh();
  134. },
  135. goto: function (e) {
  136. var url = e.currentTarget.dataset.url;
  137. var gotoType = e.currentTarget.dataset.type;
  138. var ispay=e.currentTarget.dataset.ispay;
  139. if (url.indexOf("earnings_apply")>=0 && ispay==undefined){
  140. return;
  141. }
  142. if (!gotoType) {
  143. wx.navigateTo({
  144. url: url,
  145. });
  146. } else {
  147. wx.redirectTo({
  148. url: url,
  149. })
  150. }
  151. },
  152. ShowImage:function(e){
  153. var url=e.currentTarget.dataset.url;
  154. wx.downloadFile({
  155. url: url,
  156. success(res) {
  157. wx.previewImage({
  158. current: res.tempFilePath, // 当前显示图片的http链接
  159. urls: [res.tempFilePath] // 需要预览的图片http链接列表
  160. });
  161. }
  162. });
  163. },
  164. onShareAppMessage: function () {
  165. return {
  166. title: app.globalData.ShareTitle,
  167. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  168. imageUrl: app.globalData.ShareImage,
  169. }
  170. },
  171. })