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('
');
echo('
');
echo('
' + item['pay_type'] + '
');
echo('
' + item['create_time'] + '
')
echo('
');
echo('
'+item['amount']+'
')
//1:充值 2:支出 3:退款
// if('1' == item['trade_type'] || '3' == item['trade_type']) {
// echo('
' + item['amount'] + '
');
// echo('
余额 ' + item['remaining_sum'] + '
');
// }
// if('2' == item['trade_type']) {
// echo('
-' + item['amount'] + '
');
// echo('
余额 ' + item['remaining_sum'] + '
');
// }
// echo('
');
echo('');
});
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);
}
});
})