|
|
|
@ -643,14 +643,13 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct
|
|
|
|
|
$scope.clientMoniker = $scope.currentUser.client_moniker;
|
|
|
|
|
$scope.loadDashboard = function () {
|
|
|
|
|
loadTransCommon();
|
|
|
|
|
getAvgOrderAndCustomer();
|
|
|
|
|
getExchangeRate();
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
$scope.loadDashboard();
|
|
|
|
|
function loadTransCommon() {
|
|
|
|
|
var params = {begin: $filter('date')(new Date(), 'yyyyMMdd'), end: $filter('date')(new Date(), 'yyyyMMdd')};
|
|
|
|
|
$http.get('/dashboard/partner/trans_common',{params:params}).then(function (resp) {
|
|
|
|
|
$http.get('/dashboard/partner/common_analysis',{params:params}).then(function (resp) {
|
|
|
|
|
$scope.transcommon = resp.data;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
@ -716,11 +715,6 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
loadTradeAmountInTypes($scope.scales[2].params());
|
|
|
|
|
function getAvgOrderAndCustomer() {
|
|
|
|
|
$http.get('/dashboard/partner/' + $scope.clientMoniker + '/avg_order_customer').then(function (resp) {
|
|
|
|
|
$scope.avgOrderAndCustomer = resp.data;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function loadFeeAnalysis(params) {
|
|
|
|
@ -767,12 +761,12 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct
|
|
|
|
|
type: 'category',
|
|
|
|
|
boundaryGap: false
|
|
|
|
|
},
|
|
|
|
|
key: 'date_str'
|
|
|
|
|
key: 'date'
|
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
basic: {type: 'line', label: {normal: {show: true}}, showAllSymbols: true},
|
|
|
|
|
column: {key: 'aud_fee'}
|
|
|
|
|
column: {key: 'total'}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
@ -783,6 +777,9 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct
|
|
|
|
|
loadFeeAnalysis($scope.scales[2].params());
|
|
|
|
|
|
|
|
|
|
function getOrderCustomerChartAnalysis(params) {
|
|
|
|
|
$http.get('/dashboard/partner/avg_order_customer',{params:params}).then(function (resp) {
|
|
|
|
|
$scope.avgOrderAndCustomer = resp.data;
|
|
|
|
|
});
|
|
|
|
|
$http.get('/dashboard/partner/customers',{params:params}).then(function (resp) {
|
|
|
|
|
var dates = [];
|
|
|
|
|
var new_customers = [];
|
|
|
|
@ -817,6 +814,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct
|
|
|
|
|
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 () {
|
|
|
|
|
$scope.time_range = "Last a week";
|
|
|
|
|
getOrderCustomerChartAnalysis($scope.scales[2].params())
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
@ -830,6 +828,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct
|
|
|
|
|
params.end = $filter('date')(dt, 'yyyyMMdd');
|
|
|
|
|
dt.setDate(dt.getDate() - 29);
|
|
|
|
|
params.begin = $filter('date')(dt, 'yyyyMMdd');
|
|
|
|
|
$scope.time_range = "Last a month";
|
|
|
|
|
getOrderCustomerChartAnalysis(params)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1060,9 +1059,26 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
loadTradeTimeAnalysis($scope.scales[4].params());*/
|
|
|
|
|
$scope.displayExchangeRateHistory = function () {
|
|
|
|
|
$uibModal.open({
|
|
|
|
|
templateUrl: '/static/dashboard/templates/exchange_rate_history_dialog.html',
|
|
|
|
|
controller: 'exchangeRateHistoryDialogCtrl',
|
|
|
|
|
size: 'lg'
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.getCurrentPartner = function () {
|
|
|
|
|
$http.get('/client/partner_info').then(function (resp) {
|
|
|
|
|
$scope.manual_settle = resp.data.manual_settle;
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
$scope.getCurrentPartner();
|
|
|
|
|
$scope.toShowUnSettledDialog = function () {
|
|
|
|
|
$uibModal.open({
|
|
|
|
|
templateUrl: '/static/dashboard/templates/partner_dashboard_unsettled_dialog.html',
|
|
|
|
|
controller: 'unSettledAmountHistoryDialogCtrl'
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
$scope.loadSettlementLogs = function (page) {
|
|
|
|
|
var params = angular.copy($scope.params);
|
|
|
|
|
params.page = page || $scope.pagination.page || 1;
|
|
|
|
@ -1088,6 +1104,184 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct
|
|
|
|
|
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|
app.controller('exchangeRateHistoryDialogCtrl', ['$scope', '$http', '$filter', 'chartParser', function ($scope, $http, $filter, chartParser) {
|
|
|
|
|
$scope.loadExchangeRateHistory = function (days) {
|
|
|
|
|
var endDate = new Date();
|
|
|
|
|
var startDate = new Date();
|
|
|
|
|
startDate.setDate(startDate.getDate() - days);
|
|
|
|
|
$http.get('/dashboard/system/exchange_rates', {
|
|
|
|
|
params: {
|
|
|
|
|
begin: $filter('date')(startDate, 'yyyyMMdd'),
|
|
|
|
|
end: $filter('date')(endDate, 'yyyyMMdd')
|
|
|
|
|
}
|
|
|
|
|
}).then(function (resp) {
|
|
|
|
|
handleRateHistoryChart(resp.data);
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
$scope.loadExchangeRateHistory(7);
|
|
|
|
|
var rateHistoryConfig = {
|
|
|
|
|
chart: {
|
|
|
|
|
tooltip: {
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
},
|
|
|
|
|
toolbox: {
|
|
|
|
|
show: true,
|
|
|
|
|
feature: {
|
|
|
|
|
mySeven: {
|
|
|
|
|
title: 'Last 7 Days',
|
|
|
|
|
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 () {
|
|
|
|
|
$scope.loadExchangeRateHistory(7)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
myThirty: {
|
|
|
|
|
title: 'Last 30 Days',
|
|
|
|
|
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 () {
|
|
|
|
|
$scope.loadExchangeRateHistory(30)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
legend: {
|
|
|
|
|
data: ['Wechat', 'Alipay'],
|
|
|
|
|
bottom: 0,
|
|
|
|
|
height: '15%',
|
|
|
|
|
width: '80%',
|
|
|
|
|
left: '10%'
|
|
|
|
|
},
|
|
|
|
|
yAxis: {
|
|
|
|
|
type: 'value',
|
|
|
|
|
name: 'Exchange Rate',
|
|
|
|
|
min: 'auto'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
xAxis: {
|
|
|
|
|
basic: {
|
|
|
|
|
type: 'category',
|
|
|
|
|
boundaryGap: false
|
|
|
|
|
},
|
|
|
|
|
key: 'date'
|
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
basic: {
|
|
|
|
|
name: 'Wechat',
|
|
|
|
|
type: 'line',
|
|
|
|
|
label: {normal: {show: true}},
|
|
|
|
|
showAllSymbols: true,
|
|
|
|
|
showSymbol: true,
|
|
|
|
|
yAxisIndex: 0,
|
|
|
|
|
itemStyle : {
|
|
|
|
|
normal : {
|
|
|
|
|
color:'#09bb07',
|
|
|
|
|
lineStyle:{
|
|
|
|
|
color:'#09bb07'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
column: {key: 'Wechat.exchange_rate'}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
basic: {
|
|
|
|
|
name: 'Alipay',
|
|
|
|
|
type: 'line',
|
|
|
|
|
label: {normal: {show: true}},
|
|
|
|
|
showAllSymbols: true,
|
|
|
|
|
showSymbol: true,
|
|
|
|
|
yAxisIndex: 0,
|
|
|
|
|
itemStyle : {
|
|
|
|
|
normal : {
|
|
|
|
|
color:'#00c0ef',
|
|
|
|
|
lineStyle:{
|
|
|
|
|
color:'#00c0ef'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
column: {key: 'Alipay.exchange_rate'}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function handleRateHistoryChart(exchangeRates) {
|
|
|
|
|
$scope.rateHistory = chartParser.parse(rateHistoryConfig, exchangeRates);
|
|
|
|
|
}
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|
app.controller('unSettledAmountHistoryDialogCtrl', ['$scope', '$http', '$filter','commonDialog', function ($scope, $http, $filter,commonDialog) {
|
|
|
|
|
$scope.params = {isAll:true};
|
|
|
|
|
$scope.settleParams = {};
|
|
|
|
|
$scope.unSettledAmountHistory = function () {
|
|
|
|
|
$http.get('/client/manual_settle/today').then(function (resp) {
|
|
|
|
|
$scope.currentSettle = resp.data;
|
|
|
|
|
$scope.settleParams = angular.copy($scope.currentSettle);
|
|
|
|
|
if($scope.currentSettle.settle_to){
|
|
|
|
|
$scope.params.isAll = false;
|
|
|
|
|
$scope.params.to_date = new Date($scope.currentSettle.settle_to);
|
|
|
|
|
}
|
|
|
|
|
$scope.params.maxData = $scope.currentSettle.unsettle[0].date_str;
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
$scope.unSettledAmountHistory();
|
|
|
|
|
$scope.changeIsAll = function () {
|
|
|
|
|
if($scope.params.isAll){
|
|
|
|
|
$scope.params.to_date = '';
|
|
|
|
|
$scope.settleParams = angular.copy($scope.currentSettle);
|
|
|
|
|
}else {
|
|
|
|
|
if($scope.currentSettle.settle_to){
|
|
|
|
|
$scope.params.to_date = new Date($scope.currentSettle.settle_to);
|
|
|
|
|
}else{
|
|
|
|
|
$scope.params.to_date = $scope.params.maxData;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
$scope.$watch('params.to_date', function() {
|
|
|
|
|
$scope.settleParams = angular.copy($scope.currentSettle);
|
|
|
|
|
if($scope.params.to_date){
|
|
|
|
|
$scope.params.isAll=false;
|
|
|
|
|
$scope.to_date = $filter('date')($scope.params.to_date, 'yyyy-MM-dd');
|
|
|
|
|
var cashbackChoose = {};
|
|
|
|
|
var count = 0;
|
|
|
|
|
var total_settle_amount = 0.00;
|
|
|
|
|
angular.forEach($scope.currentSettle.unsettle, function (unsettle) {
|
|
|
|
|
if (new Date(unsettle.date_str).getTime() <= new Date($scope.to_date).getTime()) {
|
|
|
|
|
cashbackChoose[count] = unsettle;
|
|
|
|
|
if(unsettle.settle_amount != null){
|
|
|
|
|
total_settle_amount = decimal.add(unsettle.settle_amount,total_settle_amount).toFixed(2);
|
|
|
|
|
}
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
$scope.settleParams.unsettle = cashbackChoose;
|
|
|
|
|
$scope.settleParams.total_settle_amount = total_settle_amount;
|
|
|
|
|
}else {
|
|
|
|
|
$scope.params.isAll = true;
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
$scope.$digest();
|
|
|
|
|
}catch (err){}
|
|
|
|
|
});
|
|
|
|
|
$scope.manualSettle = function () {
|
|
|
|
|
if($scope.currentSettle.locked){
|
|
|
|
|
alert("系统正好在执行清算任务,暂不能提现,请稍后再试!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$scope.settle_to = $scope.params.to_date || $scope.params.maxData;
|
|
|
|
|
$scope.settle_to = $filter('date')($scope.settle_to, 'yyyy-MM-dd');
|
|
|
|
|
$http.put('/client/manual_settle/today', {settle_to: $scope.settle_to}).then(function () {
|
|
|
|
|
commonDialog.alert({title: 'Success', content: 'Withdraw application has been submitted', type: 'success'});
|
|
|
|
|
$scope.$close();
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}]);
|
|
|
|
|
app.filter('abs', function () {
|
|
|
|
|
return function (value) {
|
|
|
|
|
return Math.abs(value);
|
|
|
|
|