|
|
@@ -1,46 +1,248 @@
|
|
|
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) {
|
|
|
+
|
|
|
+ app.register.controller('buyerTransferCtrl', ['$scope', '$rootScope', '$anchorScroll', '$location','SessionService', 'bankInfoService','$modal', 'toaster', 'bankTransferService', '$filter', 'ngTableParams', 'BaseService', 'OrderSimpleInfo', '$state', '$stateParams', 'Order', 'SmoothScroll', 'EncryptionService','NumberService' ,'$timeout', function($scope, $rootScope, $anchorScroll, $location,SessionService, bankInfoService, $modal, toaster, bankTransferService, $filter, ngTableParams, BaseService, OrderSimpleInfo, $state, $stateParams, Order, SmoothScroll, EncryptionService, NumberService, $timeout) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
|
|
|
+ $scope.diliverPrice = [''];
|
|
|
+ $scope.type = "PAIDTOPLATFORM";
|
|
|
+ // $scope.type = "PAIDTOVENDOR";
|
|
|
+ $scope.selectPaymentType = function (type) {
|
|
|
+ $scope.type = type;
|
|
|
+ // console.log($scope.type);
|
|
|
+ };
|
|
|
if($stateParams.orderid) {
|
|
|
Order.get({orderid : $stateParams.orderid}, function(data) {
|
|
|
- console.log(data);
|
|
|
- var arr = new Array();
|
|
|
- $scope.$$bankTransfer = {};
|
|
|
- $scope.$$bankTransfer.total = 0.0;
|
|
|
+ var arr = [];
|
|
|
+ $scope.$$bankTransfer = data[0];
|
|
|
+
|
|
|
+ getSellerAccount();
|
|
|
+ // 分期信息
|
|
|
+ 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.diliverPrice = item.pricesArr.split(',');
|
|
|
+ $scope.installmentNoPayImg = [];
|
|
|
+ angular.forEach($scope.arrList, function (data) {
|
|
|
+ $scope.installmentNoPayImg.push({imageUrl: data})
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($scope.$$bankTransfer.installmentId) {
|
|
|
+ $scope.type = "PAIDTOVENDOR";
|
|
|
+ }
|
|
|
+ $scope.$$bankTransfer.total = 0;
|
|
|
for(var i = 0; i < data.length; i++) {
|
|
|
- arr.push(data[i].orderid);
|
|
|
- $scope.$$bankTransfer.total = $scope.$$bankTransfer.total + data[i].ensurePrice;
|
|
|
+ var item = data[i];
|
|
|
+ arr.push(item.orderid);
|
|
|
+ $scope.$$bankTransfer.total += item.ensurePrice;
|
|
|
}
|
|
|
- $scope.$$bankTransfer.currency = data[0].currency;
|
|
|
$scope.orderNum = arr.join(',');
|
|
|
+ // $scope.installmentData
|
|
|
+
|
|
|
}, function (response) {
|
|
|
toaster.pop('info', '获取订单的信息有误,请确定付款的订单');
|
|
|
})
|
|
|
}else {
|
|
|
$state.go('buyer_order');
|
|
|
}
|
|
|
+ // 取消
|
|
|
+ $scope.loadPage = function () {
|
|
|
+ $state.go('buyer_order');
|
|
|
+ };
|
|
|
+ // 分期付款功能开发
|
|
|
+ $scope.loadPersonal = function () {
|
|
|
+ bankInfoService.getBuyPersonalBank('', function(data) {
|
|
|
+ $scope.buyAccountInfos = resolveData(data);
|
|
|
+ angular.forEach($scope.buyAccountInfos, function(buyAccountInfo) {
|
|
|
+ buyAccountInfo.filterAccount = hideBankFilter(buyAccountInfo.number);
|
|
|
+ });
|
|
|
+ $scope.buyAccount = getOriginalData($scope.buyAccountInfos);
|
|
|
+ }, function(error) {
|
|
|
+ toaster.pop('error', '错误', '提取个人账户信息失败');
|
|
|
+ });
|
|
|
+ };
|
|
|
+ $scope.loadPersonal();
|
|
|
+ // 更换账户
|
|
|
+ $scope.changebuyAccountBox = false;
|
|
|
+ $scope.changebuyAccount = function () {
|
|
|
+ $scope.changebuyAccountBox = true;
|
|
|
+ };
|
|
|
+ $scope.buyerLists = {};
|
|
|
+ $scope.selectItem = function (item) {
|
|
|
+ angular.forEach($scope.buyAccountInfos, function (data) {
|
|
|
+ if(data.id != item.id) {
|
|
|
+ data.isFalse = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $scope.buyerLists = $scope.buyAccountInfos;
|
|
|
+ item.isFalse = !item.isFalse;
|
|
|
+ };
|
|
|
+ $scope.confirmChange = function (){
|
|
|
+ $scope.changebuyAccountBox = false;
|
|
|
+ angular.forEach($scope.buyerLists, function (item) {
|
|
|
+ if (item.isFalse == true) {
|
|
|
+ $scope.buyAccount = item;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+ // 取消
|
|
|
+ $scope.cancelChange = function () {
|
|
|
+ $scope.changebuyAccountBox = false;
|
|
|
+ };
|
|
|
+ // 上传图片
|
|
|
+ $scope.imagesList = [{imageUrl: ''}];
|
|
|
+ // 循环水单价格
|
|
|
+ $scope.waterPriceList = [{price: ''}];
|
|
|
+ $scope.addUploadImg = function () {
|
|
|
+ $scope.imagesList.push({imageUrl: ''});
|
|
|
+ document.onclick = function () {}
|
|
|
+ $scope.diliverPrice.push('');
|
|
|
+ $scope.waterPriceList.push({price: ''});
|
|
|
+ var id = 'uploadImg-'+($scope.imagesList.length-1);
|
|
|
+ $timeout(function(){
|
|
|
+ angular.element('#'+id+' input').click();
|
|
|
+ },1);
|
|
|
+ };
|
|
|
+ // 删除图片
|
|
|
+ $scope.deleteProofInfo = function (index) {
|
|
|
+ // if ($scope.imagesList.length == 1) {
|
|
|
+ // $scope.imagesList[index].imageUrl = '';
|
|
|
+ // } else {
|
|
|
+ // $scope.imagesList.splice(index, 1);
|
|
|
+ // }
|
|
|
+ $scope.imagesList[index] = {};
|
|
|
+ // console.log($scope.imagesList);
|
|
|
+ };
|
|
|
+ $scope.deleteimg = function (index) {
|
|
|
+ $scope.installmentNoPayImg[index] = {};
|
|
|
+ };
|
|
|
|
|
|
+ $scope.addUploadImgNopay = function (event) {
|
|
|
+ // 订单中心的document点击事件
|
|
|
+ document.onclick = function () {}
|
|
|
+
|
|
|
+ $scope.installmentNoPayImg.push({imageUrl: ''});
|
|
|
+ var id = 'upload-'+($scope.installmentNoPayImg.length-1);
|
|
|
+ console.log(id);
|
|
|
+ $timeout(function(){
|
|
|
+ angular.element('#'+id+' input').click();
|
|
|
+ },1);
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * 上传付款截图
|
|
|
+ */
|
|
|
+ $scope.onUploadPayment = function ($data, index) {
|
|
|
+ if (!$data || !$data.path) {
|
|
|
+ toaster.pop('error', '您还没有上传新的单据');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ var id = 'uploadImg-'+($scope.imagesList.length-1);
|
|
|
+ $timeout(function(){
|
|
|
+ angular.element('#'+id+' input').click();
|
|
|
+ },1);
|
|
|
+ $scope.imageUrl = $data.path;
|
|
|
+ $scope.imagesList[index].imageUrl = $scope.imageUrl;
|
|
|
+ // console.log($scope.imagesList);
|
|
|
+ };
|
|
|
+ $scope.onUploadPaymentImg = function ($data, index) {
|
|
|
+ if (!$data || !$data.path) {
|
|
|
+ toaster.pop('error', '您还没有上传新的单据');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ $scope.imageUrl = $data.path;
|
|
|
+ $scope.installmentNoPayImg[index].imageUrl = $scope.imageUrl;
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * 查看大图
|
|
|
+ *
|
|
|
+ * @param imgUrl 图片链接
|
|
|
+ */
|
|
|
+ $scope.showImg = showImg;
|
|
|
+ function showImg(imgUrl) {
|
|
|
+ var src = imgUrl, box = $('#image-box'), modal = $('.modal-content');
|
|
|
+ box.show();
|
|
|
+ box.find('img').attr('src', src);
|
|
|
+ box.find('a').click(function(){
|
|
|
+ box.hide();
|
|
|
+ });
|
|
|
+ box.dblclick(function(){
|
|
|
+ box.hide();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 分期明细
|
|
|
+ $scope.numArray = {
|
|
|
+ '1': '一',
|
|
|
+ '2': '二',
|
|
|
+ '3': '三',
|
|
|
+ '4': '四',
|
|
|
+ '5': '五'
|
|
|
+ };
|
|
|
+
|
|
|
+ // 切换效果
|
|
|
+ $scope.changeImg = function (installmentImg, index) {
|
|
|
+ angular.forEach(installmentImg.installmentImages, function (data,a) {
|
|
|
+ if (index == a){
|
|
|
+ installmentImg.imgIndex = a;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+ $scope.changePrev = function (installmentImg) {
|
|
|
+ if (installmentImg.imgIndex == 0) {
|
|
|
+ installmentImg.imgIndex = 0
|
|
|
+ }else if(installmentImg.imgIndex > 0){
|
|
|
+ installmentImg.imgIndex -= 1;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ $scope.changeNext = function (installmentImg, index) {
|
|
|
+ if (installmentImg.imgIndex == installmentImg.installmentImages.length-1) {
|
|
|
+ installmentImg.imgIndex = 0
|
|
|
+ }else {
|
|
|
+ installmentImg.imgIndex += 1;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ //controller
|
|
|
+ // 分期付款结束
|
|
|
$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();
|
|
|
@@ -52,7 +254,7 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
return arr;
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
$scope.pay = function(order) {
|
|
|
if(order.availabletime < new Date().getTime()) {
|
|
|
toaster.pop("error", '错误', '此订单已过期,已失效');
|
|
|
@@ -65,14 +267,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", '错误', '请选择要付款的单');
|
|
|
@@ -82,7 +284,7 @@ define([ 'app/app' ], function(app) {
|
|
|
$anchorScroll();
|
|
|
$scope.showMe = true;
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
var getOriginalData = function(data) {
|
|
|
var result = {};
|
|
|
if(data&&data.length) {
|
|
|
@@ -92,7 +294,7 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
return result;
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
$scope.selectAll = function() {
|
|
|
$scope.isSelectAll = !$scope.isSelectAll;
|
|
|
$scope.orderArray = [];
|
|
|
@@ -121,7 +323,7 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
$scope.orderNum = $scope.orderArray.join(',');
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
$scope.doSelect = function(order) {
|
|
|
var result = true;
|
|
|
if(order.isSelect) {
|
|
|
@@ -166,61 +368,70 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.isSelectAll = result;
|
|
|
$scope.orderNum = $scope.orderArray.join(',');
|
|
|
}
|
|
|
-
|
|
|
- //根据单选框的状态,提取不同的数据
|
|
|
- var getBuyAccount = function() {
|
|
|
- if(!$scope.purKind) {
|
|
|
- bankInfoService.getBuyEnterpriseBank('', function(data) {
|
|
|
- $scope.buyAccountInfos = resolveData(data);
|
|
|
- angular.forEach($scope.buyAccountInfos, function(buyAccountInfo) {
|
|
|
- buyAccountInfo.filterAccount = hideBankFilter(buyAccountInfo.number);
|
|
|
- });
|
|
|
- $scope.buyAccount = getOriginalData($scope.buyAccountInfos);
|
|
|
- }, function(error) {
|
|
|
- toaster.pop('error', '错误', '提取企业账户信息失败');
|
|
|
- });
|
|
|
- }else {
|
|
|
- bankInfoService.getBuyPersonalBank('', function(data) {
|
|
|
- $scope.buyAccountInfos = resolveData(data);
|
|
|
- angular.forEach($scope.buyAccountInfos, function(buyAccountInfo) {
|
|
|
- buyAccountInfo.filterAccount = hideBankFilter(buyAccountInfo.number);
|
|
|
- });
|
|
|
- $scope.buyAccount = getOriginalData($scope.buyAccountInfos);
|
|
|
- }, function(error) {
|
|
|
- toaster.pop('error', '错误', '提取个人账户信息失败');
|
|
|
- });
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- //开始时,就获取账户信息
|
|
|
- getBuyAccount();
|
|
|
-
|
|
|
+
|
|
|
+ // //根据单选框的状态,提取不同的数据
|
|
|
+ // var getBuyAccount = function() {
|
|
|
+ // if(!$scope.purKind) {
|
|
|
+ // bankInfoService.getBuyEnterpriseBank('', function(data) {
|
|
|
+ // $scope.buyAccountInfos = resolveData(data);
|
|
|
+ // angular.forEach($scope.buyAccountInfos, function(buyAccountInfo) {
|
|
|
+ // buyAccountInfo.filterAccount = hideBankFilter(buyAccountInfo.number);
|
|
|
+ // });
|
|
|
+ // $scope.buyAccount = getOriginalData($scope.buyAccountInfos);
|
|
|
+ // }, function(error) {
|
|
|
+ // toaster.pop('error', '错误', '提取企业账户信息失败');
|
|
|
+ // });
|
|
|
+ // }else {
|
|
|
+ // bankInfoService.getBuyPersonalBank('', function(data) {
|
|
|
+ // $scope.buyAccountInfos = resolveData(data);
|
|
|
+ // angular.forEach($scope.buyAccountInfos, function(buyAccountInfo) {
|
|
|
+ // buyAccountInfo.filterAccount = hideBankFilter(buyAccountInfo.number);
|
|
|
+ // });
|
|
|
+ // $scope.buyAccount = getOriginalData($scope.buyAccountInfos);
|
|
|
+ // }, function(error) {
|
|
|
+ // toaster.pop('error', '错误', '提取个人账户信息失败');
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+ //
|
|
|
+ // //开始时,就获取账户信息
|
|
|
+ // getBuyAccount();
|
|
|
+
|
|
|
//获取管理平台账户信息
|
|
|
var getSellerAccount = function() {
|
|
|
- if(!$scope.saleKind) {
|
|
|
- bankInfoService.getAdminEnterAccount('', function(data) {
|
|
|
- $scope.saleAccountInfos = resolveData(data);
|
|
|
- angular.forEach($scope.saleAccountInfos, function(saleAccountInfo) {
|
|
|
- saleAccountInfo.filterAccount = hideBankFilter(saleAccountInfo.number);
|
|
|
- });
|
|
|
- $scope.saleAccount = getOriginalData($scope.saleAccountInfos);
|
|
|
- }, function(res) {
|
|
|
- toaster.pop('error', '错误', '获取卖家企业账户信息失败');
|
|
|
+ // 平台账户
|
|
|
+ bankInfoService.getAdminEnterAccount('', function(data) {
|
|
|
+ $scope.saleAccountInfos = resolveData(data);
|
|
|
+ angular.forEach($scope.saleAccountInfos, function(saleAccountInfo) {
|
|
|
+ saleAccountInfo.filterAccount = hideBankFilter(saleAccountInfo.number);
|
|
|
});
|
|
|
- }else {
|
|
|
- bankInfoService.getAdminPersAccount('', function(data) {
|
|
|
- $scope.saleAccountInfos = resolveData(data);
|
|
|
- angular.forEach($scope.saleAccountInfos, function(saleAccountInfo) {
|
|
|
- saleAccountInfo.filterAccount = hideBankFilter(saleAccountInfo.number);
|
|
|
- });
|
|
|
- $scope.saleAccount = getOriginalData($scope.saleAccountInfos);
|
|
|
- }, function(res) {
|
|
|
- toaster.pop('error', '错误', '获取卖家个人账户信息失败');
|
|
|
+ $scope.saleAccount = getOriginalData($scope.saleAccountInfos);
|
|
|
+ }, function(res) {
|
|
|
+ toaster.pop('error', '错误', '获取卖家企业账户信息失败');
|
|
|
+ });
|
|
|
+ // 卖家私人账户
|
|
|
+ // bankInfoService.getAdminPersAccount('', function(data) {
|
|
|
+ // $scope.saleAccountInfos = resolveData(data);
|
|
|
+ // angular.forEach($scope.saleAccountInfos, function(saleAccountInfo) {
|
|
|
+ // saleAccountInfo.filterAccount = hideBankFilter(saleAccountInfo.number);
|
|
|
+ // });
|
|
|
+ // $scope.salePerAccount = getOriginalData($scope.saleAccountInfos);
|
|
|
+ // }, function(res) {
|
|
|
+ // toaster.pop('error', '错误', '获取卖家个人账户信息失败');
|
|
|
+ // });
|
|
|
+ //
|
|
|
+ bankInfoService.getSaleEeterprise({enuu: $scope.$$bankTransfer.sellerenuu},{}, function(data) {
|
|
|
+ $scope.saleAccountInfos = resolveData(data);
|
|
|
+ angular.forEach($scope.saleAccountInfos, function(saleAccountInfo) {
|
|
|
+ saleAccountInfo.filterAccount = hideBankFilter(saleAccountInfo.number);
|
|
|
});
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- getSellerAccount();
|
|
|
+ $scope.salePerAccount = getOriginalData($scope.saleAccountInfos);
|
|
|
+ }, function(res) {
|
|
|
+ toaster.pop('error', '错误', '获取卖家个人账户信息失败');
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ // getSellerAccount();
|
|
|
|
|
|
$scope.set = function(data, isBuy) {
|
|
|
if(isBuy) {
|
|
|
@@ -236,7 +447,7 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
// 搜索框内容转换成大写
|
|
|
var t;
|
|
|
var setTime = function() {
|
|
|
@@ -251,19 +462,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,
|
|
|
@@ -286,7 +497,7 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.orderNum = ""; //单号的链接字符串
|
|
|
$scope.orderArray = []; //存放
|
|
|
$scope.total = 0;
|
|
|
-
|
|
|
+
|
|
|
if(ids) {
|
|
|
var arr = ids.split('-');
|
|
|
var result = true;
|
|
|
@@ -303,7 +514,7 @@ define([ 'app/app' ], function(app) {
|
|
|
if(!order.isSelect) {
|
|
|
result = false;
|
|
|
}
|
|
|
- });
|
|
|
+ });
|
|
|
$scope.isSelectAll = result;
|
|
|
$scope.orderNum = $scope.orderArray.join(',');
|
|
|
if($scope.orderNum) {
|
|
|
@@ -313,7 +524,7 @@ define([ 'app/app' ], function(app) {
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
//跳出模态框,data有数据代表编辑,data为空则代表新增。
|
|
|
$scope.bankInfo = function(data) {
|
|
|
var modalInstance = $modal.open({
|
|
|
@@ -326,7 +537,7 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
//新增账户
|
|
|
$scope.newAccount = function(data) {
|
|
|
var modalInstance = $modal.open({
|
|
|
@@ -343,7 +554,7 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
modalInstance.result.then(function(account) {
|
|
|
if(account.kind) {
|
|
|
bankInfoService.saveBuyPersonalBank({}, account, function(data) {
|
|
|
@@ -364,10 +575,10 @@ define([ 'app/app' ], function(app) {
|
|
|
});
|
|
|
}
|
|
|
}, function() {
|
|
|
-
|
|
|
+
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
$scope.deleteAccount = function(buyAccount) {
|
|
|
var isSure = confirm('确认删除本银行账户?删除后无法恢复,请谨慎操作');
|
|
|
if(isSure){
|
|
|
@@ -379,8 +590,34 @@ define([ 'app/app' ], function(app) {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ $scope.onDiliverPriceChange = function (index) {
|
|
|
+ if (!($scope.diliverPrice[index] > 0)) {
|
|
|
+ $scope.diliverPrice[index] = '';
|
|
|
+ toaster.pop('info', '提示', '分期金额必须大于0');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
$scope.confirm = function() {
|
|
|
+ var imageArray = [];
|
|
|
+ if ($scope.$$bankTransfer.installmentId && $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 && $scope.imagesList[i].imageUrl != '') {
|
|
|
+ if ($scope.type == "PAIDTOVENDOR" && $scope.diliverPrice[i] == '') {
|
|
|
+ toaster.pop('info','提示','请输入付款截图下对应的付款金额');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ imageArray.push($scope.imagesList[i].imageUrl);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // console.log($scope.diliverPrice);
|
|
|
+ // console.log($scope.imagesList);
|
|
|
+ var str = imageArray.join(",");
|
|
|
if(angular.isUndefined($scope.orderNum) || angular.equals($scope.orderNum,'') || angular.equals($scope.$$bankTransfer.total, 0)) {
|
|
|
toaster.pop('info', '提示', '没有选择要付款的订单,或付款总额为0');
|
|
|
return ;
|
|
|
@@ -393,37 +630,74 @@ define([ 'app/app' ], function(app) {
|
|
|
toaster.pop('info', '提示', '请选择卖家账户');
|
|
|
return ;
|
|
|
}
|
|
|
- if(!$scope.transferTime) {
|
|
|
- toaster.pop('info', '提示', '请选择付款日期');
|
|
|
+ if(!str || str == ''){
|
|
|
+ toaster.pop('info', '提示', '请选择付款截图');
|
|
|
return ;
|
|
|
}
|
|
|
- if(!$scope.imageUrl){
|
|
|
- toaster.pop('info', '提示', '请选择付款截图');
|
|
|
- return ;
|
|
|
- }
|
|
|
+
|
|
|
+ if ($scope.type == "PAIDTOVENDOR") {
|
|
|
+ var firstItem = {};
|
|
|
+ var firstFlag = false;
|
|
|
+ angular.forEach($scope.installmentData.installmentDetails, function (item) {
|
|
|
+ if (!firstFlag) {
|
|
|
+ if (item.status != 505) {
|
|
|
+ firstItem = item;
|
|
|
+ firstFlag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ var tmpPrice = 0;
|
|
|
+ angular.forEach($scope.diliverPrice, function (item) {
|
|
|
+ if (item != '') {
|
|
|
+ tmpPrice = NumberService.add(tmpPrice, parseFloat(item));
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ if (firstItem.price != tmpPrice) {
|
|
|
+ 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;
|
|
|
+ };
|
|
|
+ if ($scope.type == 'PAIDTOVENDOR'){
|
|
|
+ $scope.saleAccount = $scope.salePerAccount;
|
|
|
+ }
|
|
|
+ // console.log($scope.saleAccount);
|
|
|
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 = $scope.imageUrl;
|
|
|
- transfer.transferTime = $scope.transferTime.getTime();
|
|
|
+ // console.log(transfer.jsonReceive)
|
|
|
+ transfer.imgUrl = str;
|
|
|
+ transfer.type = $scope.type;
|
|
|
+ // transfer.transferTime = $scope.transferTime.getTime();
|
|
|
transfer.total = $scope.$$bankTransfer.total;
|
|
|
+ transfer.pricesArr = $scope.diliverPrice.join(',');
|
|
|
bankTransferService.saveTransfer({order: $scope.orderNum.split(',').join('-')}, transfer, function(data) {
|
|
|
- toaster.pop('success', '信息保存成功');
|
|
|
+ toaster.pop('success', '提交成功');
|
|
|
$state.go('buyer_order');
|
|
|
}, function(response) {
|
|
|
- toaster.pop("error", '失败', '信息保存失败:' + response.data);
|
|
|
+ toaster.pop("error", '失败', '提交失败:' + response.data);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$scope.buyExpose = false;
|
|
|
$scope.salexpose = false;
|
|
|
- //expose代表展开的状态,isBuyd代表当前操作的数据
|
|
|
+ //expose代表展开的状态,isBuy代表当前操作的数据
|
|
|
$scope.doExpose = function(expose, isBuy) {
|
|
|
if(isBuy) {
|
|
|
$scope.buyExpose = expose;
|
|
|
@@ -432,16 +706,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) {
|
|
|
@@ -450,7 +724,7 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.saleAccount = account;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//获取当前时间
|
|
|
var getTodayDate = function(){
|
|
|
var date = new Date();
|
|
|
@@ -458,7 +732,7 @@ define([ 'app/app' ], function(app) {
|
|
|
};
|
|
|
getTodayDate();
|
|
|
}]);
|
|
|
-
|
|
|
+
|
|
|
app.register.controller('timeCtrl', ['$scope', '$modalInstance', function($scope, $modalInstance) {
|
|
|
$scope.time = 5;
|
|
|
var setTime = function() {
|
|
|
@@ -473,19 +747,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) {
|
|
|
@@ -502,22 +776,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};
|
|
|
// 图片上传成功之后
|
|
|
@@ -529,12 +803,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;
|