|
|
@@ -17,31 +17,6 @@ define(['app/app'], function(app) {
|
|
|
$scope.$payCenter.tab = "paymentRecord";
|
|
|
$scope.$$bankInfo = {};
|
|
|
|
|
|
- //控制删除div显示
|
|
|
- $scope.$payCenter.deleteDiv = false;
|
|
|
- //删除id
|
|
|
- $scope.$payCenter.deleteID = null;
|
|
|
-
|
|
|
- $scope.$payCenter.newAccount = false;
|
|
|
-
|
|
|
- //获取数据的方法;
|
|
|
- $scope.getMethod = "getSaleEeterpriseBank";
|
|
|
-
|
|
|
- $scope.bankInfo = {};
|
|
|
-
|
|
|
- //获取订单数据
|
|
|
- // var getData = function () {
|
|
|
- // if($scope.$payCenter.tab === 'paymentRecode') {//获取支付记录
|
|
|
- //
|
|
|
- // }else {//获取企业的账户信息
|
|
|
- // bankInfoService[$scope.getMethod](null, function (data) {
|
|
|
- // $scope.bankInfos = data;
|
|
|
- // }, function (response) {
|
|
|
- // toaster.pop('error', '获取卖家的账户信息失败');
|
|
|
- // });
|
|
|
- // }
|
|
|
- // };
|
|
|
-
|
|
|
$scope.tradeRecordTableParams = new ngTableParams({
|
|
|
page : 1,
|
|
|
count : 30
|
|
|
@@ -130,62 +105,154 @@ define(['app/app'], function(app) {
|
|
|
};
|
|
|
|
|
|
// 文件上传成功之后
|
|
|
- $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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $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.branchError || $scope.branchPattError || $scope.numberError || $scope.numberPattError ||
|
|
|
+ $scope.nameError || $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', '保存成功');
|
|
|
+ loadData();
|
|
|
+ }
|
|
|
+ }).error(function(){
|
|
|
+ toaster.pop('error', "保存账户信息失败");
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
//删除账户
|
|
|
$scope.deleteAccount = function(account) {
|
|
|
if(account.id) {
|
|
|
- $scope.$payCenter.deleteDiv = true;
|
|
|
$scope.$payCenter.deleteID = account.id;
|
|
|
}else {
|
|
|
toaster.pop('info', '请选择要删除的信息');
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //取消删除的操作
|
|
|
- $scope.cancleDelete = function () {
|
|
|
- $scope.$payCenter.deleteDiv = false;
|
|
|
- $scope.$payCenter.deleteID = null;
|
|
|
- }
|
|
|
-
|
|
|
+ };
|
|
|
|
|
|
//确认删除账户信息
|
|
|
$scope.confirmDelete = function () {
|
|
|
@@ -197,95 +264,20 @@ define(['app/app'], function(app) {
|
|
|
toaster.pop('success', '删除账户成功');
|
|
|
$scope.$payCenter.deleteDiv = false;
|
|
|
$scope.$payCenter.deleteID = null;
|
|
|
- getData();
|
|
|
+ loadData();
|
|
|
}, 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
|
|
|
- */
|
|
|
- $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;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ };
|
|
|
|
|
|
/**
|
|
|
- * 验证银行账号信息是否正确
|
|
|
- * @param number
|
|
|
- * number 全部是数字,并且小于 31位 和 大于 7位数字
|
|
|
+ * 目前只支持的银行
|
|
|
+ * @type {string[]}
|
|
|
*/
|
|
|
- $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.cancle = function () {
|
|
|
- $scope.$payCenter.newAccount = false;
|
|
|
- $scope.bankInfo = {};
|
|
|
- $scope.bankInfo.files = null;
|
|
|
- }
|
|
|
-
|
|
|
- //保存账户信息
|
|
|
- $scope.confirm = function () {
|
|
|
- var file = null;
|
|
|
- if($scope.bankInfo.files&&$scope.bankInfo.files[0]) {
|
|
|
- file = $scope.bankInfo.files[0];
|
|
|
- }
|
|
|
- $upload.upload({
|
|
|
- url: 'trade/bankInfo/save/enterprise',
|
|
|
- file: file,
|
|
|
- method: 'POST',
|
|
|
- params : {type : 'sup'},
|
|
|
- data: {
|
|
|
- bankInfo: $scope.bankInfo
|
|
|
- }
|
|
|
- }).success(function(data){
|
|
|
- $scope.$payCenter.newAccount = false;
|
|
|
- $scope.bankInfo = {};
|
|
|
- $scope.bankInfo.files = null;
|
|
|
- toaster.pop('success', '保存成功');
|
|
|
- getData();
|
|
|
- }).error(function(data){
|
|
|
- toaster.pop('error', "保存账户信息失败");
|
|
|
- });
|
|
|
- }
|
|
|
+ $scope.bankList = [
|
|
|
+ '中国银行','中国建设银行','中国工商银行','中国农业银行','交通银行','招商银行','中国民生银行',
|
|
|
+ '兴业银行','中信银行','中国光大银行','广发银行','平安银行','中国邮政储蓄银行','华夏银行','浦发银行'
|
|
|
+ ];
|
|
|
|
|
|
//获取传入买家订单获取采购单的信息
|
|
|
$scope.goToPurchaseDetail = function (orderNum) {
|