|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- var current_page = '1';
- var page_size = 10;
- var myscroll = null;
- window.onload = function() {
-
- httpLoadInfo();
-
- }
-
- function httpLoadInfo() {
- current_page = '1';
- loadData();
- }
-
- function loadData() {
- var data = {
- current_page: current_page,
- page_size: page_size
- }
- $.ajax({
- type: "post",
- url: base_api + 'user/fx-user/recharge-list',
- async: true,
- data: data,
- dataType: "json",
- success: function(res_data) {
- ZZLog(res_data);
- if(false == res_data['flag']) {
- if(codeNotLogin == res_data['code']) {
- var URL = '/web/fx/recharge_list.html';
- URL = encodeURI(URL);
- location.href = res_data['url'] + URL;
- } else if(codeNotRegister == res_data['code']) {
- location.href = 'register.html';
- } else {
- alert(res_data['msg']);
- }
- } else {
- var data = res_data['data'];
- var list = data['list'];
-
- var html = GetHtml(list);
- document.getElementById("list").innerHTML = html;
- if(list.length<=page_size) $('.more').hide();
- if (list.length == 0) {
- $('#no_info').show();
- }else{
- $('#no_info').hide();
- }
- }
- },
- error: function() {
- alert(infoApiError);
- }
- });
- }
-
- function GetHtml(list) {
- var list_html = '';
-
- function echo(html) {
- list_html += html;
- }
- list.forEach(function(item, index) {
- echo('<div class="ub div_style" >');
- echo('<div class="ub-f1 ub ub-ver">');
- echo('<div class="ulev1" style="color: #2b3857;">' + item['pay_type'] + '</div>');
- echo('<div class="ulev0" style="color: #80889a;">' + item['create_time'] + '</div>')
- echo('</div>');
- echo('<div class="ub ub-ver ub-pe ulev2" style="font-weight:200;">'+item['amount']+'</div>')
- //1:充值 2:支出 3:退款
- // if('1' == item['trade_type'] || '3' == item['trade_type']) {
- // echo('<div class="ub ub-ae ub-pe ulev2" style="color: #2d2f3b;">' + item['amount'] + '</div>');
- // echo('<div class="ub ub-ae" style="color: #80889a;">余额 ' + item['remaining_sum'] + '</div>');
- // }
- // if('2' == item['trade_type']) {
- // echo('<div class="ub ub-ae ub-pe ulev2" style="color: #80889a;">-' + item['amount'] + '</div>');
- // echo('<div class="ub ub-ae" style="color: #80889a;">余额 ' + item['remaining_sum'] + '</div>');
- // }
- // echo('</div>');
-
- echo('</div>');
- });
- return list_html;
- }
-
- $('.more').on('touchstart', function() {
- if($(this).attr('allow_click')=='false'){
- return;
- }
- // $('.pull_icon').addClass('loading');
- $('.more span').text('正在加载');
- current_page++;
- var data = {
- current_page: current_page,
- page_size: page_size
- }
- $.ajax({
- type: "post",
- url: base_api + 'user/fx-user/get-amount-log',
- async: true,
- data: data,
- dataType: "json",
- success: function(res_data) {
- ZZLog(res_data);
- // $('.pull_icon').removeClass('loading');
- $('.more span').text('加载更多…');
- if(false == res_data['flag']) {
- if(codeNotLogin == res_data['code']) {
- var URL = '/web/fx/recharge_list.html';
- URL = encodeURI(URL);
- location.href = res_data['url'] + URL;
- } else if(codeNotRegister == res_data['code']) {
- location.href = 'register.html';
- } else {
- current_page--;
- alert(res_data['msg']);
- }
- } else {
- var data = res_data['data'];
- var list = data['list'];
- if(list.length==0){
- // $('.pull_icon').removeClass('loading');
- $('.more span').text('没有更多的数据了');
- $('.more').attr('allow_click','false');
- }
- var html = GetHtml(list);
- document.getElementById("list").innerHTML += html;
- }
- },
- error: function() {
- // $('.pull_icon').removeClass('loading');
- current_page--;
- $('.more span').text('加载更多…');
- alert(infoApiError);
- }
- });
-
-
- })
|