Merge remote-tracking branch 'origin/develop' into develop

master
eason.qian 7 years ago
commit d5097ff363

@ -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;
});

@ -79,7 +79,9 @@
<span class="info-box-number"><label ng-bind="analysis.not_settled|currency:'AUD '"></label>
<!--<a role="button" ui-sref="settlementlogs"><label style="font-size: smaller;color: green">-->
<!--<i class="fa fa-info" aria-hidden="true" tooltip-placement="left-bottom" uib-tooltip="Click it,show settlement logs"></i></label></a>-->
<label ng-if="analysis.pre_amount != 0" style="font-size: smaller;color: grey">(preauthorised {{analysis.pre_amount}})</label>
<a role="button" ng-click="toShowUnSettledDialog()" ng-if="manual_settle&&([1]|withRole)">
<i class="fa fa-info-circle" uib-tooltip="我要提现" aria-hidden="true"></i></a>
<label ng-if="analysis.pre_amount != 0" style="font-size: smaller;color: grey">(preauthorised {{analysis.pre_amount}})</label>
</span>
</div>
</div>

@ -0,0 +1,70 @@
<style>
table tr td{
text-align: center;
}
table th{
text-align: center;
}
</style>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<div class="box-header">
<div class="form-inline">
<div class="form-group">
<div class="checkbox">
<label>
<input type="checkbox" ng-click="changeIsAll()" ng-model="params.isAll">ALL
</label>
</div>
</div>
<div class="form-group pull-right">
<label class="control-label">TO Date</label>
<input class="form-control" placeholder="To Date" ng-model="params.to_date"
uib-datepicker-popup size="10" is-open="ctrl.dateInput" ng-click="ctrl.dateInput=true"
datepicker-options="{minDate:params.minDate,maxDate:params.maxData}">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="box-header">
<div class="form-group pull-right">
<b>{{settleParams.desc}}</b>
</div>
</div>
<div class="box box-default">
<div class="box-header">Manual Settle</div>
<div class="box-body table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th style="width: 20%;"></th>
<th>Date</th>
<th>Settle Amount</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="cashback in settleParams.unsettle">
<td><i class="fa fa-check-circle-o" aria-hidden="true" style="color: green;"></i></td>
<td>{{cashback.date_str}}</td>
<td>{{cashback.settle_amount}}</td>
</tr>
<tr>
<td></td>
<td><b>total</b></td>
<td><b>{{settleParams.total_settle_amount}}</b></td>
</tr>
</tbody>
</table>
<div class="col-xs-12">
<div style="text-align: center">
<a ng-class="{'disabled':settleParams.locked}"; role="button" style="margin-bottom: 25px;" class="btn btn-success btn-sm ng-scope" ng-click="manualSettle()">提现</a>
</div>
</div>
</div>
</div>
<!-- <div ng-if="currentSettle.unsettle.length==0">暂无数据</div>-->
</section>

@ -1,5 +1,5 @@
<div class="row">
<div class="form-group">
<div class="form-group" ng-if="([1]|withRole)">
<label class="col-sm-4">Manual Settle</label>
<div class="col-sm-6">
<input type="checkbox" ng-model="partner.manual_settle" bs-switch

Loading…
Cancel
Save