earnings_apply.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. RecordID:options.RecordID,
  12. AgentCategory:options.AgentCategory,
  13. });
  14. that.init();
  15. },
  16. init:function(){
  17. var that = this;
  18. var list=app.globalData.EarningsList.List1;
  19. if (that.data.AgentCategory=="ambassador")
  20. list=app.globalData.EarningsList.List2;
  21. for(var i=0;i<list.length;i++){
  22. if (list[i].ID==that.data.RecordID){
  23. that.setData({
  24. Info:list[i],
  25. });
  26. break;
  27. }
  28. }
  29. var url="GetMiaoguoAgentPayList?UserID=" + app.globalData.userInfo.UserID+"&RecordID="+that.data.RecordID+"&AgentCategory="+that.data.AgentCategory;
  30. main.getData(url, function (data) {
  31. if (data) {
  32. var list1=[],list2=[],Len=0;
  33. for(var i=0;i<data.length;i++){
  34. if (data[i].Money<0)
  35. list1.push(data[i]);
  36. else {
  37. list2.push(data[i]);
  38. if (that.data.AgentCategory=="ambassador")
  39. Len+=data[i].List.length;
  40. }
  41. }
  42. if (that.data.AgentCategory!="ambassador")
  43. Len=list2.length;
  44. that.setData({
  45. List1:list1,
  46. List2:list2,
  47. Len:Len,
  48. });
  49. }
  50. });
  51. },
  52. getID:function(e){
  53. var id=e.currentTarget.dataset.id;
  54. wx.setClipboardData({
  55. data: id.toString(),
  56. success (res) {
  57. }
  58. });
  59. },
  60. onShareAppMessage: function () {
  61. return {
  62. title: app.globalData.ShareTitle,
  63. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  64. imageUrl: app.globalData.ShareImage,
  65. }
  66. },
  67. })