|
|
@@ -1,121 +1,441 @@
|
|
|
-/**
|
|
|
- * Created by admin on 2017/6/2.
|
|
|
- */
|
|
|
/**
|
|
|
* 结算中心控制器
|
|
|
*/
|
|
|
define(['app/app'], function(app) {
|
|
|
'use strict';
|
|
|
- app.register.controller('payCenterCtrl', ['$scope', '$rootScope', 'bankInfoService', 'toaster', '$upload', 'bankTransferService', 'Purchase', '$filter', function($scope, $rootScope, bankInfoService, toaster, $upload, bankTransferService, Purchase, $filter) {
|
|
|
+ app.register.controller('payCenterCtrl', ['$scope', '$rootScope', 'bankInfoService', 'Loading', 'toaster', '$upload', 'ngTableParams', 'BaseService', 'SessionService', 'bankTransferService', 'Purchase', '$filter', function($scope, $rootScope, bankInfoService, Loading, toaster, $upload, ngTableParams, BaseService, SessionService, bankTransferService, Purchase, $filter) {
|
|
|
$rootScope.active = 'pay_center';
|
|
|
|
|
|
- $scope.param = {};
|
|
|
- $scope.param.page = 1;
|
|
|
- $scope.param.count = 5;
|
|
|
- $scope.param.type='sup';
|
|
|
- $scope.param.sorting = {};
|
|
|
- $scope.param.sorting.tranferCreateTime = 'DESC';
|
|
|
-
|
|
|
// 加密订单的ID过滤器
|
|
|
var enIdFilter = $filter('EncryptionFilter');
|
|
|
|
|
|
- $scope.$payCenter = {};
|
|
|
- $scope.$payCenter.tab = "accountTab";
|
|
|
- //控制删除div显示
|
|
|
- $scope.$payCenter.deleteDiv = false;
|
|
|
- //删除id
|
|
|
- $scope.$payCenter.deleteID = null;
|
|
|
+ //历史记录的状态
|
|
|
+ var hiStatus= SessionService.getCookie('vendorCenter');
|
|
|
|
|
|
- $scope.$payCenter.newAccount = false;
|
|
|
+ $scope.$payCenter = {};
|
|
|
+ $scope.param = {};
|
|
|
|
|
|
- //获取数据的方法;
|
|
|
- $scope.getMethod = "getSaleEeterpriseBank";
|
|
|
+ $scope.tab = hiStatus == null ? 'paymentRecord' : hiStatus;
|
|
|
+ $scope.$$bankInfo = {};
|
|
|
|
|
|
- $scope.bankInfo = {};
|
|
|
+ $scope.paytype = 'ALL';
|
|
|
+ $scope.$$transfer = {};
|
|
|
|
|
|
- //获取订单数据
|
|
|
- var getData = function () {
|
|
|
- if($scope.$payCenter.tab === 'paymentRecode') {//获取支付记录
|
|
|
- bankTransferService.getVendorBankTransferByMall($scope.param, function (page) {
|
|
|
+ $scope.tradeRecordTableParams = new ngTableParams({
|
|
|
+ page : 1,
|
|
|
+ count : 30,
|
|
|
+ sorting : {
|
|
|
+ transferTime : 'DESC'
|
|
|
+ }
|
|
|
+ },{
|
|
|
+ total : 0,
|
|
|
+ getData : function ($defer, params) {
|
|
|
+ var param = BaseService.parseParams(params.url());
|
|
|
+ if ($scope.keyword && $scope.keyword.length > 0){
|
|
|
+ param.keyword = $scope.keyword;
|
|
|
+ }
|
|
|
+ if ($scope.startDate){
|
|
|
+ param.fromDate = $scope.startDate.getTime();
|
|
|
+ }
|
|
|
+ if ($scope.endDate){
|
|
|
+ param.toDate = $scope.endDate.getTime();
|
|
|
+ }
|
|
|
+ bankTransferService.getVendorBankTransferByMall(param, function (page) {
|
|
|
if(page.code == 1) {
|
|
|
- $scope.bankTransRecode = page.data.content;
|
|
|
+ $scope.bankTransRecore = page.data.data.content;
|
|
|
+ if ($scope.bankTransRecore.length > 0){
|
|
|
+ $scope.currencySymbol = $scope.bankTransRecore[0].currencyName;
|
|
|
+ }
|
|
|
+ var pageObject = page.data.data;
|
|
|
+ $scope.totalPrice = page.data.total;
|
|
|
angular.forEach($scope.bankTransRecode, function (bankT) {
|
|
|
bankT.jsonReceive = angular.fromJson(bankT.jsonReceive);
|
|
|
});
|
|
|
-
|
|
|
- $scope.totalPages = page.data.totalPages;
|
|
|
- $scope.param.currentPage = page.data.number;
|
|
|
+ $scope.totalPages = pageObject.totalPages;
|
|
|
+ $scope.param.currentPage = pageObject.number;
|
|
|
+ $scope.totalElements = pageObject.totalElements;
|
|
|
+
|
|
|
+ if(Number($scope.totalElements) > 0) {
|
|
|
+ $scope.$$transfer.start = Number(pageObject.size) * (Number(pageObject.number) - 1) + 1;
|
|
|
+ }else {
|
|
|
+ $scope.$$transfer.start = 0;
|
|
|
+ }
|
|
|
+ $scope.$$transfer.end = Number(pageObject.size) * (Number(pageObject.number) - 1) + Number(pageObject.numberOfElements);
|
|
|
//计算页数
|
|
|
- $scope.acculatePages(page.data.number, page.data.totalPages);
|
|
|
+ $scope.acculatePages(pageObject.number, pageObject.totalPages);
|
|
|
}else {
|
|
|
toaster.pop('info', '获取信息失败:' + page.message);
|
|
|
}
|
|
|
- }, function (response) {
|
|
|
+ }, function () {
|
|
|
toaster.pop('error', '获取信息失败');
|
|
|
});
|
|
|
- }else {//获取企业的账户信息
|
|
|
- bankInfoService[$scope.getMethod](null, function (data) {
|
|
|
- $scope.bankInfos = data;
|
|
|
- }, function (response) {
|
|
|
- toaster.pop('error', '获取卖家的账户信息失败');
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $scope.bankInfoTableParams = new ngTableParams({
|
|
|
+ page : 1,
|
|
|
+ count : 10,
|
|
|
+ sorting : {
|
|
|
+ num : 'ASC'
|
|
|
+ }
|
|
|
+ },{
|
|
|
+ total : 0,
|
|
|
+ getData : function ($defer, params) {
|
|
|
+ var param = BaseService.parseParams(params.url());
|
|
|
+ bankInfoService.getSaleEeterpriseBank(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() {
|
|
|
+ toaster.pop('error', '获取账户信息失败');
|
|
|
});
|
|
|
}
|
|
|
- }
|
|
|
- getData();
|
|
|
+ });
|
|
|
+
|
|
|
+ var loadAccountData = function() {
|
|
|
+ $scope.bankInfoTableParams.page(1);
|
|
|
+ $scope.bankInfoTableParams.reload();
|
|
|
+ };
|
|
|
+
|
|
|
+ var loadHistory = function () {
|
|
|
+ $scope.tradeRecordTableParams.page(1);
|
|
|
+ $scope.tradeRecordTableParams.reload();
|
|
|
+ };
|
|
|
+
|
|
|
+ var clearRecordParams = function () {
|
|
|
+ $scope.keyword = null;
|
|
|
+ $scope.startDate = null;
|
|
|
+ $scope.endDate = null;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.search = function () {
|
|
|
+ if (!$scope.startDate && $scope.endDate){
|
|
|
+ toaster.pop("info", "请输入起始日期");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if ($scope.startDate && !$scope.endDate){
|
|
|
+ toaster.pop("info", "请输入结束日期");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ loadHistory();
|
|
|
+ };
|
|
|
|
|
|
+ //获取数据的方法。
|
|
|
+ var loadData = function() {
|
|
|
+ switch ($scope.tab) {
|
|
|
+ case 'paymentRecord' :
|
|
|
+ loadHistory();
|
|
|
+ break;
|
|
|
+ case 'accountTab':
|
|
|
+ clearRecordParams();
|
|
|
+ // loadAccountData();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ loadData();
|
|
|
|
|
|
//切换tab方法
|
|
|
$scope.setTab = function (tab) {
|
|
|
- if($scope.$payCenter.tab !== tab) {
|
|
|
- $scope.bankInfos = null;
|
|
|
- $scope.$payCenter.tab = tab;
|
|
|
- if($scope.$payCenter.tab === 'accountTab') {
|
|
|
- // $scope.getMethod = "getSaleEeterpriseBankAudit";
|
|
|
- }else if($scope.$payCenter.tab === 'accountHis'){
|
|
|
- $scope.getMethod = "getSaleEeterpriseBank";
|
|
|
+ if($scope.tab !== tab) {
|
|
|
+ $scope.tab = tab;
|
|
|
+ SessionService.setCookie('vendorCenter', tab);
|
|
|
+ loadData();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.condition = [];
|
|
|
+ var start = {
|
|
|
+ open : false
|
|
|
+ };
|
|
|
+ var end = {
|
|
|
+ open : false
|
|
|
+ };
|
|
|
+ $scope.condition.push(start);
|
|
|
+ $scope.condition.push(end);
|
|
|
+
|
|
|
+ // 打开日期选择框
|
|
|
+ $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();
|
|
|
+ openParam == 0 ? $scope.condition[1].open = false : $scope.condition[0].open = false;
|
|
|
+ item[openParam].open = !item[openParam].open;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.onDateCondition = function (bool) {
|
|
|
+ // var text = '';
|
|
|
+ // var datePattern = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
|
+ if (bool == 1){
|
|
|
+ // text = document.getElementById("start").value;
|
|
|
+ // if (text != '' && !datePattern.test(text)){
|
|
|
+ // // $scope.startDate = text;
|
|
|
+ // toaster.pop("info", "请输入正确开始时间格式");
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // if (text != '' && !validateDate(text)){
|
|
|
+ // // $scope.startDate = text;
|
|
|
+ // toaster.pop("info", "请输入正确开始时间格式");
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // if (!$scope.startDate && text != ''){
|
|
|
+ // $scope.startDate = convertTextToDate(text);
|
|
|
+ // }
|
|
|
+ if ($scope.startDate && !$scope.endDate){
|
|
|
+ var nowTime = new Date();
|
|
|
+ $scope.endDate = new Date(nowTime.getFullYear(), nowTime.getMonth(), nowTime.getDate());
|
|
|
+ }
|
|
|
+ if ($scope.startDate && $scope.endDate){
|
|
|
+ if ($scope.startDate.getTime() > $scope.endDate.getTime()){
|
|
|
+ $scope.endDate = new Date($scope.startDate.getTime() + 86400000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ // text = document.getElementById("end").value;
|
|
|
+ // if (text != '' && !datePattern.test(text)){
|
|
|
+ // // $scope.endDate = text;
|
|
|
+ // toaster.pop("info", "请输入正确结束时间格式");
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // if (text != '' && !validateDate(text)){
|
|
|
+ // // $scope.endDate = text;
|
|
|
+ // toaster.pop("info", "请输入正确结束时间格式");
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // if (!$scope.endDate && text != ''){
|
|
|
+ // $scope.endDate = convertTextToDate(text);
|
|
|
+ // }
|
|
|
+ if ($scope.startDate && $scope.endDate){
|
|
|
+ if ($scope.startDate.getTime() > $scope.endDate.getTime()){
|
|
|
+ $scope.startDate = new Date($scope.endDate.getTime() - 86400000);
|
|
|
+ }
|
|
|
}
|
|
|
- getData();
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ /**
|
|
|
+ * 将文本转化为日期
|
|
|
+ * @param value
|
|
|
+ * @returns {Date}
|
|
|
+ */
|
|
|
+ var convertTextToDate = function (value) {
|
|
|
+ var date = value;
|
|
|
+ var result = date.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
|
|
|
+
|
|
|
+ return new Date(result[1], result[3] - 1, result[4]);
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 验证日期格式是否正确
|
|
|
+ * @param value
|
|
|
+ * @returns {boolean}
|
|
|
+ */
|
|
|
+ var validateDate = function (value) {
|
|
|
+ var date = value;
|
|
|
+ var result = date.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
|
|
|
+
|
|
|
+ if (result == null)
|
|
|
+ return false;
|
|
|
+ var d = new Date(result[1], result[3] - 1, result[4]);
|
|
|
+ return (d.getFullYear() == result[1] && (d.getMonth() + 1) == result[3] && d.getDate() == result[4]);
|
|
|
+ };
|
|
|
+
|
|
|
// 文件上传成功之后
|
|
|
- $scope.change = function(){
|
|
|
- var text = document.getElementById("upload_text");
|
|
|
- var dom = document.getElementById("InputFile");
|
|
|
- var fileName = dom.files[0].name;
|
|
|
- if (text.value != fileName) {
|
|
|
- text.value = '';
|
|
|
+ $scope.uploadChange = function(){
|
|
|
+ var fileName = $scope.account.files[0].name;
|
|
|
+ if ($scope.account.attachUrl != fileName) {
|
|
|
+ $scope.account.attachUrl = '';
|
|
|
}
|
|
|
var ext,idx;
|
|
|
idx = fileName.lastIndexOf(".");
|
|
|
if (idx != -1){
|
|
|
ext = fileName.substr(idx+1).toUpperCase();
|
|
|
ext = ext.toLowerCase( );
|
|
|
- // console.log(ext);
|
|
|
- // alert("ext="+ext);
|
|
|
if (ext != 'jpg' && ext != 'png' && ext != 'gif' && ext != 'pdf'){
|
|
|
- alert("请上传可支持的格式");
|
|
|
- return;
|
|
|
+ $scope.fileError = true;
|
|
|
+ }else {
|
|
|
+ $scope.fileError = false;
|
|
|
}
|
|
|
}
|
|
|
- // console.log(dom.files[0]);
|
|
|
- var len = dom.files[0].size;
|
|
|
+ var len = $scope.account.files[0].size;
|
|
|
if (len > 3145728) {
|
|
|
- // console.log(text.value.length);
|
|
|
- alert('请勿超过3M');
|
|
|
+ $scope.fileLegError = true;
|
|
|
+ }else {
|
|
|
+ $scope.fileLegError = false;
|
|
|
+ }
|
|
|
+ if($scope.fileError || $scope.fileLegError){
|
|
|
+ $scope.account.attachUrl = '';
|
|
|
+ $scope.account.files = null;
|
|
|
return;
|
|
|
}
|
|
|
- // console.log(len);
|
|
|
- text.value = fileName;
|
|
|
+ $scope.account.attachUrl = fileName;
|
|
|
toaster.pop('success', '上传成功');
|
|
|
};
|
|
|
|
|
|
+ $scope.account = {};
|
|
|
$scope.newAccount = function () {
|
|
|
- if($scope.bankInfos.length > 0) {
|
|
|
- toaster.pop('info', '目前仅支持邦定一个银行账户信息,如需修改或更换,可把原账户信息删除再重新添加.');
|
|
|
- }else {
|
|
|
- $scope.$payCenter.newAccount = true;
|
|
|
- }
|
|
|
+ $scope.showAddFrame = true;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.cancelAdd = function () {
|
|
|
+ $scope.showAddFrame = false;
|
|
|
+ $scope.account = {};
|
|
|
+ $scope.account.files = null;
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 验证账户格式
|
|
|
+ * @param num
|
|
|
+ */
|
|
|
+ $scope.checkAccount = function (num) {
|
|
|
+ var size;
|
|
|
+ if (num == 1){
|
|
|
+ //验证开户银行名称
|
|
|
+ $scope.showBankFrame = true;
|
|
|
+ matchArray();
|
|
|
+ }else if(num == 2){
|
|
|
+ //验证开户支行名称
|
|
|
+ if($scope.account.branchname){
|
|
|
+ size = $scope.account.branchname.replace(/[^\x00-\xff]/g,'**').length;
|
|
|
+ if (size > 40){
|
|
|
+ $scope.branchError = true;
|
|
|
+ }else {
|
|
|
+ $scope.branchError = false;
|
|
|
+ }
|
|
|
+ var telPatt = new RegExp("^[\u2E80-\u9FFF]+$");
|
|
|
+ if (telPatt.test($scope.account.branchname)){
|
|
|
+ $scope.branchPattError = false;
|
|
|
+ }else {
|
|
|
+ $scope.branchPattError = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if(num == 3){
|
|
|
+ //验证银行账号
|
|
|
+ if ($scope.account.number){
|
|
|
+ size = $scope.account.number.replace(/[^\x00-\xff]/g,'**').length;
|
|
|
+ if (size > 30){
|
|
|
+ $scope.numberError = true;
|
|
|
+ }else {
|
|
|
+ $scope.numberError = false;
|
|
|
+ }
|
|
|
+ var numPatt = new RegExp("^[0-9]+$");
|
|
|
+ if (numPatt.test($scope.account.number)){
|
|
|
+ $scope.numberPattError = false;
|
|
|
+ }else {
|
|
|
+ $scope.numberPattError = true;
|
|
|
+ }
|
|
|
+ validateRepeat($scope.account.number);
|
|
|
+ }
|
|
|
+ }else if(num == 4){
|
|
|
+ //验证开户名称
|
|
|
+ if ($scope.account.accountname){
|
|
|
+ size = $scope.account.accountname.replace(/[^\x00-\xff]/g,'**').length;
|
|
|
+ if (size > 100){
|
|
|
+ $scope.nameError = true;
|
|
|
+ }else {
|
|
|
+ $scope.nameError = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ var validateRepeat = function (number) {
|
|
|
+ bankInfoService.getCountByNumber({type:1063,number:number}, {}, function (data) {
|
|
|
+ if (data.success){
|
|
|
+ if (data.data != 0){
|
|
|
+ $scope.repeatError = true;
|
|
|
+ }else {
|
|
|
+ $scope.repeatError = false;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ toaster.pop("info", data.message);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.reuseAccount = function (item) {
|
|
|
+ $scope.showReuseFrame = true;
|
|
|
+ $scope.reuseObject = item;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.cancelReuse = function () {
|
|
|
+ $scope.showReuseFrame = false;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.ensureReuse = function () {
|
|
|
+ if(!$scope.reuseObject){
|
|
|
+ toaster.pop("info", "请选择重新使用的账户");
|
|
|
+ }
|
|
|
+ bankInfoService.setDefaultAccount({id:$scope.reuseObject.id},{},function (data) {
|
|
|
+ toaster.pop("info", "重新使用成功");
|
|
|
+ $scope.reuseObject = {};
|
|
|
+ $scope.showReuseFrame = false;
|
|
|
+ loadAccountData();
|
|
|
+ },function () {
|
|
|
+ toaster.pop("info", "重新使用失败");
|
|
|
+ })
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.ensureAddAccount = function () {
|
|
|
+ var account = $scope.account;
|
|
|
+
|
|
|
+ if (!account){
|
|
|
+ toaster.pop('error', '请按要求填写正确的信息');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if (!account.bankname || !account.branchname || !account.number ||
|
|
|
+ !account.accountname || !account.attachUrl){
|
|
|
+ toaster.pop('error', '请按要求填写正确的信息');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if (!$scope.matchData || $scope.branchError || $scope.branchPattError || $scope.numberError || $scope.numberPattError ||
|
|
|
+ $scope.nameError || $scope.repeatError || $scope.fileError || $scope.fileLegError){
|
|
|
+ toaster.pop('error', '请按要求填写正确的信息');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+
|
|
|
+ var file = null;
|
|
|
+ if($scope.account.files && $scope.account.files[0]) {
|
|
|
+ file = $scope.account.files[0];
|
|
|
+ }
|
|
|
+ $upload.upload({
|
|
|
+ url: 'trade/bankInfo/save/enterprise',
|
|
|
+ file: file,
|
|
|
+ method: 'POST',
|
|
|
+ params : {type : 'sup'},
|
|
|
+ data: {
|
|
|
+ bankInfo: $scope.account
|
|
|
+ }
|
|
|
+ }).success(function(data){
|
|
|
+ if(data){
|
|
|
+ $scope.showAddFrame = false;
|
|
|
+ $scope.account = {};
|
|
|
+ $scope.account.files = null;
|
|
|
+ toaster.pop('success', '保存成功');
|
|
|
+ loadAccountData();
|
|
|
+ }
|
|
|
+ }).error(function(){
|
|
|
+ toaster.pop('error', "保存账户信息失败");
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
//删除账户
|
|
|
@@ -126,15 +446,12 @@ define(['app/app'], function(app) {
|
|
|
}else {
|
|
|
toaster.pop('info', '请选择要删除的信息');
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
+ };
|
|
|
|
|
|
- //取消删除的操作
|
|
|
- $scope.cancleDelete = function () {
|
|
|
+ $scope.cancelDelete = function () {
|
|
|
$scope.$payCenter.deleteDiv = false;
|
|
|
$scope.$payCenter.deleteID = null;
|
|
|
- }
|
|
|
-
|
|
|
+ };
|
|
|
|
|
|
//确认删除账户信息
|
|
|
$scope.confirmDelete = function () {
|
|
|
@@ -146,95 +463,113 @@ define(['app/app'], function(app) {
|
|
|
toaster.pop('success', '删除账户成功');
|
|
|
$scope.$payCenter.deleteDiv = false;
|
|
|
$scope.$payCenter.deleteID = null;
|
|
|
- getData();
|
|
|
+ loadAccountData();
|
|
|
}, function() {
|
|
|
toaster.pop('error', '删除失败');
|
|
|
})
|
|
|
- }
|
|
|
-
|
|
|
- //观察是否已经选中文件了
|
|
|
- $scope.$watch('bankInfo.files', function (newValue, oldValue, scope) {
|
|
|
- var dom = document.getElementById('upload_text');
|
|
|
- if (dom) {
|
|
|
- var str = dom.value;
|
|
|
- // console.log(str.length);
|
|
|
- }
|
|
|
- if(newValue && newValue.length != 0 && str && str.length > 0) {
|
|
|
- $scope.$payCenter.fileVal = true;
|
|
|
- }else {
|
|
|
- $scope.$payCenter.fileVal = false;
|
|
|
- }
|
|
|
- });
|
|
|
+ };
|
|
|
|
|
|
/**
|
|
|
- * 验证企业名称和开户银行
|
|
|
- * @param name
|
|
|
+ * 目前只支持的银行
|
|
|
+ * @type {string[]}
|
|
|
*/
|
|
|
- $scope.validateName = function (name, index) {
|
|
|
- if(name) {
|
|
|
- if(index == 1) {
|
|
|
- $scope.$payCenter.accountNameVal = true;
|
|
|
- }else {
|
|
|
- $scope.$payCenter.bankNameVal = true;
|
|
|
- }
|
|
|
- }else {
|
|
|
- if(index == 1) {
|
|
|
- $scope.$payCenter.accountNameVal = false;
|
|
|
- }else {
|
|
|
- $scope.$payCenter.bankNameVal = false;
|
|
|
+ $scope.bankList = [
|
|
|
+ '中国银行','中国建设银行','中国工商银行','中国农业银行','交通银行','招商银行','中国民生银行',
|
|
|
+ '兴业银行','中信银行','中国光大银行','广发银行','平安银行','中国邮政储蓄银行','华夏银行','浦发银行'
|
|
|
+ ];
|
|
|
+
|
|
|
+ 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;
|
|
|
}
|
|
|
+ };
|
|
|
|
|
|
- }
|
|
|
+ $scope.fitBankToAccount = function (item) {
|
|
|
+ $scope.account.bankname = item;
|
|
|
+ $scope.showBankFrame = false;
|
|
|
+ };
|
|
|
|
|
|
- /**
|
|
|
- * 验证银行账号信息是否正确
|
|
|
- * @param number
|
|
|
- * number 全部是数字,并且小于 31位 和 大于 7位数字
|
|
|
- */
|
|
|
- $scope.validateNumber = function (number) {
|
|
|
- if(number) {
|
|
|
- if(/^\d+$/.test(number)) {
|
|
|
- if(number.length < 31 && number.length > 7) {
|
|
|
- $scope.$payCenter.numberVal = true;
|
|
|
- return ;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- $scope.$payCenter.numberVal = false;
|
|
|
+ $scope.showList = function () {
|
|
|
+ $scope.showBankFrame = !$scope.showBankFrame;
|
|
|
+ $scope.matchData = true;
|
|
|
+ $scope.resultList = $scope.bankList;
|
|
|
};
|
|
|
|
|
|
- //取消新增账户
|
|
|
- $scope.cancle = function () {
|
|
|
- $scope.$payCenter.newAccount = false;
|
|
|
- $scope.bankInfo = {};
|
|
|
- $scope.bankInfo.files = null;
|
|
|
- }
|
|
|
+ $scope.exportToExcel = function () {
|
|
|
+ if ($scope.totalElements == 0) {
|
|
|
+ toaster.pop('info', '当前收款记录为空,无法导出');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ exportByAjax();
|
|
|
+ };
|
|
|
|
|
|
- //保存账户信息
|
|
|
- $scope.confirm = function () {
|
|
|
- var file = null;
|
|
|
- if($scope.bankInfo.files&&$scope.bankInfo.files[0]) {
|
|
|
- file = $scope.bankInfo.files[0];
|
|
|
+ var exportByAjax = function () {
|
|
|
+ var url = 'trade/transfer/export/bankTransfer';
|
|
|
+ var strArray = [];
|
|
|
+ if ($scope.keyword && $scope.keyword.length > 0){
|
|
|
+ var wordStr = "keyword=" + $scope.keyword;
|
|
|
+ strArray.push(wordStr);
|
|
|
}
|
|
|
- $upload.upload({
|
|
|
- url: 'trade/bankInfo/save/enterprise',
|
|
|
- file: file,
|
|
|
- method: 'POST',
|
|
|
- params : {type : 'sup'},
|
|
|
- data: {
|
|
|
- bankInfo: $scope.bankInfo
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ var form = $("<form>"); //定义一个form表单
|
|
|
+ form.attr('style', 'display:none'); //在form表单中添加查询参数
|
|
|
+ form.attr('target', '');
|
|
|
+ form.attr('method', 'POST');
|
|
|
+ form.attr('action', url);
|
|
|
+
|
|
|
+ $('body').append(form); //将表单放置在web中
|
|
|
+ form.submit();
|
|
|
+
|
|
|
+ $scope.$$transfer.clockID = setInterval(function() {
|
|
|
+ getDownLoadStatus();
|
|
|
+ }, 500);
|
|
|
+ };
|
|
|
+
|
|
|
+ var getDownLoadStatus = function () {
|
|
|
+ Loading.show();
|
|
|
+ $.ajax({
|
|
|
+ url : 'trade/transfer/export/bankTransfer',
|
|
|
+ data : {isAjax : true},
|
|
|
+ method : 'POST',
|
|
|
+ dataType : 'json',
|
|
|
+ success : function (data) {
|
|
|
+ if(!data.loading){
|
|
|
+ $scope.$apply(function () {
|
|
|
+ toaster.pop('info', '数据处理完毕,正在下载文件,请稍等。');
|
|
|
+ Loading.hide();
|
|
|
+ });
|
|
|
+ if($scope.$$transfer.clockID) {
|
|
|
+ clearInterval($scope.$$transfer.clockID);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error : function () {
|
|
|
+ Loading.hide();
|
|
|
+ if($scope.$$transfer.clockID) {
|
|
|
+ clearInterval($scope.$$transfer.clockID);
|
|
|
+ }
|
|
|
}
|
|
|
- }).success(function(data){
|
|
|
- $scope.$payCenter.newAccount = false;
|
|
|
- $scope.bankInfo = {};
|
|
|
- $scope.bankInfo.files = null;
|
|
|
- toaster.pop('success', '保存成功');
|
|
|
- getData();
|
|
|
- }).error(function(data){
|
|
|
- toaster.pop('error', "保存账户信息失败");
|
|
|
});
|
|
|
- }
|
|
|
+ };
|
|
|
|
|
|
//获取传入买家订单获取采购单的信息
|
|
|
$scope.goToPurchaseDetail = function (orderNum) {
|
|
|
@@ -300,7 +635,8 @@ define(['app/app'], function(app) {
|
|
|
return ;
|
|
|
}
|
|
|
$scope.param.page = page;
|
|
|
- getData();
|
|
|
+ $scope.tradeRecordTableParams.page($scope.param.page);
|
|
|
+ $scope.tradeRecordTableParams.reload();
|
|
|
};
|
|
|
|
|
|
//当前页在前段的计算方式
|
|
|
@@ -348,6 +684,12 @@ define(['app/app'], function(app) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ $rootScope.$on('$stateChangeStart',function(event,toState,toParams,fromState,fromParams){
|
|
|
+ if(fromState.name == 'pay_center' || toState.name == 'pay_center'){
|
|
|
+ SessionService.removeCookie("vendorCenter");
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
//当前页在中间计算方式
|
|
|
$scope.middleSegment = function (currentPage) {
|
|
|
angular.forEach($scope.pages, function (page) {
|