From 61152808b49a16b2b668f3f37de8254fccb7e00a Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Wed, 21 Mar 2018 21:21:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E6=88=B7=E7=AB=AF=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=8F=90=E7=8E=B0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/static/dashboard/partner-dashboard.js | 85 ++++++++++++++++++- .../templates/partner_dashboard.html | 4 +- .../partner_dashboard_unsettled_dialog.html | 70 +++++++++++++++ 3 files changed, 155 insertions(+), 4 deletions(-) create mode 100644 src/main/ui/static/dashboard/templates/partner_dashboard_unsettled_dialog.html 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}}
+
+
+ 提现 +
+
+
+
+ +
+