|
|
|
@ -3,6 +3,7 @@
|
|
|
|
|
*/
|
|
|
|
|
define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
|
|
|
|
|
'use strict';
|
|
|
|
|
var colors = ['#00c0ef', '#00a65a', '#ff851b', '#f39c12', '#d81b60', '#605ca8', '#dd4b39', '#008080', '#8B008B', '#D2691E', '#708090'];
|
|
|
|
|
|
|
|
|
|
var types = [{
|
|
|
|
|
"label": "城市合伙人",
|
|
|
|
@ -85,7 +86,121 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
|
|
|
|
|
};
|
|
|
|
|
$scope.listOrgs(1);
|
|
|
|
|
}]);
|
|
|
|
|
app.controller('orgDetailCtrl', ['$scope', '$http', '$state', 'Upload', '$uibModal','commonDialog', 'org','stateMap', function ($scope, $http, $state, Upload,$uibModal,commonDialog, org,stateMap) {
|
|
|
|
|
app.controller('orgDetailCtrl', ['$scope', '$http', '$state', 'Upload', '$filter','$uibModal','commonDialog','chartParser', 'org','stateMap', function ($scope, $http, $state, Upload,$filter,$uibModal,commonDialog, chartParser,org,stateMap) {
|
|
|
|
|
$scope.analysis = {};
|
|
|
|
|
$scope.today = new Date();
|
|
|
|
|
$scope.chooseToday = function () {
|
|
|
|
|
$scope.params.begin = $scope.params.end = new Date();
|
|
|
|
|
$scope.loadTransactionAmountInOrg();
|
|
|
|
|
};
|
|
|
|
|
$scope.chooseYesterday = function () {
|
|
|
|
|
var yesterday = new Date();
|
|
|
|
|
yesterday.setDate(yesterday.getDate() - 1);
|
|
|
|
|
$scope.params.begin = $scope.params.end = yesterday;
|
|
|
|
|
$scope.loadTransactionAmountInOrg();
|
|
|
|
|
};
|
|
|
|
|
$scope.chooseLast7Days = function () {
|
|
|
|
|
$scope.params.end = new Date();
|
|
|
|
|
var day = new Date();
|
|
|
|
|
day.setDate(day.getDate() - 7);
|
|
|
|
|
$scope.params.begin = day;
|
|
|
|
|
$scope.loadTransactionAmountInOrg();
|
|
|
|
|
};
|
|
|
|
|
$scope.thisMonth = function () {
|
|
|
|
|
$scope.params.end = new Date();
|
|
|
|
|
var monthBegin = new Date();
|
|
|
|
|
monthBegin.setDate(1);
|
|
|
|
|
$scope.params.begin = monthBegin;
|
|
|
|
|
$scope.loadTransactionAmountInOrg();
|
|
|
|
|
};
|
|
|
|
|
$scope.lastMonth = function () {
|
|
|
|
|
var monthFinish = new Date();
|
|
|
|
|
monthFinish.setDate(0);
|
|
|
|
|
$scope.params.end = monthFinish;
|
|
|
|
|
var monthBegin = new Date();
|
|
|
|
|
monthBegin.setDate(0);
|
|
|
|
|
monthBegin.setDate(1);
|
|
|
|
|
$scope.params.begin = monthBegin;
|
|
|
|
|
$scope.loadTransactionAmountInOrg();
|
|
|
|
|
};
|
|
|
|
|
$scope.thisYear = function () {
|
|
|
|
|
var yearFinish = new Date();
|
|
|
|
|
$scope.params.end = yearFinish;
|
|
|
|
|
var currentYearFirstDate = new Date(new Date().getFullYear(), 0, 1);
|
|
|
|
|
$scope.params.begin = currentYearFirstDate;
|
|
|
|
|
$scope.loadTransactionAmountInOrg();
|
|
|
|
|
};
|
|
|
|
|
$scope.scales = [
|
|
|
|
|
{
|
|
|
|
|
key: 'today',
|
|
|
|
|
label: '今日',
|
|
|
|
|
params: function () {
|
|
|
|
|
return {
|
|
|
|
|
begin: $filter('date')(new Date(), 'yyyyMMdd'),
|
|
|
|
|
end: $filter('date')(new Date(), 'yyyyMMdd'),
|
|
|
|
|
timezone: jstz.determine().name()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'yesterday',
|
|
|
|
|
label: '昨日',
|
|
|
|
|
params: function () {
|
|
|
|
|
var date = new Date();
|
|
|
|
|
date = date.setDate(date.getDate() - 1);
|
|
|
|
|
return {
|
|
|
|
|
begin: $filter('date')(date, 'yyyyMMdd'),
|
|
|
|
|
end: $filter('date')(date, 'yyyyMMdd')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'seven',
|
|
|
|
|
label: '近7日',
|
|
|
|
|
params: function () {
|
|
|
|
|
var date = new Date();
|
|
|
|
|
var end = $filter('date')(date, 'yyyyMMdd');
|
|
|
|
|
date = date.setDate(date.getDate() - 6);
|
|
|
|
|
return {
|
|
|
|
|
begin: $filter('date')(date, 'yyyyMMdd'),
|
|
|
|
|
end: end
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'month',
|
|
|
|
|
label: '本月',
|
|
|
|
|
params: function () {
|
|
|
|
|
var date = new Date();
|
|
|
|
|
var end = $filter('date')(date, 'yyyyMMdd');
|
|
|
|
|
date = date.setDate(1);
|
|
|
|
|
return {
|
|
|
|
|
begin: $filter('date')(date, 'yyyyMMdd'),
|
|
|
|
|
end: end
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'lastmonth',
|
|
|
|
|
label: '上月',
|
|
|
|
|
params: function () {
|
|
|
|
|
var date = new Date();
|
|
|
|
|
date = date.setDate(1);
|
|
|
|
|
var oneDay=1000*60*60*24;
|
|
|
|
|
var end = $filter('date')(date-oneDay, 'yyyyMMdd');
|
|
|
|
|
|
|
|
|
|
var date2 = new Date();
|
|
|
|
|
date2.setDate(1);
|
|
|
|
|
date2.setMonth(date2.getMonth() - 1);
|
|
|
|
|
var begin = $filter('date')(date2, 'yyyyMMdd');
|
|
|
|
|
return {
|
|
|
|
|
begin: begin,
|
|
|
|
|
end: end
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$scope.types = angular.copy(types);
|
|
|
|
|
$scope.states = stateMap.configs();
|
|
|
|
|
$scope.commission_types = angular.copy(commission_types);
|
|
|
|
@ -104,6 +219,210 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
|
|
|
|
|
};
|
|
|
|
|
$scope.loadSeniorOrg(1);
|
|
|
|
|
|
|
|
|
|
$scope.loadPartners = function (page) {
|
|
|
|
|
var params = angular.copy($scope.params);
|
|
|
|
|
params.page = page || $scope.pagination.page || 1;
|
|
|
|
|
params.org_id = $scope.org.org_id;
|
|
|
|
|
$http.get('/sys/partners', {params: params}).then(function (resp) {
|
|
|
|
|
$scope.partners = resp.data.data;
|
|
|
|
|
$scope.pagination = resp.data.pagination;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
$scope.loadTransactionAmountInOrg = function () {
|
|
|
|
|
$scope.future_loading = true;
|
|
|
|
|
var params = angular.copy($scope.params);
|
|
|
|
|
if (params.begin) {
|
|
|
|
|
params.begin = $filter('date')(params.begin, 'yyyyMMdd');
|
|
|
|
|
} else {
|
|
|
|
|
params.begin = $filter('date')('2016-01-01', 'yyyyMMdd');
|
|
|
|
|
}
|
|
|
|
|
if (params.end) {
|
|
|
|
|
params.end = $filter('date')(params.end, 'yyyyMMdd');
|
|
|
|
|
} else {
|
|
|
|
|
params.end = $filter('date')(new Date(), 'yyyyMMdd');
|
|
|
|
|
}
|
|
|
|
|
params.org_id = $scope.org.org_id;
|
|
|
|
|
|
|
|
|
|
$http.get('/analysis/org/sales', {params: params}).then(function (resp) {
|
|
|
|
|
$scope.orgAmounts = resp.data;
|
|
|
|
|
$scope.legends = [];
|
|
|
|
|
for (var i = 0; i < resp.data.length; i++) {
|
|
|
|
|
$scope.legends[i] = resp.data[i].org_name;
|
|
|
|
|
}
|
|
|
|
|
if($scope.orgAmounts.length >= 1){
|
|
|
|
|
$scope.chooseOrg = resp.data[0].org_name;
|
|
|
|
|
loadPartnersByOrgId(resp.data[0].org_id);
|
|
|
|
|
}
|
|
|
|
|
$scope.future_loading = false;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
function loadPartnersByOrgId(org_id) {
|
|
|
|
|
var params = angular.copy($scope.params);
|
|
|
|
|
if (params.begin) {
|
|
|
|
|
params.begin = $filter('date')(params.begin, 'yyyyMMdd');
|
|
|
|
|
} else {
|
|
|
|
|
params.begin = $filter('date')('2016-01-01', 'yyyyMMdd');
|
|
|
|
|
}
|
|
|
|
|
if (params.end) {
|
|
|
|
|
params.end = $filter('date')(params.end, 'yyyyMMdd');
|
|
|
|
|
} else {
|
|
|
|
|
params.end = $filter('date')(new Date(), 'yyyyMMdd');
|
|
|
|
|
}
|
|
|
|
|
$http.get('/analysis/org/'+org_id+'/partners', {params: params}).then(function (resp) {
|
|
|
|
|
$scope.salespartners = resp.data;
|
|
|
|
|
$scope.partnerSales1 = [];
|
|
|
|
|
$scope.partnerSales2 = [];
|
|
|
|
|
$scope.partnerSalesList = [];
|
|
|
|
|
var partnerSales = angular.copy($scope.salespartners);
|
|
|
|
|
var partnerSalesSize = 0;
|
|
|
|
|
if (partnerSales.length % 2 == 0) {
|
|
|
|
|
partnerSalesSize = partnerSales.length / 2;
|
|
|
|
|
} else {
|
|
|
|
|
partnerSalesSize = (partnerSales.length + 1) / 2
|
|
|
|
|
}
|
|
|
|
|
for (var i = 0; i < partnerSalesSize; i++) {
|
|
|
|
|
var item = [];
|
|
|
|
|
item[0] = partnerSales[i * 2];
|
|
|
|
|
if (i * 2 - 1 < partnerSales.length) {
|
|
|
|
|
item[1] = partnerSales[i * 2 + 1];
|
|
|
|
|
}
|
|
|
|
|
$scope.partnerSalesList[i] = item;
|
|
|
|
|
}
|
|
|
|
|
$scope.future_loading = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$scope.reloadTrade = function () {
|
|
|
|
|
loadFeeAnalysis($scope.scales[2].params());
|
|
|
|
|
loadNewClientAnalysis($scope.scales[2].params());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.chooseLast7Days();
|
|
|
|
|
//$scope.loadTransactionAmountInOrg();
|
|
|
|
|
|
|
|
|
|
function loadFeeAnalysis(params) {
|
|
|
|
|
var analysisConfig = {
|
|
|
|
|
chart: {
|
|
|
|
|
tooltip: {
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
formatter: '{b}:AUD {c}'
|
|
|
|
|
},
|
|
|
|
|
toolbox: {
|
|
|
|
|
show: true,
|
|
|
|
|
feature: {
|
|
|
|
|
mySeven: {
|
|
|
|
|
title: '最近7天',
|
|
|
|
|
show: true,
|
|
|
|
|
icon: 'path://M3.59-4.07L32.38-4.07L32.38 0.04Q22.25 25.11 17.19 46.34L10.65 46.34Q16.14 26.94 26.19 1.41L3.59 1.41L3.59-4.07Z',
|
|
|
|
|
onclick: function () {
|
|
|
|
|
loadFeeAnalysis($scope.scales[2].params())
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
myThirty: {
|
|
|
|
|
title: '最近30天',
|
|
|
|
|
show: true,
|
|
|
|
|
icon: 'path://M12.52 17.02L16.10 17.02Q20.71 17.02 22.43 15.72Q25.66 13.23 25.66 8.23Q25.66-0.63 17.61-0.63Q10.93-0.63 9.42 6.93L3.73 6.93Q4.50 2.19 7.03-0.91Q10.90-5.51 17.61-5.51Q23.24-5.51 26.89-2.28Q31.22 1.52 31.22 8.02Q31.22 16.78 23.38 19.48Q32.84 23.14 32.84 32.81Q32.84 39.00 29.32 42.97Q25.10 47.79 17.72 47.79Q10.79 47.79 6.68 43.04Q3.66 39.56 3.02 33.44L8.93 33.44Q9.67 42.83 17.72 42.83Q21.45 42.83 23.98 40.72Q27.14 38.01 27.14 32.81Q27.14 21.63 16.10 21.63L12.52 21.63L12.52 17.02ZM54-5.51Q67.99-5.51 67.99 21.14Q67.99 47.79 54 47.79Q40.04 47.79 40.04 21.14Q40.04-5.51 54-5.51M46.97 33.65L59.84 4.30Q57.80-0.55 53.93-0.55Q45.95-0.55 45.95 21.14Q45.95 28.52 46.97 33.65M48.16 37.91Q50.13 42.83 54 42.83Q62.09 42.83 62.09 21.07Q62.09 13.86 61.07 8.66L48.16 37.91Z',
|
|
|
|
|
onclick: function () {
|
|
|
|
|
var params = {};
|
|
|
|
|
var dt = new Date();
|
|
|
|
|
params.end = $filter('date')(dt, 'yyyyMMdd');
|
|
|
|
|
dt.setDate(dt.getDate() - 29);
|
|
|
|
|
params.begin = $filter('date')(dt, 'yyyyMMdd');
|
|
|
|
|
loadFeeAnalysis(params)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
yAxis: {
|
|
|
|
|
type: 'value',
|
|
|
|
|
name: '交易金额(AUD)'
|
|
|
|
|
},
|
|
|
|
|
color: colors
|
|
|
|
|
},
|
|
|
|
|
xAxis: {
|
|
|
|
|
basic: {
|
|
|
|
|
type: 'category',
|
|
|
|
|
boundaryGap: false
|
|
|
|
|
},
|
|
|
|
|
key: 'trade_date'
|
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
basic: {type: 'line', label: {normal: {show: true}}, showAllSymbols: true},
|
|
|
|
|
column: {key: 'total'}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
params.org_id = $scope.org.org_id;
|
|
|
|
|
$http.get('/dashboard/system/fee_analysis', {params: params}).then(function (resp) {
|
|
|
|
|
$scope.analysis.trade_line = chartParser.parse(analysisConfig, resp.data.reverse());
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function loadNewClientAnalysis(params) {
|
|
|
|
|
var analysisConfig = {
|
|
|
|
|
chart: {
|
|
|
|
|
tooltip: {
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
formatter: '新增商户数'
|
|
|
|
|
},
|
|
|
|
|
toolbox: {
|
|
|
|
|
show: true,
|
|
|
|
|
feature: {
|
|
|
|
|
mySeven: {
|
|
|
|
|
title: '最近7天',
|
|
|
|
|
show: true,
|
|
|
|
|
icon: 'path://M3.59-4.07L32.38-4.07L32.38 0.04Q22.25 25.11 17.19 46.34L10.65 46.34Q16.14 26.94 26.19 1.41L3.59 1.41L3.59-4.07Z',
|
|
|
|
|
onclick: function () {
|
|
|
|
|
loadNewClientAnalysis($scope.scales[2].params())
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
myThirty: {
|
|
|
|
|
title: '最近30天',
|
|
|
|
|
show: true,
|
|
|
|
|
icon: 'path://M12.52 17.02L16.10 17.02Q20.71 17.02 22.43 15.72Q25.66 13.23 25.66 8.23Q25.66-0.63 17.61-0.63Q10.93-0.63 9.42 6.93L3.73 6.93Q4.50 2.19 7.03-0.91Q10.90-5.51 17.61-5.51Q23.24-5.51 26.89-2.28Q31.22 1.52 31.22 8.02Q31.22 16.78 23.38 19.48Q32.84 23.14 32.84 32.81Q32.84 39.00 29.32 42.97Q25.10 47.79 17.72 47.79Q10.79 47.79 6.68 43.04Q3.66 39.56 3.02 33.44L8.93 33.44Q9.67 42.83 17.72 42.83Q21.45 42.83 23.98 40.72Q27.14 38.01 27.14 32.81Q27.14 21.63 16.10 21.63L12.52 21.63L12.52 17.02ZM54-5.51Q67.99-5.51 67.99 21.14Q67.99 47.79 54 47.79Q40.04 47.79 40.04 21.14Q40.04-5.51 54-5.51M46.97 33.65L59.84 4.30Q57.80-0.55 53.93-0.55Q45.95-0.55 45.95 21.14Q45.95 28.52 46.97 33.65M48.16 37.91Q50.13 42.83 54 42.83Q62.09 42.83 62.09 21.07Q62.09 13.86 61.07 8.66L48.16 37.91Z',
|
|
|
|
|
onclick: function () {
|
|
|
|
|
var params = {};
|
|
|
|
|
var dt = new Date();
|
|
|
|
|
params.end = $filter('date')(dt, 'yyyyMMdd');
|
|
|
|
|
dt.setDate(dt.getDate() - 29);
|
|
|
|
|
params.begin = $filter('date')(dt, 'yyyyMMdd');
|
|
|
|
|
loadNewClientAnalysis(params)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
yAxis: {
|
|
|
|
|
type: 'value',
|
|
|
|
|
name: '新增商户数'
|
|
|
|
|
},
|
|
|
|
|
color: colors
|
|
|
|
|
},
|
|
|
|
|
xAxis: {
|
|
|
|
|
basic: {
|
|
|
|
|
type: 'category',
|
|
|
|
|
boundaryGap: false
|
|
|
|
|
},
|
|
|
|
|
key: 'create_time'
|
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
basic: {type: 'line', label: {normal: {show: true}}, showAllSymbols: true},
|
|
|
|
|
column: {key: 'new_clients'}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
params.org_id = $scope.org.org_id;
|
|
|
|
|
$http.get('/dashboard/system/new_clients', {params: params}).then(function (resp) {
|
|
|
|
|
$scope.analysis.clients_line = chartParser.parse(analysisConfig, resp.data.reverse());
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.loadPartners(1);
|
|
|
|
|
|
|
|
|
|
$scope.uploadLogo = function (file) {
|
|
|
|
|
if (file == null) {
|
|
|
|
|
return;
|
|
|
|
@ -158,14 +477,14 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.params = {role:'1111111',org_id:$scope.org.org_id};
|
|
|
|
|
$scope.pagination = {};
|
|
|
|
|
$scope.paginationa = {};
|
|
|
|
|
$scope.listManagers = function (page) {
|
|
|
|
|
var params = angular.copy($scope.params);
|
|
|
|
|
params.page = page || $scope.pagination.page || 1;
|
|
|
|
|
params.page = page || $scope.paginationa.page || 1;
|
|
|
|
|
|
|
|
|
|
$http.get('/sys/manager_accounts',{params:params}).then(function (resp) {
|
|
|
|
|
$scope.managers = resp.data.data;
|
|
|
|
|
$scope.pagination = resp.data.pagination;
|
|
|
|
|
$scope.paginationa = resp.data.pagination;
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|