|
|
/**
|
|
|
* balance list on partner client
|
|
|
* Created by yishuqian on 9/9/16.
|
|
|
*/
|
|
|
define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
|
|
|
'use strict';
|
|
|
var app = angular.module('settlementLogs', ['ui.bootstrap', 'ui.router']);
|
|
|
app.config(['$stateProvider', function ($stateProvider) {
|
|
|
$stateProvider.state('settlementlogs', {
|
|
|
url: '/settlementlogs',
|
|
|
templateUrl: '/static/payment/tradelog/templates/partner_settlement_logs.html',
|
|
|
controller: 'partnerSettlementLogCtrl'
|
|
|
})
|
|
|
}]);
|
|
|
app.controller('partnerSettlementLogCtrl', ['$scope', 'clearingDetailService', '$http', '$filter', '$sce', function ($scope, clearingDetailService, $http, $filter, $sce) {
|
|
|
$scope.params = {};
|
|
|
$scope.pagination = {};
|
|
|
$scope.htmlTooltip = $sce.trustAsHtml('<div style="text-align: left;width:350px">' +
|
|
|
'<div style="padding-top: 10px">RoyalPal小贴士:</div>' +
|
|
|
'<p style="padding-bottom:10px;border-bottom:1px solid #ffffff">尊敬的RoyalPay商户,鉴于澳洲是个多时区国家,为了统一标准并且保障清算的安全高效,我们在清算过程中采用了GMT+10的时区标准而不采用夏令时时区,前后可能有一个小时的时差,请商户对账时注意</p>' +
|
|
|
'<div>RoyalPay Tip:</div>' +
|
|
|
'<p>Dear RoyalPay merchants, in view of the fact that Australia is a multi-time zone country, in order to unify standards and ensure the safety and efficiency of settlement, we have adopted the GMT+10 time zone standard in the settlement process </p>' +
|
|
|
'</div>');
|
|
|
$scope.isAll = true;
|
|
|
$scope.clients = [$scope.currentUser.client];
|
|
|
if ($scope.currentUser.client.has_children) {
|
|
|
$scope.params.client_ids = [$scope.currentUser.client.client_id];
|
|
|
$http.get('/client/partner_info/sub_partners').then(function (resp) {
|
|
|
var clientList = resp.data;
|
|
|
clientList.forEach(function (client) {
|
|
|
$scope.clients.push(client);
|
|
|
});
|
|
|
$scope.clientIds = [];
|
|
|
$scope.clients.forEach(function (client) {
|
|
|
$scope.clientIds.push(client.client_id);
|
|
|
});
|
|
|
$scope.params.client_ids = angular.copy($scope.clientIds);
|
|
|
$scope.loadSettlementLogs(1);
|
|
|
})
|
|
|
}
|
|
|
|
|
|
$scope.today = new Date();
|
|
|
$scope.chooseToday = function () {
|
|
|
$scope.params.datefrom = $scope.params.dateto = new Date();
|
|
|
$scope.loadSettlementLogs(1);
|
|
|
};
|
|
|
$scope.chooseYesterday = function () {
|
|
|
var yesterday = new Date();
|
|
|
yesterday.setDate(yesterday.getDate() - 1);
|
|
|
$scope.params.datefrom = $scope.params.dateto = yesterday;
|
|
|
$scope.loadSettlementLogs(1);
|
|
|
};
|
|
|
$scope.chooseLast7Days = function () {
|
|
|
$scope.params.dateto = new Date();
|
|
|
var day = new Date();
|
|
|
day.setDate(day.getDate() - 7);
|
|
|
$scope.params.datefrom = day;
|
|
|
$scope.loadSettlementLogs(1);
|
|
|
};
|
|
|
$scope.thisMonth = function () {
|
|
|
$scope.params.dateto = new Date();
|
|
|
var monthBegin = new Date();
|
|
|
monthBegin.setDate(1);
|
|
|
$scope.params.datefrom = monthBegin;
|
|
|
$scope.loadSettlementLogs(1);
|
|
|
};
|
|
|
$scope.lastMonth = function () {
|
|
|
var monthFinish = new Date();
|
|
|
monthFinish.setDate(0);
|
|
|
$scope.params.dateto = monthFinish;
|
|
|
var monthBegin = new Date();
|
|
|
monthBegin.setDate(0);
|
|
|
monthBegin.setDate(1);
|
|
|
$scope.params.datefrom = monthBegin;
|
|
|
$scope.loadSettlementLogs(1);
|
|
|
};
|
|
|
$scope.loadSettlementLogs = function (page) {
|
|
|
var params = angular.copy($scope.params);
|
|
|
if (params.datefrom) {
|
|
|
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
|
|
|
}
|
|
|
if (params.dateto) {
|
|
|
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
|
|
|
}
|
|
|
params.page = page || $scope.pagination.page || 1;
|
|
|
$http.get('/client/trans_flow/settlement/log', {params: params}).then(function (resp) {
|
|
|
$scope.settlementLogs = resp.data.data;
|
|
|
$scope.pagination = resp.data.pagination;
|
|
|
$scope.padding = resp.data.padding;
|
|
|
$scope.analysis = resp.data.analysis;
|
|
|
});
|
|
|
};
|
|
|
$scope.loadSettlementLogs(1);
|
|
|
|
|
|
$scope.exportSettlementLogs = function(pattern) {
|
|
|
var params = angular.copy($scope.params);
|
|
|
var url = '/client/trans_flow/settlement/log/excel';
|
|
|
if (pattern === 'pdf') {
|
|
|
url = '/client/trans_flow/settlement/log/pdf';
|
|
|
}
|
|
|
var connectSymbol = '?';
|
|
|
if (params.datefrom) {
|
|
|
params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd');
|
|
|
url += connectSymbol + 'datefrom=' + params.datefrom;
|
|
|
connectSymbol = '&';
|
|
|
}
|
|
|
if (params.dateto) {
|
|
|
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
|
|
|
url += connectSymbol + 'dateto=' + params.dateto;
|
|
|
}
|
|
|
|
|
|
return url;
|
|
|
};
|
|
|
var getClientUnClearedAmount = function () {
|
|
|
$http.get('/client/trans_flow/settlement/unclear').then(function (resp) {
|
|
|
$scope.unclear = resp.data;
|
|
|
});
|
|
|
};
|
|
|
getClientUnClearedAmount();
|
|
|
|
|
|
$scope.chooseClient = function (clientId) {
|
|
|
if (clientId == 'all') {
|
|
|
$scope.params.client_ids = angular.copy($scope.clientIds);
|
|
|
$scope.isAll = true;
|
|
|
$scope.chooseClientId = '';
|
|
|
} else {
|
|
|
$scope.chooseClientId = clientId;
|
|
|
$scope.params.client_ids = [clientId];
|
|
|
$scope.isAll = false;
|
|
|
}
|
|
|
$scope.loadSettlementLogs();
|
|
|
};
|
|
|
|
|
|
$scope.getClearingTransactions = function (client_id, detailId) {
|
|
|
clearingDetailService.clientClearingDetail(client_id, detailId, true)
|
|
|
}
|
|
|
}]);
|
|
|
return app;
|
|
|
}); |