diff --git a/src/main/java/au/com/royalpay/payment/manage/settlement/core/impls/ManualSettleSupportImpl.java b/src/main/java/au/com/royalpay/payment/manage/settlement/core/impls/ManualSettleSupportImpl.java index 0971f1a31..3d34494e0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/settlement/core/impls/ManualSettleSupportImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/settlement/core/impls/ManualSettleSupportImpl.java @@ -84,6 +84,7 @@ public class ManualSettleSupportImpl implements ManualSettleSupport { report.put("clearing_amount", CurrencyAmountUtils.scalePlatformCurrency(report.getBigDecimal("clearing_amount"))); BigDecimal settleAmount = report.getBigDecimal("settle_amount"); report.put("settle_amount", CurrencyAmountUtils.scalePlatformCurrency(settleAmount == null ? BigDecimal.ZERO : settleAmount)); + report.put("settle_amount2", report.getBigDecimal("settle_amount").toString()); report.put("date_str", DateFormatUtils.format(report.getDate("trans_date"), "yyyy-MM-dd")); }); todayTask.put("unsettle", unsettleReports); diff --git a/src/main/ui/static/dashboard/partner-dashboard.js b/src/main/ui/static/dashboard/partner-dashboard.js index 5fce76b75..0211f9b9c 100644 --- a/src/main/ui/static/dashboard/partner-dashboard.js +++ b/src/main/ui/static/dashboard/partner-dashboard.js @@ -1,7 +1,7 @@ /** * Create by yishuqian on 2016-09-19 */ -define(['angular', 'uiRouter', 'uiBootstrap', 'angularEcharts'], function (angular) { +define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], function (angular,decimal) { 'use strict'; var colors = ['#00c0ef', '#00a65a', '#ff851b', '#f39c12', '#d81b60', '#605ca8', '#dd4b39', '#008080', '#8B008B', '#D2691E', '#708090']; var app = angular.module('partner_dashboard', ['ui.router', 'ui.bootstrap', 'ngEcharts']); @@ -30,7 +30,6 @@ define(['angular', 'uiRouter', 'uiBootstrap', 'angularEcharts'], function (angul $scope.switchScale($scope.scales[0]); }) } - $scope.chooseClient = function (sub) { $scope.params.client_ids = []; if (sub == 'All') { @@ -376,6 +375,19 @@ define(['angular', 'uiRouter', 'uiBootstrap', 'angularEcharts'], function (angul var client_params = angular.copy($scope.params); loadFeeAnalysis(angular.merge(client_params, $scope.scales[2].params())) + + $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' + }) + }; }]); app.controller('exchangeRateHistoryDialogCtrl', ['$scope', '$http', '$filter', 'chartParser', function ($scope, $http, $filter, chartParser) { $scope.loadExchangeRateHistory = function (days) { @@ -487,6 +499,73 @@ define(['angular', 'uiRouter', 'uiBootstrap', 'angularEcharts'], function (angul $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: '提现成功', type: 'success'}); + $scope.$close(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + } + }]); return app; }); \ No newline at end of file diff --git a/src/main/ui/static/dashboard/templates/partner_dashboard.html b/src/main/ui/static/dashboard/templates/partner_dashboard.html index 5b57dcdb0..1ee15af8a 100644 --- a/src/main/ui/static/dashboard/templates/partner_dashboard.html +++ b/src/main/ui/static/dashboard/templates/partner_dashboard.html @@ -79,7 +79,9 @@ - + + + diff --git a/src/main/ui/static/dashboard/templates/partner_dashboard_unsettled_dialog.html b/src/main/ui/static/dashboard/templates/partner_dashboard_unsettled_dialog.html new file mode 100644 index 000000000..5d54e599c --- /dev/null +++ b/src/main/ui/static/dashboard/templates/partner_dashboard_unsettled_dialog.html @@ -0,0 +1,70 @@ + +
+
+
+
+
+
+
+ +
+
+
+ + +
+
+
+
+
+ +
+
+ {{settleParams.desc}} +
+
+
+
Manual Settle
+
+ + + + + + + + + + + + + + + + + + + + +
DateSettle Amount
{{cashback.date_str}}{{cashback.settle_amount}}
total{{settleParams.total_settle_amount}}
+
+
+ 提现 +
+
+
+
+ +
+