|
|
@@ -1,5 +1,5 @@
|
|
|
define([ 'app/app' ], function(app) {
|
|
|
-
|
|
|
+
|
|
|
app.register.controller('buyerTransferCtrl', ['$scope', '$rootScope', '$anchorScroll', '$location','SessionService', 'bankInfoService','$modal', 'toaster', 'bankTransferService', '$filter', 'ngTableParams', 'BaseService', 'OrderSimpleInfo', '$state', '$stateParams', 'Order', 'SmoothScroll', 'EncryptionService', function($scope, $rootScope, $anchorScroll, $location,SessionService, bankInfoService, $modal, toaster, bankTransferService, $filter, ngTableParams, BaseService, OrderSimpleInfo, $state, $stateParams, Order, SmoothScroll, EncryptionService) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
|
|
|
@@ -14,7 +14,37 @@ define([ 'app/app' ], function(app) {
|
|
|
var arr = [];
|
|
|
$scope.$$bankTransfer = data[0];
|
|
|
// 分期信息
|
|
|
- $scope.installmentData = data[0].installment;
|
|
|
+ if ($scope.$$bankTransfer.installmentId){
|
|
|
+ $scope.installmentData = data[0].installment;
|
|
|
+ // 获取没有付款的期数
|
|
|
+ $scope.yesPayinstallmentDetails = [];
|
|
|
+ $scope.noPayinstallmentDetails = [];
|
|
|
+ if ($scope.installmentData.status == 504){
|
|
|
+ angular.forEach($scope.installmentData.installmentDetails, function (item) {
|
|
|
+ if (item.status == 505) {
|
|
|
+ $scope.yesPayinstallmentDetails.push(item);
|
|
|
+ item.installmentImages = item.imgs.split(",");
|
|
|
+ item.imgIndex = 0;
|
|
|
+ // 已付款价格
|
|
|
+ $scope.yesPayinstallmentDetails.payTatalPrice = 0;
|
|
|
+ angular.forEach($scope.yesPayinstallmentDetails, function (item) {
|
|
|
+ $scope.yesPayinstallmentDetails.payTatalPrice += item.price;
|
|
|
+ });
|
|
|
+ }else if(item.status == 504){
|
|
|
+ $scope.noPayinstallmentDetails.push(item);
|
|
|
+ item.installmentImages = item.imgs.split(",");
|
|
|
+
|
|
|
+ // 存放当前未付款图片
|
|
|
+ $scope.arrList = item.installmentImages;
|
|
|
+ $scope.installmentNoPayImg = [];
|
|
|
+ angular.forEach($scope.arrList, function (data) {
|
|
|
+ $scope.installmentNoPayImg.push({imageUrl: data})
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
if ($scope.$$bankTransfer.installmentId) {
|
|
|
$scope.type = "PAIDTOVENDOR";
|
|
|
}
|
|
|
@@ -25,7 +55,7 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.$$bankTransfer.total += item.ensurePrice;
|
|
|
}
|
|
|
$scope.orderNum = arr.join(',');
|
|
|
- console.log($scope.$$bankTransfer);
|
|
|
+
|
|
|
}, function (response) {
|
|
|
toaster.pop('info', '获取订单的信息有误,请确定付款的订单');
|
|
|
})
|
|
|
@@ -84,12 +114,18 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.deleteProofInfo = function (index) {
|
|
|
$scope.imagesList[index] = {};
|
|
|
};
|
|
|
+ $scope.deleteimg = function (index) {
|
|
|
+ $scope.installmentNoPayImg[index] = {};
|
|
|
+ };
|
|
|
+ $scope.addUploadImgNopay = function () {
|
|
|
+ $scope.installmentNoPayImg.push({imageUrl: ''});
|
|
|
+ };
|
|
|
/**
|
|
|
* 上传付款截图
|
|
|
*/
|
|
|
$scope.onUploadPayment = function ($data, index) {
|
|
|
if (!$data || !$data.path) {
|
|
|
- toaster.pop('error', '付款截图上传失败');
|
|
|
+ toaster.pop('error', '您还没有上传新的单据');
|
|
|
return ;
|
|
|
}
|
|
|
$scope.imageUrl = $data.path;
|
|
|
@@ -122,30 +158,30 @@ define([ 'app/app' ], function(app) {
|
|
|
'5': '五'
|
|
|
};
|
|
|
// 临时数据
|
|
|
- var loadInstallment = function () {
|
|
|
- $scope.installmentDetails = [
|
|
|
- {
|
|
|
- price : 120,
|
|
|
- status : 503,
|
|
|
- deadline : '2017-09-20 12:20:30',
|
|
|
- imgs : 'http://localhost:8080/platform-b2c/static/img/icon/img.png,http://113.105.74.140/images/d83b1794fad111e5ac8300269e610dbf.jpg'
|
|
|
- },
|
|
|
- {
|
|
|
- price : 180,
|
|
|
- status : 504,
|
|
|
- deadline : '2017-09-25 11:20:50',
|
|
|
- imgs : 'http://113.105.74.140/images/d83b1794fad111e5ac8300269e610dbf.jpg,http://localhost:8080/platform-b2c/static/img/icon/img.png,http://113.105.74.140/images/d83b1794fad111e5ac8300269e610dbf.jpg'
|
|
|
- }
|
|
|
- ];
|
|
|
- $scope.changeList = '';
|
|
|
- angular.forEach($scope.installmentDetails, function (item) {
|
|
|
- item.installmentImages = item.imgs.split(",");
|
|
|
- item.imgIndex = 0;
|
|
|
- $scope.changeList = item.installmentImages;
|
|
|
-
|
|
|
- });
|
|
|
- };
|
|
|
- loadInstallment();
|
|
|
+ // var loadInstallment = function () {
|
|
|
+ // $scope.installmentDetails = [
|
|
|
+ // {
|
|
|
+ // price : 120,
|
|
|
+ // status : 503,
|
|
|
+ // deadline : '2017-09-20 12:20:30',
|
|
|
+ // imgs : 'http://localhost:8080/platform-b2c/static/img/icon/img.png,http://113.105.74.140/images/d83b1794fad111e5ac8300269e610dbf.jpg'
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // price : 180,
|
|
|
+ // status : 504,
|
|
|
+ // deadline : '2017-09-25 11:20:50',
|
|
|
+ // imgs : 'http://113.105.74.140/images/d83b1794fad111e5ac8300269e610dbf.jpg,http://localhost:8080/platform-b2c/static/img/icon/img.png,http://113.105.74.140/images/d83b1794fad111e5ac8300269e610dbf.jpg'
|
|
|
+ // }
|
|
|
+ // ];
|
|
|
+ // $scope.changeList = '';
|
|
|
+ // angular.forEach($scope.installmentDetails, function (item) {
|
|
|
+ // item.installmentImages = item.imgs.split(",");
|
|
|
+ // item.imgIndex = 0;
|
|
|
+ // $scope.changeList = item.installmentImages;
|
|
|
+ //
|
|
|
+ // });
|
|
|
+ // };
|
|
|
+ // loadInstallment();
|
|
|
|
|
|
// 切换效果
|
|
|
$scope.changeImg = function (installmentImg, index) {
|
|
|
@@ -174,22 +210,22 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.purKind = $rootScope.userInfo.enterprises ? false : true;//应付账户的类别, 默认是企业
|
|
|
$scope.saleKind = false;//应收账户的类别,默认是企业
|
|
|
var ids=SessionService.get("ids");
|
|
|
-
|
|
|
+
|
|
|
var page = Number(SessionService.get("page")) || 1;
|
|
|
var count = Number(SessionService.get("count")) || 20;
|
|
|
SessionService.unset("ids");
|
|
|
SessionService.unset("page");
|
|
|
SessionService.unset("count");
|
|
|
var hideBankFilter = $filter("hideBankFilter");
|
|
|
-
|
|
|
+
|
|
|
$scope.isSelectAll = false;
|
|
|
$scope.isSelect = false;
|
|
|
$scope.orderArray = []; //存放订单链
|
|
|
$scope.total = 0;
|
|
|
$scope.currencyName = ''; //存放当前币别
|
|
|
-
|
|
|
+
|
|
|
$scope.nowTime = new Date().getTime();
|
|
|
-
|
|
|
+
|
|
|
//解析数据,从返回的数据中找到要解析的数据
|
|
|
var resolveData = function(data) {
|
|
|
var arr = new Array();
|
|
|
@@ -201,7 +237,7 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
return arr;
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
$scope.pay = function(order) {
|
|
|
if(order.availabletime < new Date().getTime()) {
|
|
|
toaster.pop("error", '错误', '此订单已过期,已失效');
|
|
|
@@ -214,14 +250,14 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.showMe = true;
|
|
|
SmoothScroll.scrollTo(null, 'O', -68);
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
//返回修改
|
|
|
$scope.alterPay = function() {
|
|
|
$location.hash('toptip');
|
|
|
$anchorScroll();
|
|
|
$scope.showMe = false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$scope.batchPay = function() {
|
|
|
if(!$scope.orderNum) {
|
|
|
toaster.pop("error", '错误', '请选择要付款的单');
|
|
|
@@ -231,7 +267,7 @@ define([ 'app/app' ], function(app) {
|
|
|
$anchorScroll();
|
|
|
$scope.showMe = true;
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
var getOriginalData = function(data) {
|
|
|
var result = {};
|
|
|
if(data&&data.length) {
|
|
|
@@ -241,7 +277,7 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
return result;
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
$scope.selectAll = function() {
|
|
|
$scope.isSelectAll = !$scope.isSelectAll;
|
|
|
$scope.orderArray = [];
|
|
|
@@ -270,7 +306,7 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
$scope.orderNum = $scope.orderArray.join(',');
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
$scope.doSelect = function(order) {
|
|
|
var result = true;
|
|
|
if(order.isSelect) {
|
|
|
@@ -315,7 +351,7 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.isSelectAll = result;
|
|
|
$scope.orderNum = $scope.orderArray.join(',');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// //根据单选框的状态,提取不同的数据
|
|
|
// var getBuyAccount = function() {
|
|
|
// if(!$scope.purKind) {
|
|
|
@@ -343,7 +379,7 @@ define([ 'app/app' ], function(app) {
|
|
|
//
|
|
|
// //开始时,就获取账户信息
|
|
|
// getBuyAccount();
|
|
|
-
|
|
|
+
|
|
|
//获取管理平台账户信息
|
|
|
var getSellerAccount = function() {
|
|
|
// 平台账户
|
|
|
@@ -367,7 +403,7 @@ define([ 'app/app' ], function(app) {
|
|
|
toaster.pop('error', '错误', '获取卖家个人账户信息失败');
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
getSellerAccount();
|
|
|
|
|
|
$scope.set = function(data, isBuy) {
|
|
|
@@ -384,7 +420,7 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
// 搜索框内容转换成大写
|
|
|
var t;
|
|
|
var setTime = function() {
|
|
|
@@ -399,19 +435,19 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.keyword = angular.uppercase($scope.keyword);
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
$scope.upper = function() {
|
|
|
$scope.time = 1;
|
|
|
clearTimeout(t);
|
|
|
setTime();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 根据搜索框输入信息搜索对应订单
|
|
|
$scope.searchFor = function() {
|
|
|
$scope.keyword = angular.uppercase($scope.keyword);
|
|
|
$scope.tobePaidTableParams.reload();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$scope.tobePaidTableParams = new ngTableParams({
|
|
|
page : page,
|
|
|
count : count,
|
|
|
@@ -434,7 +470,7 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.orderNum = ""; //单号的链接字符串
|
|
|
$scope.orderArray = []; //存放
|
|
|
$scope.total = 0;
|
|
|
-
|
|
|
+
|
|
|
if(ids) {
|
|
|
var arr = ids.split('-');
|
|
|
var result = true;
|
|
|
@@ -451,7 +487,7 @@ define([ 'app/app' ], function(app) {
|
|
|
if(!order.isSelect) {
|
|
|
result = false;
|
|
|
}
|
|
|
- });
|
|
|
+ });
|
|
|
$scope.isSelectAll = result;
|
|
|
$scope.orderNum = $scope.orderArray.join(',');
|
|
|
if($scope.orderNum) {
|
|
|
@@ -461,7 +497,7 @@ define([ 'app/app' ], function(app) {
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
//跳出模态框,data有数据代表编辑,data为空则代表新增。
|
|
|
$scope.bankInfo = function(data) {
|
|
|
var modalInstance = $modal.open({
|
|
|
@@ -474,7 +510,7 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
//新增账户
|
|
|
$scope.newAccount = function(data) {
|
|
|
var modalInstance = $modal.open({
|
|
|
@@ -491,7 +527,7 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
modalInstance.result.then(function(account) {
|
|
|
if(account.kind) {
|
|
|
bankInfoService.saveBuyPersonalBank({}, account, function(data) {
|
|
|
@@ -512,10 +548,10 @@ define([ 'app/app' ], function(app) {
|
|
|
});
|
|
|
}
|
|
|
}, function() {
|
|
|
-
|
|
|
+
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
$scope.deleteAccount = function(buyAccount) {
|
|
|
var isSure = confirm('确认删除本银行账户?删除后无法恢复,请谨慎操作');
|
|
|
if(isSure){
|
|
|
@@ -527,9 +563,12 @@ define([ 'app/app' ], function(app) {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$scope.confirm = function() {
|
|
|
var imageArray = [];
|
|
|
+ if ($scope.noPayinstallmentDetails.length > 0) {
|
|
|
+ $scope.imagesList = $scope.installmentNoPayImg;
|
|
|
+ }
|
|
|
for (var i = 0; i< $scope.imagesList.length; i++) {
|
|
|
if ($scope.imagesList.length < 6) {
|
|
|
if ($scope.imagesList[i].imageUrl != '') {
|
|
|
@@ -551,27 +590,28 @@ define([ 'app/app' ], function(app) {
|
|
|
return ;
|
|
|
}
|
|
|
if(!str){
|
|
|
- toaster.pop('info', '提示', '请选择付款截图');
|
|
|
- return ;
|
|
|
- }
|
|
|
- var installmentDetailId = '';
|
|
|
- angular.forEach($scope.$$bankTransfer.installment.installmentDetails, function (installmentDetail) {
|
|
|
- if (installmentDetail.detno == $scope.$$bankTransfer.installment.currentNo)
|
|
|
- installmentDetailId = installmentDetail.id;
|
|
|
- })
|
|
|
+ toaster.pop('info', '提示', '请选择付款截图');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ var transfer = {};
|
|
|
+ if ($scope.$$bankTransfer.installment){
|
|
|
+ var installmentDetailId = '';
|
|
|
+ angular.forEach($scope.$$bankTransfer.installment.installmentDetails, function (installmentDetail) {
|
|
|
+ if (installmentDetail.detno == $scope.$$bankTransfer.installment.currentNo)
|
|
|
+ installmentDetailId = installmentDetail.id;
|
|
|
+ })
|
|
|
+ transfer.installmentDetailId = installmentDetailId;
|
|
|
+ };
|
|
|
var buyAccount = angular.copy($scope.buyAccount);
|
|
|
var saleAccount = angular.copy($scope.saleAccount);
|
|
|
delete saleAccount.filterAccount;
|
|
|
delete buyAccount.filterAccount;
|
|
|
var jsonPament = angular.toJson(buyAccount);
|
|
|
var jsonReceive = angular.toJson(saleAccount);
|
|
|
- var transfer = {};
|
|
|
transfer.jsonPament = jsonPament;
|
|
|
transfer.jsonReceive = jsonReceive;
|
|
|
transfer.imgUrl = str;
|
|
|
transfer.type = $scope.type;
|
|
|
- transfer.installmentDetailId = installmentDetailId;
|
|
|
- console.log(transfer.type)
|
|
|
// transfer.transferTime = $scope.transferTime.getTime();
|
|
|
transfer.total = $scope.$$bankTransfer.total;
|
|
|
bankTransferService.saveTransfer({order: $scope.orderNum.split(',').join('-')}, transfer, function(data) {
|
|
|
@@ -593,16 +633,16 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // /**
|
|
|
- // * 上传付款截图
|
|
|
- // */
|
|
|
- // $scope.onUploadPayment = function ($data) {
|
|
|
- // if (!$data || !$data.path) {
|
|
|
- // toaster.pop('error', '付款截图上传失败');
|
|
|
- // return ;
|
|
|
- // }
|
|
|
- // $scope.imageUrl = $data.path;
|
|
|
- // };
|
|
|
+ // /**
|
|
|
+ // * 上传付款截图
|
|
|
+ // */
|
|
|
+ // $scope.onUploadPayment = function ($data) {
|
|
|
+ // if (!$data || !$data.path) {
|
|
|
+ // toaster.pop('error', '付款截图上传失败');
|
|
|
+ // return ;
|
|
|
+ // }
|
|
|
+ // $scope.imageUrl = $data.path;
|
|
|
+ // };
|
|
|
|
|
|
$scope.select = function(account, isBuy) {
|
|
|
if(isBuy) {
|
|
|
@@ -611,7 +651,7 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.saleAccount = account;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//获取当前时间
|
|
|
var getTodayDate = function(){
|
|
|
var date = new Date();
|
|
|
@@ -619,7 +659,7 @@ define([ 'app/app' ], function(app) {
|
|
|
};
|
|
|
getTodayDate();
|
|
|
}]);
|
|
|
-
|
|
|
+
|
|
|
app.register.controller('timeCtrl', ['$scope', '$modalInstance', function($scope, $modalInstance) {
|
|
|
$scope.time = 5;
|
|
|
var setTime = function() {
|
|
|
@@ -634,19 +674,19 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.closeNow();
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
setTime();
|
|
|
-
|
|
|
+
|
|
|
$scope.closeNow = function() {
|
|
|
$modalInstance.close($scope.time);
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
$scope.dismiss = function() {
|
|
|
$modalInstance.dismiss();
|
|
|
};
|
|
|
}]);
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
app.register.controller('BankInfoCtrl', ['$scope', '$modalInstance', 'account', 'kind', function($scope, $modalInstance, account, kind){
|
|
|
$scope.account = account;
|
|
|
if($scope.account) {
|
|
|
@@ -663,22 +703,22 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.account = {};
|
|
|
$scope.account.currency = 'RMB'; // 默认银行卡币别是人民币
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$scope.set = function(kind) {
|
|
|
$scope.kind = kind;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$scope.confirm = function() {
|
|
|
$scope.account.kind = $scope.kind;
|
|
|
$modalInstance.close($scope.account);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$scope.cancel = function() {
|
|
|
$modalInstance.dismiss();
|
|
|
}
|
|
|
|
|
|
}]);
|
|
|
-
|
|
|
+
|
|
|
app.register.controller('ImageInsertCtrl', ['$scope', '$modalInstance', 'SmoothScroll', function($scope, $modalInstance, SmoothScroll) {
|
|
|
$scope.image = {src: null};
|
|
|
// 图片上传成功之后
|
|
|
@@ -690,12 +730,12 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.image.thumb = path;
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
$scope.close = function() {
|
|
|
$modalInstance.dismiss();
|
|
|
SmoothScroll.scrollTo(null, 'O', -68);
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
$scope.confirm = function() {
|
|
|
$modalInstance.close($scope.image);
|
|
|
$scope.imageUrl = null;
|