/**
|
* 角色管理的单例
|
*/
|
var Statistics = {
|
id: "StatisticsTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1,
|
type: 1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
Statistics.initColumn = function () {
|
var columns = [
|
{field: 'select_item', radio: true},
|
// {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
|
{title: '时间', field: 'aggregateTime', align: 'center', valign: 'middle',width: '100px'}
|
]
|
var ajax = new $ax(Feng.ctxPath + "/vipLevel/queryVipLevel", function (res) {
|
if(res.code == 200){
|
let data = res.data;
|
columns.push({title: "LV1且成长值为0(人数)", field: 'vip_0', align: 'center', valign: 'middle',width: '180px'})
|
columns.push({title: "LV1且成长值为0(占比)", field: 'vip_0', align: 'center', valign: 'middle',width: '180px',
|
formatter: function (value, row) {
|
if(row.vipTotal>0){
|
return ((value/row.vipTotal)*100).toFixed(2)+"%";
|
}else {
|
return 0;
|
}
|
|
}
|
})
|
for(let i in data){
|
if(i==0){
|
//L1且成长值大于0
|
columns.push({title: "LV1且成长值大于0(人数)", field: 'vip' + i, align: 'center', valign: 'middle',width: '180px',})
|
columns.push({title: "LV1且成长值大于0(占比)", field: 'vip' + i, align: 'center', valign: 'middle',width: '180px',
|
formatter: function (value, row) {
|
if(row.vipTotal>0){
|
return ((value/row.vipTotal)*100).toFixed(2)+"%";
|
}else {
|
return 0;
|
}
|
}
|
})
|
}else {
|
columns.push({title: data[i].name + "(人数)", field: 'vip' + i, align: 'center', valign: 'middle',width: '100px'})
|
columns.push({title: data[i].name + "(占比)", field: 'vip' + i, align: 'center', valign: 'middle',width: '100px',
|
formatter: function (value, row) {
|
if(row.vipTotal>0){
|
return ((value/row.vipTotal)*100).toFixed(2)+"%";
|
}else {
|
return 0;
|
}
|
}
|
})
|
}
|
|
}
|
columns.push({title: "总计", field: 'vipTotal', align: 'center', valign: 'middle',width: '100px'})
|
}else{
|
Feng.error(data.msg);
|
}
|
}, function (data) {
|
Feng.error("获取失败!" + data.responseJSON.message + "!");
|
});
|
|
|
|
ajax.set();
|
ajax.start();
|
return columns;
|
};
|
|
|
/**
|
* 检查是否选中
|
*/
|
Statistics.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if (selected.length == 0) {
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
} else {
|
Statistics.seItem = selected[0];
|
return true;
|
}
|
};
|
|
|
Statistics.exportStatistics = function(){
|
const time = $("#time").val();
|
let url = Feng.ctxPath + "/statistics/exportVipLevelNumber?type=" + Statistics.type + "&";
|
if(null != time && '' != time){
|
url += "time=" + time + "&";
|
}
|
window.location.href = url;
|
}
|
|
|
Statistics.upgrade = function(){
|
var index = layer.open({
|
type: 2,
|
title: '升级明细',
|
area: ['80%', '90%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/statistics/showUpgrade'
|
});
|
this.layerIndex = index;
|
}
|
|
Statistics.downgrade = function(){
|
var index = layer.open({
|
type: 2,
|
title: '降级明细',
|
area: ['80%', '90%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/statistics/showDowngrade'
|
});
|
this.layerIndex = index;
|
}
|
|
Statistics.constant = function(){
|
var index = layer.open({
|
type: 2,
|
title: '级别不变明细',
|
area: ['80%', '90%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/statistics/showConstant'
|
});
|
this.layerIndex = index;
|
}
|
|
|
|
Statistics.summaryGraph = function(){
|
var index = layer.open({
|
type: 2,
|
title: '统计图',
|
area: ['80%', '90%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/statistics/openVipLevelNumberSummaryGraph'
|
});
|
this.layerIndex = index;
|
}
|
|
|
Statistics.equityDetails = function(){
|
var index = layer.open({
|
type: 2,
|
title: '领取会员权益人数明细',
|
area: ['80%', '90%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/statistics/openEquityDetails'
|
});
|
this.layerIndex = index;
|
}
|
|
|
|
/**
|
* 搜索
|
*/
|
Statistics.search = function () {
|
var queryData = {};
|
queryData['type'] = Statistics.type;
|
queryData['time'] = $("#time").val();
|
Statistics.table.setQueryParams({});
|
Statistics.table.refresh({query: queryData});
|
}
|
|
/**
|
* 重置
|
*/
|
Statistics.resetSearch = function(){
|
var queryData = {};
|
$("#time").val('');
|
Statistics.table.setQueryParams({
|
type: Statistics.type
|
});
|
Statistics.table.refresh({query: queryData});
|
}
|
|
|
$(function () {
|
var defaultColunms = Statistics.initColumn();
|
var table = new BSTable(Statistics.id, "/statistics/queryVipLevelNumber", defaultColunms);
|
table.setPaginationType("server");
|
table.setQueryParams({
|
type: Statistics.type,
|
time: $('#time').val()
|
})
|
Statistics.table = table.init();
|
|
});
|