156 lines
5.0 KiB
JavaScript
156 lines
5.0 KiB
JavaScript
$(function(){
|
|
var memberList = [];
|
|
var $table = $('.table-wrapper table tbody');
|
|
var $mask = $('.mask');
|
|
var $total = $('.total-wrapper');
|
|
$('#searchBtn').on('click',function(){
|
|
$('.table-wrapper table tbody');
|
|
var val = $('#uid').val();
|
|
sendRequest(val);
|
|
});
|
|
|
|
function sendRequest(uid){
|
|
$.ajax({
|
|
type: 'get',
|
|
url: '/statpacket/someinvitedetail?uidList='+uid,
|
|
dataType: 'json',
|
|
success: function(res){
|
|
var todayTotalRegister = 0;
|
|
var todayTotalCharge = 0;
|
|
var wholeRegister = 0;
|
|
var wholeCharge = 0;
|
|
if(res.code == 200){
|
|
$table.html('');
|
|
var data = res.data;
|
|
for(var i = 0;i < data.length;i++){
|
|
var $tr = $('<tr><td class="uid"></td><td class="register"></td><td class="charge"></td></tr>');
|
|
$tr.find('td').eq(0).html(data[i].uid);
|
|
var totalCharge = parseInt(data[i].chargeBonus / 0.05);
|
|
$tr.find('td').eq(2).html('<a href="javascript:void(0)">'+totalCharge+'</a>');
|
|
var totalRegisterCount = parseFloat(data[i].registerCout);
|
|
$tr.find('td').eq(1).html('<a href="javascript:void(0)">'+totalRegisterCount+'</a>');
|
|
$table.append($tr);
|
|
|
|
// console.log(data[i]);
|
|
// 今日总下载量
|
|
if(data[i].todayRegisterCount){
|
|
todayTotalRegister += data[i].todayRegisterCount;
|
|
$total.find('.todayRegister span').html(todayTotalRegister);
|
|
}
|
|
// 今日总充值额
|
|
if(data[i].todayChargeBonus){
|
|
todayTotalCharge += data[i].todayChargeBonus;
|
|
$total.find('.todayCharge span').html(parseInt(todayTotalCharge/0.05));
|
|
}
|
|
|
|
// 总下载量
|
|
if(data[i].registerCout){
|
|
wholeRegister += data[i].registerCout;
|
|
$total.find('.totalRegister span').html(wholeRegister);
|
|
}
|
|
|
|
// 总充值额
|
|
if(data[i].chargeBonus){
|
|
wholeCharge += data[i].chargeBonus;
|
|
$total.find('.totalCharge span').html(parseInt(wholeCharge/0.05));
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
$('.mask .back').on('click',function(){
|
|
$(this).parent().animate({
|
|
left: '100%'
|
|
},200);
|
|
// var uid = $(this).siblings('.uid').html();
|
|
|
|
});
|
|
|
|
$table.on('click','.register',function(){
|
|
$('.mask').animate({
|
|
left: '0%'
|
|
},200);
|
|
var uid = $(this).siblings('.uid').html();
|
|
// var uid = $(this).find('.uid').html();
|
|
$mask.find('.block .title .first').html('下载量详情');
|
|
$mask.find('.content-title').html('Uid:' + uid);
|
|
$.ajax({
|
|
type: 'get',
|
|
url: '/statpacket/invitedetail?uid='+uid,
|
|
dataType:'json',
|
|
success:function(res){
|
|
if(res.code == 200){
|
|
var data = res.data;
|
|
var $table = $mask.find('table');
|
|
$table.find('thead').html('');
|
|
$table.find('tbody').html('');
|
|
$mask.find('.block .title .second').html('总下载量:'+data.inviteDetail.totalRegisterCount);
|
|
var theadStr = '<tr><th>Uid</th><th>昵称</th><th>注册时间</th></tr>';
|
|
$table.find('thead').html(theadStr);
|
|
for(var i = 0;i < data.inviteList.length;i++){
|
|
var $tr = $('<tr />');
|
|
var tbodyStr = '<td>'+data.inviteList[i].uid+'</td><td>'+data.inviteList[i].nick+'</td><td>'+new Date(data.inviteList[i].createTime).format('yyyy-MM-dd hh:mm:ss')+'</td>';
|
|
$tr.html(tbodyStr);
|
|
$table.find('tbody').append($tr);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
$table.on('click','.charge',function(){
|
|
$('.mask').animate({
|
|
left: '0%'
|
|
},200);
|
|
var uid = $(this).siblings('.uid').html();
|
|
$mask.find('.block .title .first').html('充值额详情');
|
|
$mask.find('.content-title').html('Uid:' + uid);
|
|
$.ajax({
|
|
type: 'get',
|
|
url: '/statbouns/detail?uid='+uid,
|
|
dataType:'json',
|
|
success:function(res){
|
|
if(res.code == 200){
|
|
var data = res.data;
|
|
var $table = $mask.find('table');
|
|
$table.find('thead').html('');
|
|
$table.find('tbody').html('');
|
|
$mask.find('.block .title .second').html('总充值额:'+ parseInt(data.totalBouns/0.05) + '元');
|
|
var theadStr = '<tr><th>Uid</th><th>昵称</th><th>充值金额</th><th>充值时间</th></tr>';
|
|
$table.find('thead').html(theadStr);
|
|
for(var i = 0;i < data.bounsList.length;i++){
|
|
var $tr = $('<tr />');
|
|
var tbodyStr = '<td>'+data.bounsList[i].uid+'</td><td>'+data.bounsList[i].nick+'</td><td>'+parseInt(data.bounsList[i].packetNum/0.05)+'</td><td>'+new Date(data.bounsList[i].createTime).format('yyyy-MM-dd hh:mm:ss')+'</td>';
|
|
$tr.html(tbodyStr);
|
|
$table.find('tbody').append($tr);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
Date.prototype.format = function(format) {
|
|
var o = {
|
|
"M+": this.getMonth() + 1,
|
|
"d+": this.getDate(),
|
|
"h+": this.getHours(),
|
|
"m+": this.getMinutes(),
|
|
"s+": this.getSeconds(),
|
|
"q+": Math.floor((this.getMonth() + 3) / 3),
|
|
"S": this.getMilliseconds()
|
|
};
|
|
if (/(y+)/.test(format)) {
|
|
format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
|
}
|
|
for (var k in o) {
|
|
if (new RegExp("(" + k + ")").test(format)) {
|
|
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
|
|
}
|
|
}
|
|
return format;
|
|
}; |