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

151 lines
4.9 KiB
JavaScript

//*********************
//客户统计
//********************
function LoadCustomer() {
$.ajax({
url: "/Student/CustomerCount/GetCustomerExist",
type: "POST",
async: false,
dataType: "json",
data: {
rId: Math.random()
},
success: function (data) {
if (data != null) {
SetLoadCustomer.SetCustomerNum(data);
}
}
});
}
$(function () {
//加载客户信息
LoadCustomer();
})
//设置数据
var SetLoadCustomer = {
SetCustomerNum: function (data) {
var CustomerExistSum = data.CustomerExistSum; //获得存在客户
var CustomerPotentialSum = data.CustomerPotentialSum;//获得潜在客户
var CustomerExistHighAssets = data.CustomerExistHighAssets; //获得高净值存在客户
var CustomerPotentialHighAssets = data.CustomerPotentialHighAssets;//获得高净值潜在客户
$("#CustomerCount #CustomerExistSum").text(data.CustomerExistSum);
$("#CustomerCount #CustomerPotentialSum").text(data.CustomerPotentialSum);
$("#CustomerCount #CustomerExistHighAssets").text(data.CustomerExistHighAssets);
$("#CustomerCount #CustomerPotentialHighAssets").text(data.CustomerPotentialHighAssets);
//右边画饼(非高净值已有客户 高净值已有客户 非高净值潜在客户 高净值潜在客户)
var notCustomerExistHighAssets = CustomerExistSum - CustomerExistHighAssets; //非高净值存在客户
var notCustomerPotentialHighAssets = CustomerPotentialSum - CustomerPotentialHighAssets;//非高净值潜在客户
if (notCustomerExistHighAssets == 0 && notCustomerPotentialHighAssets == 0 && CustomerExistHighAssets == 0 && CustomerPotentialHighAssets==0) {
} else {
ShowPieInfoRight(notCustomerExistHighAssets, notCustomerPotentialHighAssets, CustomerExistHighAssets, CustomerPotentialHighAssets);
}
if (CustomerExistSum == 0 && CustomerPotentialSum == 0) {
} else {
//左边
ShowPieInfoLeft(CustomerExistSum, CustomerPotentialSum);
}
}
}
//右边大饼
function ShowPieInfoRight(notCustomerExistHighAssets, notCustomerPotentialHighAssets, CustomerExistHighAssets, CustomerPotentialHighAssets) {
var chart;
$('.PieRight').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: '',
//align: 'left'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
colors: ['#335267', '#e16556', '#f2a83e', '#46adb7'],
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
series: [{
type: 'pie',
name: '所占比例',
data: [
{
name: '高净值已有客户数',
y: CustomerExistHighAssets
},
{
name: '非高净值已有客户数',
y: notCustomerExistHighAssets
},
{
name: '高净值潜在客户数',
y: CustomerPotentialHighAssets,
sliced: false,
selected: false
},
{
name: '非高净值潜在客户数',
y: notCustomerPotentialHighAssets
}
]
}]
});
}
//左边大饼
function ShowPieInfoLeft(CustomerExistSum, CustomerPotentialSum) {
var chart;
$('.Pieleft').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: '',
//align: 'left'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
colors: ['#335267', '#e16556', '#f2a83e', '#46adb7'],
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
series: [{
type: 'pie',
name: '客户构成比例',
data: [
['已有客户总数', CustomerExistSum],
{
name: '潜在客户总数',
y: CustomerPotentialSum,
sliced: false,
selected: false
},
]
}]
});
}