|
|
@@ -29,8 +29,14 @@ define(['app/app'], function(app) {
|
|
|
|
|
|
$scope.$$record = {};
|
|
|
|
|
|
+ $scope.AllOrderInfo = {};
|
|
|
+
|
|
|
+ $scope.param = {};
|
|
|
+
|
|
|
$scope.currency = 'ALL';
|
|
|
|
|
|
+ $scope.paytype = 'ALL';
|
|
|
+
|
|
|
/**
|
|
|
* 使用ngTable 获取支付记录信息
|
|
|
*/
|
|
|
@@ -44,9 +50,27 @@ define(['app/app'], function(app) {
|
|
|
total : 0,
|
|
|
getData : function ($defer, params) {
|
|
|
const param = BaseService.parseParams(params.url());
|
|
|
+ if ($scope.keyword && $scope.keyword.length > 0){
|
|
|
+ param.keyword = $scope.keyword;
|
|
|
+ }
|
|
|
+ if ($scope.currency && $scope.currency != 'ALL'){
|
|
|
+ param.currencyName = $scope.currency;
|
|
|
+ }
|
|
|
+ if ($scope.paytype && $scope.paytype != 'ALL'){
|
|
|
+ param.method = $scope.paytype;
|
|
|
+ }
|
|
|
+ if ($scope.startDate){
|
|
|
+ param.fromDate = $scope.startDate.getTime();
|
|
|
+ }
|
|
|
+ if ($scope.endDate){
|
|
|
+ param.toDate = $scope.endDate.getTime();
|
|
|
+ }
|
|
|
//目前直接从订单中获取信息 --支付记录
|
|
|
OrderSimpleInfo.getBuyPayRecord(param, function (page) {
|
|
|
$scope.tradeRecordPage = page.content;
|
|
|
+ $scope.AllOrderInfo.totalPages = page.totalPages;
|
|
|
+ $scope.param.page = page.number;
|
|
|
+
|
|
|
|
|
|
$scope.$$record.totalElements = page.totalElements;
|
|
|
if(Number(page.totalElements) > 0) {
|
|
|
@@ -55,21 +79,79 @@ define(['app/app'], function(app) {
|
|
|
$scope.$$record.start = 0;
|
|
|
}
|
|
|
$scope.$$record.end = Number(page.size) * (Number(page.number) - 1) + Number(page.numberOfElements);
|
|
|
+ $scope.acculatePages(page.number, $scope.AllOrderInfo.totalPages);
|
|
|
+ }, function (response) {
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $scope.$$bankInfo = {};
|
|
|
+ $scope.bankInfoTableParams = new ngTableParams({
|
|
|
+ page : 1,
|
|
|
+ count : 10,
|
|
|
+ sorting : {
|
|
|
+ num : 'ASC'
|
|
|
+ }
|
|
|
+ },{
|
|
|
+ total : 0,
|
|
|
+ getData : function ($defer, params) {
|
|
|
+ var param = BaseService.parseParams(params.url());
|
|
|
+ bankInfoService.getBuyPersonalBank(param, {}, function(page) {
|
|
|
+ $scope.accounts = page.content;
|
|
|
+
|
|
|
+ $scope.$$bankInfo.totalElements = page.totalElements;
|
|
|
+ if(Number(page.totalElements) > 0) {
|
|
|
+ $scope.$$bankInfo.start = Number(page.size) * (Number(page.number) - 1) + 1;
|
|
|
+ }else {
|
|
|
+ $scope.$$bankInfo.start = 0;
|
|
|
+ }
|
|
|
+ $scope.$$bankInfo.end = Number(page.size) * (Number(page.number) - 1) + Number(page.numberOfElements);
|
|
|
|
|
|
params.total(page.totalElements);
|
|
|
$defer.resolve(page.content);
|
|
|
- }, function (response) {
|
|
|
-
|
|
|
+ }, function() {
|
|
|
+ toaster.pop('error', '获取账户信息失败');
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ $scope.condition = {
|
|
|
+ startDateOpen: false,
|
|
|
+ endDateOpen: false
|
|
|
+ };
|
|
|
+
|
|
|
+ // 打开日期选择框
|
|
|
+ $scope.openDatePicker = function($event, item, openParam, status) {
|
|
|
+ if (status != null) {
|
|
|
+ if (status == 1) {
|
|
|
+ if ($scope.startDate != null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (status == 2) {
|
|
|
+ if ($scope.endDate != null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $event.preventDefault();
|
|
|
+ $event.stopPropagation();
|
|
|
+ item[openParam] = !item[openParam];
|
|
|
+ };
|
|
|
+
|
|
|
var loadAccountData = function() {
|
|
|
- bankInfoService[$scope.getAccountData].call(null,{}, function(data) {
|
|
|
- $scope.accounts = data.content;
|
|
|
- }, function(response) {
|
|
|
- toaster.pop('error', '获取账户信息失败');
|
|
|
- });
|
|
|
+ $scope.bankInfoTableParams.page(1);
|
|
|
+ $scope.bankInfoTableParams.reload();
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.filterLoad = function () {
|
|
|
+ loadPayHistory();
|
|
|
+ };
|
|
|
+
|
|
|
+ var loadPayHistory = function () {
|
|
|
+ $scope.tradeRecordTableParams.page(1);
|
|
|
+ $scope.tradeRecordTableParams.reload();
|
|
|
};
|
|
|
|
|
|
$scope.setDefaultAccount = function(id) {
|
|
|
@@ -81,14 +163,25 @@ define(['app/app'], function(app) {
|
|
|
})
|
|
|
};
|
|
|
|
|
|
+ $scope.showDeleteFrame = function (item) {
|
|
|
+ $scope.showDelete = true;
|
|
|
+ $scope.deleteObject = item;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.cancelDelete = function () {
|
|
|
+ $scope.showDelete = false;
|
|
|
+ $scope.deleteObject = null;
|
|
|
+ };
|
|
|
//删除账户
|
|
|
- $scope.deleteAccount = function(buyAccount) {
|
|
|
- var isSure = confirm('确认删除本银行账户?删除后无法恢复,请谨慎操作');
|
|
|
- if(isSure){
|
|
|
- bankInfoService.deleteBank({id: buyAccount.id}, function(data) {
|
|
|
- toaster.pop('success', '删除成功');
|
|
|
- loadAccountData();
|
|
|
- }, function(response) {
|
|
|
+ $scope.deleteAccount = function() {
|
|
|
+ if ($scope.deleteObject){
|
|
|
+ bankInfoService.deleteBank({id: $scope.deleteObject.id}, function(data) {
|
|
|
+ if (data){
|
|
|
+ toaster.pop('success', '删除成功');
|
|
|
+ $scope.showDelete = false;
|
|
|
+ loadAccountData();
|
|
|
+ }
|
|
|
+ }, function() {
|
|
|
toaster.pop('error', '删除失败');
|
|
|
})
|
|
|
}
|
|
|
@@ -128,17 +221,19 @@ define(['app/app'], function(app) {
|
|
|
var loadData = function() {
|
|
|
switch ($scope.status) {
|
|
|
case 'pay-info' :
|
|
|
- $scope.getAccountData = 'getBuyPersonalBank';
|
|
|
loadAccountData();
|
|
|
break;
|
|
|
case 'pay-history':
|
|
|
- $scope.tradeRecordTableParams.page(1);
|
|
|
- $scope.tradeRecordTableParams.reload();
|
|
|
+ loadPayHistory();
|
|
|
break;
|
|
|
}
|
|
|
};
|
|
|
loadData();
|
|
|
|
|
|
+ $scope.search = function () {
|
|
|
+ loadPayHistory();
|
|
|
+ };
|
|
|
+
|
|
|
$scope.exportToExcel = function () {
|
|
|
if ($scope.$$record.totalElements == 0) {
|
|
|
toaster.pop('info', '当前支付记录为空,无法导出');
|
|
|
@@ -147,17 +242,45 @@ define(['app/app'], function(app) {
|
|
|
exportByAjax();
|
|
|
};
|
|
|
|
|
|
+ if ($scope.keyword && $scope.keyword.length > 0){
|
|
|
+ param.keyword = $scope.keyword;
|
|
|
+ }
|
|
|
+ if ($scope.currency && $scope.currency != 'ALL'){
|
|
|
+ param.currencyName = $scope.currency;
|
|
|
+ }
|
|
|
+ if ($scope.paytype && $scope.paytype != 'ALL'){
|
|
|
+ param.method = $scope.paytype;
|
|
|
+ }
|
|
|
+ if ($scope.startDate){
|
|
|
+ param.fromDate = $scope.startDate.getTime();
|
|
|
+ }
|
|
|
+ if ($scope.endDate){
|
|
|
+ param.toDate = $scope.endDate.getTime();
|
|
|
+ }
|
|
|
+
|
|
|
var exportByAjax = function () {
|
|
|
- var url = 'product/brandMap/export';
|
|
|
+ var url = 'trade/order/export/payRecord';
|
|
|
var strArray = [];
|
|
|
if ($scope.keyword && $scope.keyword.length > 0){
|
|
|
var wordStr = "keyword=" + $scope.keyword;
|
|
|
strArray.push(wordStr);
|
|
|
}
|
|
|
- if ($scope.storeType && $scope.storeType != 'ALL'){
|
|
|
- var typeStr = "storeType=" + $scope.storeType;
|
|
|
+ if ($scope.currency && $scope.currency != 'ALL'){
|
|
|
+ var currencyStr = "currencyName=" + $scope.currency;
|
|
|
+ strArray.push(currencyStr);
|
|
|
+ }
|
|
|
+ if ($scope.paytype && $scope.paytype != 'ALL'){
|
|
|
+ var typeStr = "method=" + $scope.paytype;
|
|
|
strArray.push(typeStr);
|
|
|
}
|
|
|
+ if ($scope.startDate){
|
|
|
+ var startStr = "fromDate=" + $scope.startDate.getTime();
|
|
|
+ strArray.push(startStr);
|
|
|
+ }
|
|
|
+ if ($scope.endDate){
|
|
|
+ var endStr = "toDate=" + $scope.endDate.getTime();
|
|
|
+ strArray.push(endStr);
|
|
|
+ }
|
|
|
if (strArray.length != 0){
|
|
|
var str = strArray.join("&");
|
|
|
url = url + "?" + str;
|
|
|
@@ -179,7 +302,7 @@ define(['app/app'], function(app) {
|
|
|
var getDownLoadStatus = function () {
|
|
|
Loading.show();
|
|
|
$.ajax({
|
|
|
- url : 'product/brandMap/export',
|
|
|
+ url : 'trade/order/export/payRecord',
|
|
|
data : {isAjax : true},
|
|
|
method : 'POST',
|
|
|
dataType : 'json',
|
|
|
@@ -189,20 +312,22 @@ define(['app/app'], function(app) {
|
|
|
toaster.pop('info', '数据处理完毕,正在下载文件,请稍等。');
|
|
|
Loading.hide();
|
|
|
});
|
|
|
- if($scope.$$map.clockID) {
|
|
|
- clearInterval($scope.$$map.clockID);
|
|
|
+ if($scope.$$record.clockID) {
|
|
|
+ clearInterval($scope.$$record.clockID);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
error : function () {
|
|
|
Loading.hide();
|
|
|
- if($scope.$$map.clockID) {
|
|
|
- clearInterval($scope.$$map.clockID);
|
|
|
+ if($scope.$$record.clockID) {
|
|
|
+ clearInterval($scope.$$record.clockID);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ /******************根据页数设置翻页的信息********start**************************/
|
|
|
+
|
|
|
//输入框监听Enter事件
|
|
|
$scope.listenEnter = function () {
|
|
|
if(event.keyCode == 13) {
|
|
|
@@ -210,6 +335,176 @@ define(['app/app'], function(app) {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ $scope.setPage = function(type, number) {
|
|
|
+ if(type != 'prev' && type != 'page' && type != 'next' && type != 'last' && type != 'first') {
|
|
|
+ return ;
|
|
|
+ };
|
|
|
+ var page = -1;
|
|
|
+ switch (type) {
|
|
|
+ case "page":
|
|
|
+ if(number < 1) {
|
|
|
+ page = 1;
|
|
|
+ }else if(number > $scope.AllOrderInfo.totalPages) {
|
|
|
+ page = $scope.AllOrderInfo.totalPages;
|
|
|
+ }else {
|
|
|
+ page = number;
|
|
|
+ };
|
|
|
+ break;
|
|
|
+ case "prev":
|
|
|
+ if($scope.param.page <= 1) {
|
|
|
+ page = 1;
|
|
|
+ }else {
|
|
|
+ page =$scope.param.page - 1;
|
|
|
+ };
|
|
|
+ break;
|
|
|
+ case "next":
|
|
|
+ if($scope.param.page >= $scope.AllOrderInfo.totalPages) {
|
|
|
+ page = $scope.AllOrderInfo.totalPages
|
|
|
+ }else {
|
|
|
+ page =$scope.param.page + 1;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "first":
|
|
|
+ page = 1;
|
|
|
+ break;
|
|
|
+ case "last":
|
|
|
+ page = $scope.AllOrderInfo.totalPages;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if(page == $scope.param.page || page < 1 || page > $scope.AllOrderInfo.totalPages) {
|
|
|
+ $scope.param.currentPage = $scope.param.page;
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ $scope.param.page = page;
|
|
|
+ $scope.tradeRecordTableParams.page($scope.param.page);
|
|
|
+ $scope.tradeRecordTableParams.reload();
|
|
|
+ };
|
|
|
+
|
|
|
+ //当前页在前段的计算方式
|
|
|
+ $scope.frontSegment = function (currentPage, totalElementPages) {
|
|
|
+ angular.forEach($scope.pages, function (page) {
|
|
|
+ switch (page.number) {
|
|
|
+ case 8:
|
|
|
+ page.type = 'more';
|
|
|
+ page.active = false;
|
|
|
+ break;
|
|
|
+ case 0:
|
|
|
+ if(currentPage == 1) {
|
|
|
+ page.active = false;
|
|
|
+ }
|
|
|
+ default : {
|
|
|
+ page.current = (currentPage == page.number);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ //当前页在后端计算方式
|
|
|
+ $scope.endSegment = function (currentPage, totalElementPages) {
|
|
|
+ angular.forEach($scope.pages, function (page) {
|
|
|
+ switch (page.number) {
|
|
|
+ case 2:
|
|
|
+ page.active = false;
|
|
|
+ page.type = 'more';
|
|
|
+ break;
|
|
|
+ case 10:
|
|
|
+ if(currentPage == totalElementPages) {
|
|
|
+ page.active = false;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 0:
|
|
|
+ case 1:
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ if(page.number != totalElementPages) {
|
|
|
+ page.number = totalElementPages - 9 + page.number;
|
|
|
+ }
|
|
|
+ page.current = (currentPage == page.number);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ //当前页在中间计算方式
|
|
|
+ $scope.middleSegment = function (currentPage) {
|
|
|
+ angular.forEach($scope.pages, function (page) {
|
|
|
+ switch (page.number) {
|
|
|
+ case 2:
|
|
|
+ case 8:
|
|
|
+ page.type ='more';
|
|
|
+ page.active = false;
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ page.number = currentPage - 2;
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ page.number = currentPage - 1;
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ page.number = currentPage;
|
|
|
+ page.current = true;
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ page.number = currentPage + 1;
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ page.number = currentPage + 2;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //初始化页数信息
|
|
|
+ $scope.initPages = function (totalElementPages) {
|
|
|
+ var pageNum = [];
|
|
|
+ if(totalElementPages == 1) {
|
|
|
+ return ;
|
|
|
+ }else if(totalElementPages < 10) {
|
|
|
+ for(var i = 0; i < totalElementPages + 2; i++) {
|
|
|
+ pageNum.push(i);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ pageNum = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
|
+ }
|
|
|
+ angular.forEach(pageNum, function (number) {
|
|
|
+ var page = {active : true, type : 'page', number : number};
|
|
|
+ if(number == 0) {
|
|
|
+ page.type = 'prev';
|
|
|
+ }else if(number == 1) {
|
|
|
+ page.type = 'first';
|
|
|
+ }else if(number == pageNum.length - 2) {
|
|
|
+ page.type = 'last';
|
|
|
+ page.number = totalElementPages;
|
|
|
+ }else if(number == pageNum.length - 1){
|
|
|
+ page.type = 'next';
|
|
|
+ }
|
|
|
+ $scope.pages.push(page);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //计算页数的方式。
|
|
|
+ $scope.acculatePages = function(currentPage, totalElementPages) {
|
|
|
+ $scope.pages = [];
|
|
|
+ if(totalElementPages < 1) {
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ //初始化页面数据
|
|
|
+ $scope.initPages(totalElementPages);
|
|
|
+ if(totalElementPages < 10) {
|
|
|
+ angular.forEach($scope.pages, function (page) {
|
|
|
+ if(page.number == currentPage) {
|
|
|
+ page.current = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else if(currentPage < 6) {//当期页小于6
|
|
|
+ $scope.frontSegment(currentPage, totalElementPages);
|
|
|
+ }else if(currentPage > totalElementPages - 5) { //当期页在后面
|
|
|
+ $scope.endSegment(currentPage, totalElementPages);
|
|
|
+ }else { //当期页在中间
|
|
|
+ $scope.middleSegment(currentPage);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
}]);
|
|
|
|
|
|
|
|
|
@@ -222,9 +517,25 @@ define(['app/app'], function(app) {
|
|
|
*/
|
|
|
$scope.bankList = [
|
|
|
'中国银行','中国建设银行','中国工商银行','中国农业银行','交通银行','招商银行','中国民生银行',
|
|
|
- '兴业银行','中信银行','中国光大银行','广发银行','平安银行','中国邮政储蓄银行','华夏银行','中信银行','浦发银行'
|
|
|
+ '兴业银行','中信银行','中国光大银行','广发银行','平安银行','中国邮政储蓄银行','华夏银行','浦发银行'
|
|
|
];
|
|
|
|
|
|
+ // $scope.bankBlur = function () {
|
|
|
+ // console.log(!$scope.account.bankname);
|
|
|
+ // if (!$scope.account.bankname){
|
|
|
+ // $scope.showBankFrame = true;
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+
|
|
|
+ $scope.inputBankName = function () {
|
|
|
+ $scope.showBankFrame = true;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.fitBankToAccount = function (item) {
|
|
|
+ $scope.account.bankname = item;
|
|
|
+ $scope.showBankFrame = false;
|
|
|
+ };
|
|
|
+
|
|
|
$scope.account = account;
|
|
|
if($scope.account) {
|
|
|
$scope.title = "修改账户";
|
|
|
@@ -233,6 +544,20 @@ define(['app/app'], function(app) {
|
|
|
$scope.account = {};
|
|
|
}
|
|
|
|
|
|
+ var matchArray = function () {
|
|
|
+ $scope.account.bankname = $scope.account.bankname ? $scope.account.bankname : '';
|
|
|
+ $scope.resultList = $scope.bankList.filter(function (data) {
|
|
|
+ if (data.indexOf($scope.account.bankname) >= 0){
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if ($scope.resultList.length > 0){
|
|
|
+ $scope.matchData = true;
|
|
|
+ }else{
|
|
|
+ $scope.matchData = false;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
/**
|
|
|
* 验证新增账户格式
|
|
|
* @param num
|
|
|
@@ -241,9 +566,11 @@ define(['app/app'], function(app) {
|
|
|
var size;
|
|
|
if (num == 1){
|
|
|
//验证开户银行名称
|
|
|
+ $scope.showBankFrame = true;
|
|
|
+ matchArray();
|
|
|
}else if(num == 2){
|
|
|
//验证开户支行名称
|
|
|
- if(!$scope.account.branchname){
|
|
|
+ if($scope.account.branchname){
|
|
|
size = $scope.account.branchname.replace(/[^\x00-\xff]/g,'**').length;
|
|
|
if (size > 40){
|
|
|
$scope.branchError = true;
|
|
|
@@ -259,7 +586,7 @@ define(['app/app'], function(app) {
|
|
|
}
|
|
|
}else if(num == 3){
|
|
|
//验证银行账号
|
|
|
- if (!$scope.account.number){
|
|
|
+ if ($scope.account.number){
|
|
|
size = $scope.account.number.replace(/[^\x00-\xff]/g,'**').length;
|
|
|
if (size > 30){
|
|
|
$scope.numberError = true;
|
|
|
@@ -275,7 +602,7 @@ define(['app/app'], function(app) {
|
|
|
}
|
|
|
}else if(num == 4){
|
|
|
//验证开户名称
|
|
|
- if (!$scope.account.accountname){
|
|
|
+ if ($scope.account.accountname){
|
|
|
size = $scope.account.accountname.replace(/[^\x00-\xff]/g,'**').length;
|
|
|
if (size > 100){
|
|
|
$scope.nameError = true;
|
|
|
@@ -287,8 +614,23 @@ define(['app/app'], function(app) {
|
|
|
};
|
|
|
|
|
|
$scope.confirm = function() {
|
|
|
- var method = 'saveBuyPersonalBank'; //不区分个人和企业账户
|
|
|
+ var account = $scope.account;
|
|
|
|
|
|
+ if (!account){
|
|
|
+ toaster.pop('error', '请按要求填写正确的信息');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if (!account.bankname || !account.branchname || !account.number || !account.accountname){
|
|
|
+ toaster.pop('error', '请按要求填写正确的信息');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if ($scope.branchError || $scope.branchPattError || $scope.numberError || $scope.numberPattError ||
|
|
|
+ $scope.nameError){
|
|
|
+ toaster.pop('error', '请按要求填写正确的信息');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+
|
|
|
+ var method = 'saveBuyPersonalBank'; //不区分个人和企业账户
|
|
|
bankInfoService[method].call(null, null, $scope.account, function(data) {
|
|
|
toaster.pop('success', '保存成功');
|
|
|
$modalInstance.close(data)
|