You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

recharge_list.js 3.6 KiB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. var current_page = '1';
  2. var page_size = 10;
  3. var myscroll = null;
  4. window.onload = function() {
  5. httpLoadInfo();
  6. }
  7. function httpLoadInfo() {
  8. current_page = '1';
  9. loadData();
  10. }
  11. function loadData() {
  12. var data = {
  13. current_page: current_page,
  14. page_size: page_size
  15. }
  16. $.ajax({
  17. type: "post",
  18. url: base_api + 'user/fx-user/recharge-list',
  19. async: true,
  20. data: data,
  21. dataType: "json",
  22. success: function(res_data) {
  23. ZZLog(res_data);
  24. if(false == res_data['flag']) {
  25. if(codeNotLogin == res_data['code']) {
  26. var URL = '/web/fx/recharge_list.html';
  27. URL = encodeURI(URL);
  28. location.href = res_data['url'] + URL;
  29. } else if(codeNotRegister == res_data['code']) {
  30. location.href = 'register.html';
  31. } else {
  32. alert(res_data['msg']);
  33. }
  34. } else {
  35. var data = res_data['data'];
  36. var list = data['list'];
  37. var html = GetHtml(list);
  38. document.getElementById("list").innerHTML = html;
  39. if(list.length<=page_size) $('.more').hide();
  40. if (list.length == 0) {
  41. $('#no_info').show();
  42. }else{
  43. $('#no_info').hide();
  44. }
  45. }
  46. },
  47. error: function() {
  48. alert(infoApiError);
  49. }
  50. });
  51. }
  52. function GetHtml(list) {
  53. var list_html = '';
  54. function echo(html) {
  55. list_html += html;
  56. }
  57. list.forEach(function(item, index) {
  58. echo('<div class="ub div_style" >');
  59. echo('<div class="ub-f1 ub ub-ver">');
  60. echo('<div class="ulev1" style="color: #2b3857;">' + item['pay_type'] + '</div>');
  61. echo('<div class="ulev0" style="color: #80889a;">' + item['create_time'] + '</div>')
  62. echo('</div>');
  63. echo('<div class="ub ub-ver ub-pe ulev2" style="font-weight:200;">'+item['amount']+'</div>')
  64. //1:充值 2:支出 3:退款
  65. // if('1' == item['trade_type'] || '3' == item['trade_type']) {
  66. // echo('<div class="ub ub-ae ub-pe ulev2" style="color: #2d2f3b;">' + item['amount'] + '</div>');
  67. // echo('<div class="ub ub-ae" style="color: #80889a;">余额 ' + item['remaining_sum'] + '</div>');
  68. // }
  69. // if('2' == item['trade_type']) {
  70. // echo('<div class="ub ub-ae ub-pe ulev2" style="color: #80889a;">-' + item['amount'] + '</div>');
  71. // echo('<div class="ub ub-ae" style="color: #80889a;">余额 ' + item['remaining_sum'] + '</div>');
  72. // }
  73. // echo('</div>');
  74. echo('</div>');
  75. });
  76. return list_html;
  77. }
  78. $('.more').on('touchstart', function() {
  79. if($(this).attr('allow_click')=='false'){
  80. return;
  81. }
  82. // $('.pull_icon').addClass('loading');
  83. $('.more span').text('正在加载');
  84. current_page++;
  85. var data = {
  86. current_page: current_page,
  87. page_size: page_size
  88. }
  89. $.ajax({
  90. type: "post",
  91. url: base_api + 'user/fx-user/get-amount-log',
  92. async: true,
  93. data: data,
  94. dataType: "json",
  95. success: function(res_data) {
  96. ZZLog(res_data);
  97. // $('.pull_icon').removeClass('loading');
  98. $('.more span').text('加载更多…');
  99. if(false == res_data['flag']) {
  100. if(codeNotLogin == res_data['code']) {
  101. var URL = '/web/fx/recharge_list.html';
  102. URL = encodeURI(URL);
  103. location.href = res_data['url'] + URL;
  104. } else if(codeNotRegister == res_data['code']) {
  105. location.href = 'register.html';
  106. } else {
  107. current_page--;
  108. alert(res_data['msg']);
  109. }
  110. } else {
  111. var data = res_data['data'];
  112. var list = data['list'];
  113. if(list.length==0){
  114. // $('.pull_icon').removeClass('loading');
  115. $('.more span').text('没有更多的数据了');
  116. $('.more').attr('allow_click','false');
  117. }
  118. var html = GetHtml(list);
  119. document.getElementById("list").innerHTML += html;
  120. }
  121. },
  122. error: function() {
  123. // $('.pull_icon').removeClass('loading');
  124. current_page--;
  125. $('.more span').text('加载更多…');
  126. alert(infoApiError);
  127. }
  128. });
  129. })