Browse Source

单个产品线下付款。

ouxq 8 years ago
parent
commit
1dea8f0f19

+ 1 - 1
src/main/webapp/resources/css/pay.css

@@ -174,7 +174,7 @@
 
 /*立即支付*/
 .payment-style ul.payment-80{
-   height: 80px;
+   max-height: 80px;
 }
 .payment-style ul.payment-80 li{
     height: 35px;

+ 5 - 0
src/main/webapp/resources/js/common/query/installments.js

@@ -16,6 +16,11 @@ define([ 'ngResource' ], function() {
             deleteInstallment: {
                 url: rootPath + '/trade/installments/:purchaseId',
                 method: 'DELETE'
+            },
+            // 验证是否能启用分期信息
+            validationCount: {
+                url: rootPath + '/trade/installments/:purchaseId/validate',
+                method: 'GET'
             }
         });
     }])

+ 1 - 1
src/main/webapp/resources/js/usercenter/app.js

@@ -379,7 +379,7 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'commo
 			controllerUrl : 'app/controllers/forstore/shipping_address_edit_ctrl'
 		})).state('downPayment', angularAMD.route({
 			// 线下付款
-			url : '/downPayment',
+			url : '/downPayment/:orderid',
 			templateUrl : 'static/view/usercenter/forstore/buyer_down_payment.html',
 			controller : 'downPaymentCtrl',
 			controllerUrl : 'app/controllers/forstore/buyer_down_payment_ctrl'

+ 563 - 5
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_down_payment_ctrl.js

@@ -1,7 +1,565 @@
-define(['app/app'], function(app) {
-    'use strict';
-    app.register.controller('downPaymentCtrl', ['$scope', '$rootScope', function($scope, $rootScope){
-        $rootScope.active = 'buyer_order';
+define([ 'app/app' ], function(app) {
 
+    app.register.controller('downPaymentCtrl', ['$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();
+
+        $scope.type = "PAIDTOPLATFORM";
+
+        if($stateParams.orderid) {
+            Order.get({orderid : $stateParams.orderid}, function(data) {
+                console.log(data);
+                var arr = new Array();
+                $scope.$$bankTransfer = {};
+                $scope.$$bankTransfer.total = 0.0;
+                for(var i = 0; i < data.length; i++) {
+                    arr.push(data[i].orderid);
+                    $scope.$$bankTransfer.total = $scope.$$bankTransfer.total + data[i].ensurePrice;
+                }
+                $scope.$$bankTransfer.currency =  data[0].currency;
+                $scope.orderNum = arr.join(',');
+                $scope.orderList = arr;
+            }, function (response) {
+                toaster.pop('info', '获取订单的信息有误,请确定付款的订单');
+            })
+        }else {
+            $state.go('buyer_order');
+        }
+        
+        $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();
+            for(var key in data) {
+                var numb= Number(key);
+                if(angular.isNumber(numb)&&(!isNaN(numb))) {
+                    arr.push(data[key]);
+                }
+            }
+            return arr;
+        };
+
+        $scope.pay = function(order) {
+            if(order.availabletime < new Date().getTime()) {
+                toaster.pop("error", '错误', '此订单已过期,已失效');
+                return;
+            }
+            angular.forEach($scope.tobePaidTableParams.data, function(obj) {
+                obj.isSelect = false;
+            });
+            order.isSelect = true;
+            $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", '错误', '请选择要付款的单');
+                return ;
+            }
+            $location.hash('anchorScroll');
+            $anchorScroll();
+            $scope.showMe = true;
+        };
+
+        var getOriginalData = function(data) {
+            var result = {};
+            if(data&&data.length) {
+                result = data[0];
+            }else {
+                result = null;
+            }
+            return result;
+        };
+
+        $scope.selectAll = function() {
+            $scope.isSelectAll = !$scope.isSelectAll;
+            $scope.orderArray = [];
+            $scope.orderNum = "";
+            $scope.total = 0;
+            $scope.currencyName = $scope.tobePaidTableParams.data[0].currency;
+            var hasConflict = false;
+            angular.forEach($scope.tobePaidTableParams.data, function(order) {
+                if($scope.isSelectAll) {
+                    if((order.availabletime >= new Date().getTime()) && ($scope.currencyName == order.currency)) {
+                        $scope.orderArray.push(order.orderid);
+                        order.isSelect = true;
+                        $scope.total += Number(order.price);
+                    }else {
+                        hasConflict = true;
+                        order.isSelect = false;
+                    }
+
+                }else {
+                    order.isSelect = false;
+                    $scope.currencyName = '';
+                }
+            });
+            if(hasConflict) {
+                toaster.pop('info', '您当前操作的订单过期或与选中的币别  '+$scope.currencyName+' 不一致,不能统一付款');
+            }
+            $scope.orderNum = $scope.orderArray.join(',');
+        };
+
+        $scope.doSelect = function(order) {
+            var result = true;
+            if(order.isSelect) {
+                if($scope.orderArray.length == 0) {
+                    $scope.currencyName = order.currency;
+                }
+                if(order.availabletime < new Date().getTime()) {
+                    toaster.pop("info", '此订单已过付款期或');
+                    order.isSelect = false;
+                    result = false;//代表已经有没有选中的状态了
+                    return ;
+                }
+                if($scope.currencyName != order.currency) {
+                    toaster.pop("info", '与选中的币别 '+$scope.currencyName + ' 不一致,不能统一付款!');
+                    order.isSelect = false;
+                    result = false;//代表已经有没有选中的状态了
+                    return ;
+                }
+                $scope.orderArray.push(order.orderid);
+                $scope.total += Number(order.price);
+            }else {
+                var index = -1;
+                angular.forEach($scope.orderArray, function(item, key) {
+                    if(item == order.orderid) {
+                        index = key;
+                        $scope.total -= Number(order.price);
+                    }
+                });
+                $scope.orderArray.splice(index, 1);
+                result = false;//代表已经有没有选中的状态了
+            }
+            //检查是否选中了所有的单选框
+            //如果现在还为true,就检查所有行信息的是否都选中
+            if(result) {
+                angular.forEach($scope.tobePaidTableParams.data, function(order) {
+                    if(!order.isSelect) {
+                        result = false;
+                    }
+                });
+            }
+
+            $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 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', '错误', '获取卖家企业账户信息失败');
+                });
+            }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', '错误', '获取卖家个人账户信息失败');
+                });
+            }
+        }
+
+        getSellerAccount();
+
+        $scope.set = function(data, isBuy) {
+            if(isBuy) {
+                if(!angular.equals($scope.purKind, data)) {
+                    $scope.purKind = data;
+                    getBuyAccount();
+                }
+            }else {
+                if(!angular.equals($scope.saleKind, data)) {
+                    $scope.saleKind = data;
+                    getSellerAccount();
+                }
+            }
+
+        };
+
+        // 搜索框内容转换成大写
+        var t;
+        var setTime = function() {
+            if($scope.time > 0) {
+                t = setTimeout(function() {
+                    $scope.$apply(function() {
+                        $scope.time--;
+                        setTime();
+                    });
+                }, 1000);
+            }else {
+                $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,
+            sorting : {
+                creattime: 'DESC'
+            }
+        }, {
+            total : 0,
+            getData : function($defer, params) {
+                var param = BaseService.parseParams(params.url());
+                param.keyword = $scope.keyword;
+                param.status = '503';
+                Order.getIndividualOrder(param, function(page) {
+                    if (page) {
+                        params.total(page.totalElements);
+                        $defer.resolve(page.content);
+                    }
+                    //重新加载数据后,数据记录删除
+                    $scope.isSelectAll = false;
+                    $scope.orderNum = ""; //单号的链接字符串
+                    $scope.orderArray = []; //存放
+                    $scope.total = 0;
+
+                    if(ids) {
+                        var arr = ids.split('-');
+                        var result = true;
+                        for(var i = 0; i < arr.length; i++) {
+                            angular.forEach(page.content, function(order) {
+                                if(order.orderid == arr[i]) {
+                                    order.isSelect = true;
+                                    $scope.orderArray.push(order.orderid);
+                                    $scope.total += Number(order.price);
+                                }
+                            });
+                        }
+                        angular.forEach(page.content, function(order) {
+                            if(!order.isSelect) {
+                                result = false;
+                            }
+                        });
+                        $scope.isSelectAll = result;
+                        $scope.orderNum = $scope.orderArray.join(',');
+                        if($scope.orderNum) {
+                            $scope.showMe = true;
+                        }
+                    }
+                });
+            }
+        });
+
+        //跳出模态框,data有数据代表编辑,data为空则代表新增。
+        $scope.bankInfo = function(data) {
+            var modalInstance = $modal.open({
+                templateUrl: 'static/common/bankInfoModal.html',
+                controller: 'BankInfoCtrl',
+                resolve: {
+                    data: function() {
+                        return angular.copy(data);
+                    }
+                }
+            });
+        };
+
+        //新增账户
+        $scope.newAccount = function(data) {
+            var modalInstance = $modal.open({
+                templateUrl : 'static/view/common/bankInfoModal.html',
+                controller : 'BankInfoCtrl',
+                resolve : {
+                    kind : function() {
+                        //深拷贝一份
+                        return angular.copy($scope.purKind);
+                    },
+                    account : function() {
+                        //深拷贝一份
+                        return angular.copy(data);
+                    }
+                }
+            });
+
+            modalInstance.result.then(function(account) {
+                if(account.kind) {
+                    bankInfoService.saveBuyPersonalBank({}, account, function(data) {
+                        toaster.pop('success', '成功','信息已添加');
+                        $scope.purKind = account.kind;
+                        getBuyAccount();  //这个方法不能提取到外面,因为存在异步。
+                    }, function(res) {
+                        toaster.pop('error', '错误', res.data);
+                    });
+                }else {
+                    //企业账户
+                    bankInfoService.saveBuyEnterpriseBank({}, account, function(data) {
+                        toaster.pop('success', '保存成功','信息已添加');
+                        $scope.purKind = account.kind;
+                        getBuyAccount();
+                    }, function(res) {
+                        toaster.pop('error', '错误', res.data);
+                    });
+                }
+            }, function() {
+
+            });
+        };
+
+        $scope.deleteAccount = function(buyAccount) {
+            var  isSure = confirm('确认删除本银行账户?删除后无法恢复,请谨慎操作');
+            if(isSure){
+                bankInfoService.deleteBank({id: buyAccount.id}, function(data) {
+                    toaster.pop('success', '删除成功');
+                    getBuyAccount();
+                }, function(response) {
+                    toaster.pop('error', '删除失败');
+                })
+            }
+        }
+
+        // 确认订单
+        $scope.confirmOrder = function () {
+            var saleAccount = angular.copy($scope.saleAccount);
+            delete saleAccount.filterAccount;
+            var jsonReceive = angular.toJson(saleAccount);
+            var transfer = {};
+            transfer.jsonReceive = jsonReceive;
+            bankTransferService.saveTransfer({order: $scope.orderNum.split(',').join('-')}, transfer, function(data) {
+                toaster.pop('success', '信息保存成功');
+                $state.go('buyer_order');
+            }, function(response) {
+                toaster.pop("error", '失败', '信息保存失败:' + response.data);
+            });
+        };
+        $scope.confirm = function() {
+            var imageArray = [];
+            for (var i = 0; i< $scope.imagesList.length; i++) {
+                imageArray.push($scope.imagesList[i].imageUrl)
+                console.log($scope.imagesList[i].imageUrl)
+            }
+            var str = imageArray.join(",");
+            if(angular.isUndefined($scope.orderNum) || angular.equals($scope.orderNum,'') || angular.equals($scope.$$bankTransfer.total, 0)) {
+                toaster.pop('info', '提示', '没有选择要付款的订单,或付款总额为0');
+                return ;
+            }
+            if(angular.isUndefined($scope.buyAccount)||angular.equals("{}", angular.toJson($scope.buyAccount))) {
+                toaster.pop('info', '提示', '请选择买家账户');
+                return ;
+            }
+            if(angular.isUndefined($scope.saleAccount)||angular.equals("{}", angular.toJson($scope.saleAccount))) {
+                toaster.pop('info', '提示', '请选择卖家账户');
+                return ;
+            }
+            if(!str){
+                toaster.pop('info', '提示', '请选择付款截图');
+                return ;
+            }
+            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.imagesList;
+            console.log(transfer.imgUrl);
+            transfer.type = $scope.type;
+            // transfer.transferTime = $scope.transferTime.getTime();
+            transfer.total = $scope.$$bankTransfer.total;
+            bankTransferService.saveTransfer({order: $scope.orderNum.split(',').join('-')}, transfer, function(data) {
+                toaster.pop('success', '信息保存成功');
+                $state.go('buyer_order');
+            }, function(response) {
+                toaster.pop("error", '失败', '信息保存失败:' + response.data);
+            });
+        }
+
+        $scope.buyExpose = false;
+        $scope.salexpose = false;
+        //expose代表展开的状态,isBuyd代表当前操作的数据
+        $scope.doExpose = function(expose, isBuy) {
+            if(isBuy) {
+                $scope.buyExpose = expose;
+            }else {
+                $scope.salexpose = expose;
+            }
+        }
+
+        // /**
+        //  * 上传付款截图
+        //  */
+        // $scope.onUploadPayment = function ($data) {
+        //     if (!$data || !$data.path) {
+        //         toaster.pop('error', '付款截图上传失败');
+        //         return ;
+        //     }
+        //     $scope.imageUrl = $data.path;
+        // };
+
+        $scope.select = function(account, isBuy) {
+            if(isBuy) {
+                $scope.buyAccount = account;
+            }else {
+                $scope.saleAccount = account;
+            }
+        }
+
+        //获取当前时间
+        var getTodayDate = function(){
+            var date = new Date();
+            $scope.maxDate = date;
+        };
+        getTodayDate();
+    }]);
+
+    app.register.controller('timeCtrl', ['$scope', '$modalInstance', function($scope, $modalInstance) {
+        $scope.time = 5;
+        var setTime = function() {
+            if($scope.time > 0) {
+                setTimeout(function() {
+                    $scope.$apply(function() {
+                        $scope.time--;
+                        setTime();
+                    });
+                }, 1000);
+            }else {
+                $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) {
+            $scope.eidt = true;
+        } else {
+            delete $scope.eidt;
+        }
+        $scope.kind = kind;
+
+        if($scope.account) {
+            $scope.title = "修改账户";
+        }else {
+            $scope.title = "新增账户";
+            $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};
+        // 图片上传成功之后
+        $scope.onUploadSuccess = function(data){
+            var path = data.path;
+            path = path.substring(0, path.lastIndexOf('.')) + "_150x90" + path.substr(path.lastIndexOf('.'));
+            $scope.$apply(function(){
+                $scope.image.src = data.path;
+                $scope.image.thumb = path;
+            });
+        };
+
+        $scope.close = function() {
+            $modalInstance.dismiss();
+            SmoothScroll.scrollTo(null, 'O', -68);
+        };
+
+        $scope.confirm = function() {
+            $modalInstance.close($scope.image);
+            $scope.imageUrl = null;
+            SmoothScroll.scrollTo(null, 'O', -68);
+        };
     }]);
-})
+});

+ 129 - 45
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_transfer_ctrl.js

@@ -3,6 +3,8 @@ 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();
 
+		$scope.type = "PAIDTOPLATFORM";
+
 		if($stateParams.orderid) {
 			Order.get({orderid : $stateParams.orderid}, function(data) {
 				console.log(data);
@@ -21,7 +23,85 @@ define([ 'app/app' ], function(app) {
 		}else {
 			$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.addUploadImg = function () {
+			$scope.imagesList.push({imageUrl: ''})
+		};
+		// 删除图片
+		$scope.deleteProofInfo = function (index) {
+			$scope.imagesList[index] = {};
+		};
+		/**
+		 * 上传付款截图
+		 */
+		$scope.onUploadPayment = function ($data, index) {
+			if (!$data || !$data.path) {
+				toaster.pop('error', '付款截图上传失败');
+				return ;
+			}
+			$scope.imageUrl = $data.path;
+			$scope.imagesList[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.purKind = $rootScope.userInfo.enterprises ? false : true;//应付账户的类别, 默认是企业
 		$scope.saleKind = false;//应收账户的类别,默认是企业
 		var ids=SessionService.get("ids");
@@ -167,33 +247,33 @@ define([ 'app/app' ], function(app) {
 			$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() {
@@ -381,6 +461,12 @@ define([ 'app/app' ], function(app) {
 		}
 		
 		$scope.confirm = function() {
+			var imageArray = [];
+			for (var i = 0; i< $scope.imagesList.length; i++) {
+				imageArray.push($scope.imagesList[i].imageUrl)
+				console.log($scope.imagesList[i].imageUrl)
+			}
+			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,11 +479,7 @@ define([ 'app/app' ], function(app) {
 				toaster.pop('info', '提示', '请选择卖家账户');
 				return ;
 			}
-			if(!$scope.transferTime) {
-				toaster.pop('info', '提示', '请选择付款日期');
-				return ;
-			}
-			if(!$scope.imageUrl){
+			if(!str){
                 toaster.pop('info', '提示', '请选择付款截图');
                 return ;
             }
@@ -410,8 +492,10 @@ define([ 'app/app' ], function(app) {
 			var transfer = {};
 			transfer.jsonPament = jsonPament;
 			transfer.jsonReceive = jsonReceive;
-			transfer.imgUrl = $scope.imageUrl;
-			transfer.transferTime = $scope.transferTime.getTime();
+			transfer.imgUrl = $scope.imagesList;
+			console.log(transfer.imgUrl);
+			transfer.type = $scope.type;
+			// transfer.transferTime = $scope.transferTime.getTime();
 			transfer.total = $scope.$$bankTransfer.total;
 			bankTransferService.saveTransfer({order: $scope.orderNum.split(',').join('-')}, transfer, function(data) {
 				toaster.pop('success', '信息保存成功');
@@ -432,16 +516,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) {
@@ -515,7 +599,7 @@ define([ 'app/app' ], function(app) {
 		$scope.cancel = function() {
 			$modalInstance.dismiss();
 		}
-		
+
 	}]);
 	
 	app.register.controller('ImageInsertCtrl', ['$scope', '$modalInstance', 'SmoothScroll', function($scope, $modalInstance, SmoothScroll) {

+ 6 - 1
src/main/webapp/resources/js/usercenter/controllers/forstore/order_pay_ctrl.js

@@ -275,7 +275,12 @@ define(['app/app'], function(app) {
 						if ($scope.order.currency == 'RMB' && $scope.order.paytype == '1102') {
 							paymentEnsure(arr);
 						} else if($scope.order.paytype == '1103') {
-							$state.go('order_transfer', {orderid : enIdFilter(arr.join('-'))});
+							console.log(arr.length)
+							if(arr.length != 1){
+								$state.go('downPayment', {orderid : enIdFilter(arr.join('-'))});
+							}else {
+								$state.go('order_transfer', {orderid : enIdFilter(arr.join('-'))});
+							}
 						}else {
 							toaster.pop('info', '美元请线下付款');
 							$state.go('buyer_order');

+ 34 - 8
src/main/webapp/resources/js/vendor/controllers/forstore/purchase_detail.js

@@ -49,11 +49,24 @@ define(['app/app'], function(app) {
 		$scope.isShow = false;
 		$scope.switchToggle = function () {
 			$scope.isShow = !$scope.isShow;
+			// 验证是否能启用分期信息
+			Installment.validationCount({purchaseId : $scope.purchase.id}, null, function () {
+				
+			}, function (response) {
+				toaster.pop('error', response.data);
+			});
+		};
+		$scope.numArray = {
+			'1': '一',
+			'2': '二',
+			'3': '三',
+			'4': '四',
+			'5': '五'
 		};
 		// 新增一条分期付款
-		$scope.installmentDetails  = [{price: '',deadline: '','detno': 1, 'deadlineShow': false}];
+		$scope.installmentDetails  = [{price: '','detno': 1, 'deadlineShow': false}];
 		$scope.addInstallment = function () {
-			$scope.installmentDetails .push({price: '',deadline: '','detno': $scope.installmentDetails.length + 1, 'deadlineShow': false});
+			$scope.installmentDetails .push({price: '','detno': $scope.installmentDetails.length + 1, 'deadlineShow': false});
 		};
 		// 删除一条分期付款
 		$scope.deleteInstallment = function (index) {
@@ -61,7 +74,6 @@ define(['app/app'], function(app) {
 			for (var i = index; i < $scope.installmentDetails.length; i++){
 				$scope.installmentDetails[i].detno -= 1;
 			}
-			console.log($scope.installmentDetails)
 		};
 
 		// 打开日期选择框
@@ -83,11 +95,11 @@ define(['app/app'], function(app) {
 			}
 		};
 		// 时期
-		// $scope.changeBlurDeadline = function (item, index) {
-		// 	if (item.deadline.getTime() < item[index-1].deadline.getTime()) {
-		// 		toaster.pop('warning', '提示', '付款时间后一期须大于前一期');
-		// 	}
-		// };
+		$scope.changeBlurDeadline = function (item, index) {
+			if (item.deadline && item.deadline.getTime() < $scope.installmentDetails[index-1].deadline.getTime()) {
+				toaster.pop('warning', '提示', '付款时间后一期须大于前一期');
+			}
+		};
 		$scope.totalPrice = 0;
 		$scope.totalNum = function () {
 			$scope.totalPrice = 0;
@@ -173,6 +185,17 @@ define(['app/app'], function(app) {
 				toaster.pop('error', response.data);
 			});
 		}
+		// 编辑新增一条数据
+		$scope.addInstallmentList = function () {
+			$scope.purchase.installment.installmentDetails.push({price: '',deadline: '','detno': $scope.purchase.installment.installmentDetails.length + 1, 'deadlineShow': false});
+		}
+		// 编辑删除数据一条数据
+		$scope.deleteInstallmentlist = function (index) {
+			$scope.purchase.installment.installmentDetails.splice(index, 1);
+			for (var i = index; i < $scope.purchase.installment.installmentDetails.length; i++){
+				$scope.purchase.installment.installmentDetails[i].detno -= 1;
+			}
+		}
 		/**
 		 * 确认当前采购单所属状态
 		 */
@@ -287,6 +310,9 @@ define(['app/app'], function(app) {
 				}
 				$scope.purchase = result.data;
 				$scope.purchase.installment = result.data.installment
+				if ($scope.purchase.installment) {
+					$scope.isShow = true;
+				}
 				if ($scope.purchase.installment) {
 					$scope.installmentBox = true
 				}else {

+ 11 - 12
src/main/webapp/resources/view/usercenter/forstore/buyer_down_payment.html

@@ -7,10 +7,9 @@
             <div class="common-title">订单号</div>
             <div class="order-list">
                 <ul>
-                    <li><a href=""><em>1</em>125963528469526354</a></li>
-                    <li><a href=""><em>2</em>125963528469526354</a></li>
-                    <li><a href=""><em>3</em>125963528469526354</a></li>
-                    <li><a href=""><em>4</em>125963528469526354</a></li>
+                    <li ng-repeat="list in orderList">
+                        <a href="user#/transfer/{{list}}" target="_blank"><em ng-bind="$index+1"></em>{{list}}</a>
+                    </li>
                 </ul>
             </div>
             <div class="common-title">收款账户</div>
@@ -18,29 +17,29 @@
                 <ul style="height: 80px">
                     <li>
                         <label class="check-act">
-                            <input type="radio" id="1" name="1" value="1"/>
-                            <label for="1"></label>
+                            <input type="radio" id="2" name="name" value="2" ng-checked="type == 'PAIDTOPLATFORM'"/>
+                            <label for="2"></label>
                             <em>平台代收</em>
                         </label>
-                        <div class="tip-content">
+                        <div class="tip-content" style="margin-right: 45px;">
                             <img src="static/img/common/notice-tip.png" />
-                            <div class="tip-content-01">
+                            <div class="tip-content-01" style="top: 33px;">
                                 选择【平台代收】,货款将由优软商城<br/>
                                 在银行开立的第三方账户暂为保管,待<br/>
                                 您确认收货后,优软商城再和卖家结清。
                             </div>
                         </div>
-                        <div>125963528469526354</div>
-                        <div>开户人名称</div>
+                        <div ng-bind="saleAccount.number">125963528469526354</div>
+                        <div ng-bind="saleAccount.accountname">开户人名称</div>
                     </li>
                 </ul>
             </div>
         </div>
         <div class="pay-price">
             <div class="row">
-                <div class="fr">总价: <em>¥521369.32</em></div>
+                <div class="fr">总价: <em>{{$$bankTransfer.total | number : 2 | currencySysmbol : $$bankTransfer.currency}}</em></div>
             </div>
-            <div class="row" style="margin-top: 12px;"><button>确认</button></div>
+            <div class="row" style="margin-top: 12px;" ng-click="confirmOrder()"><button>确认</button></div>
         </div>
     </div>
 </div>

+ 41 - 85
src/main/webapp/resources/view/usercenter/forstore/buyer_transfer.html

@@ -8,13 +8,13 @@
 				<ul>
 					<li>
 						<label class="check-act" style="margin-right: 64px;">
-							<input type="radio" id="1" name="1" value="1"/>
+							<input type="radio" id="1" name="1" checked/>
 							<label for="1"></label>
-							<em>中国银行</em>
+							<em ng-bind="buyAccount.bankname">中国银行</em>
 						</label>
-						<div>125963528469526354</div>
-						<div>开户人名称</div>
-						<div><button class="change-count">更换账户</button></div>
+						<div ng-bind="buyAccount.filterAccount">125963528469526354</div>
+						<div ng-bind="buyAccount.accountname">开户人名称</div>
+						<div><button class="change-count" ng-click="changebuyAccount(buyAccount.id)">更换账户</button></div>
 					</li>
 				</ul>
 			</div>
@@ -23,7 +23,7 @@
 				<ul class="payment-80">
 					<li>
 						<label class="check-act">
-							<input type="radio" id="2" name="name" value="2"/>
+							<input type="radio" id="2" name="name" value="2" ng-checked="type == 'PAIDTOPLATFORM'"/>
 							<label for="2"></label>
 							<em>平台代收</em>
 						</label>
@@ -35,12 +35,12 @@
 								您确认收货后,优软商城再和卖家结清。
 							</div>
 						</div>
-						<div>125963528469526354</div>
-						<div>开户人名称</div>
+						<div ng-bind="saleAccount.number">125963528469526354</div>
+						<div ng-bind="saleAccount.accountname">开户人名称</div>
 					</li>
-					<li>
+					<li ng-if="installmentId">
 						<label class="check-act">
-							<input type="radio" id="3" name="name" value="3"/>
+							<input type="radio" id="3" name="name" value="3" ng-checked="type == 'PAIDTOVENDOR'"/>
 							<label for="3"></label>
 							<em>付款给卖家</em>
 						</label>
@@ -59,8 +59,8 @@
 					</li>
 				</ul>
 			</div>
-			<div class="common-title margin-top-8">分期付款明细</div>
-			<div class="payment-detail">
+			<div class="common-title margin-top-8" ng-if="installmentId">分期付款明细</div>
+			<div class="payment-detail" ng-if="installmentId">
 				<ul>
 					<li>
 						<span>第一期</span>
@@ -82,7 +82,7 @@
 				</ul>
 			</div>
 			<div class="common-title margin-top-8">水单扫描件</div>
-			<div class="payment-upload-list">
+			<div class="payment-upload-list" ng-if="installmentId">
 				<div class="item">
 					<div class="img-list">
 						<div class="prev"><i class="fa fa-angle-left"></i></div>
@@ -138,32 +138,27 @@
 			</div>
 			<div class="payment-upload">
 				<ul>
-					<li>
+					<li ng-repeat="images in imagesList">
 						<div class="upload">
-							<div class="img">
-								<img src="static/img/icon/payment-upload.png">
+							<div class="img" image-upload data-src="static/img/icon/payment-upload.png" on-success="onUploadPayment($data, $index)">
 							</div>
-							<div class="hover-show">
-								<span class="delete" title="删除"><i class="fa fa-trash"></i></span>
+							<div class="hover-show" ng-if="images.imageUrl">
+								<span class="delete" title="删除" ng-click="deleteProofInfo($index)"><i class="fa fa-trash"></i></span>
 								<!-- 图片预览 -->
-								<a ng-click=""><i class="fa fa-search"></i>查看</a>
+								<a ng-click="showImg(images.imageUrl)"><i class="fa fa-search"></i>查看</a>
 							</div>
 						</div>
-						<div class="price">
+						<div class="price" ng-if="installmentId">
 							<em>$</em>
 							<input type="text" class="form-control"  placeholder="请输入金额"/>
 						</div>
 					</li>
-					<li>
+					<li ng-click="addUploadImg()" ng-if="imagesList.length < 6">
 						<div class="upload">
 							<div class="img">
 								<img src="static/img/icon/payment-add.png">
 							</div>
 						</div>
-						<!--<div class="price">-->
-							<!--<em>$</em>-->
-							<!--<input type="text" class="form-control"  placeholder="请输入金额"/>-->
-						<!--</div>-->
 					</li>
 				</ul>
 				<div class="img-specifications">仅支持JPG、PNG、GIF、PDF格式,每张大小不超过3M,每期最多可上传6张图片</div>
@@ -172,14 +167,14 @@
 		<div class="pay-price">
 			<div class="stage row">
 				<div class="content">
-					<p><span>已支付:</span><em>¥500</em></p>
-					<p><span>待支付:</span><em class="bule">¥513131.32</em></p>
-					<p class="total"><span>总价:</span><em class="red">¥513131.32</em></p>
+					<p ng-if="installmentId"><span>已支付:</span><em>¥500</em></p>
+					<p ng-if="installmentId"><span>待支付:</span><em class="bule">¥513131.32</em></p>
+					<p class="total"><span>总价:</span><em class="red">{{$$bankTransfer.total | number : 2 | currencySysmbol : $$bankTransfer.currency}}</em></p>
 				</div>
 			</div>
 			<div class="row" style="margin-top: 0;">
 				<div class="deal-btn">
-					<a ng-click="" class="ok">确认</a>
+					<a ng-click="confirm()" class="ok">确认</a>
 					<a ng-click="" class="off">取消</a>
 				</div>
 			</div>
@@ -187,71 +182,26 @@
 	</div>
 </div>
 <!--更换账户-->
-<div class="change-count-box" style="display: none;">
+<div class="change-count-box" ng-if="changebuyAccountBox">
 	<div class="content-box">
 		<div class="head">
-			<a ng-click="">&times</a>
+			<a ng-click="cancelChange()">&times</a>
 		</div>
 		<div class="content-table">
 			<ul>
-				<li>
-					<label class="check-act">
-						<input type="radio" id="01" name="name01"/>
-						<label for="01"></label>
-						<em>中国银行</em>
-					</label>
-					<span class="width150">125963528469526354</span>
-					<span class="width80">开户人名称</span>
-				</li>
-				<li>
-					<label class="check-act">
-						<input type="radio" id="02" name="name01"/>
-						<label for="02"></label>
-						<em>中国银行</em>
-					</label>
-					<span class="width150">125963528469526354</span>
-					<span class="width80">开户人名称</span>
-				</li>
-				<li>
+				<li ng-repeat="item in buyAccountInfos">
 					<label class="check-act">
-						<input type="radio" id="03" name="name01"/>
-						<label for="03"></label>
-						<em>中国银行</em>
+						<input type="radio" id="{{item.id}}" name="name01" ng-click="selectItem(item)" ng-checked="isFalse || item.id == buyAccount.id"/>
+						<label for="{{item.id}}"></label>
+						<em ng-bind="item.bankname">中国银行</em>
 					</label>
-					<span class="width150">125963528469526354</span>
-					<span class="width80">开户人名称</span>
-				</li>
-				<li>
-					<label class="check-act">
-						<input type="radio" id="04" name="name01"/>
-						<label for="04"></label>
-						<em>中国银行</em>
-					</label>
-					<span class="width150">125963528469526354</span>
-					<span class="width80">开户人名称</span>
-				</li>
-				<li>
-					<label class="check-act">
-						<input type="radio" id="05" name="name01"/>
-						<label for="05"></label>
-						<em>中国银行</em>
-					</label>
-					<span class="width150">125963528469526354</span>
-					<span class="width80">开户人名称</span>
-				</li>
-				<li>
-					<label class="check-act">
-						<input type="radio" id="06" name="name01"/>
-						<label for="06"></label>
-						<em>中国银行</em>
-					</label>
-					<span class="width150">125963528469526354</span>
-					<span class="width80">开户人名称</span>
+					<span class="width150" ng-bind="item.filterAccount">125963528469526354</span>
+					<span class="width80" ng-bind="item.accountname">开户人名称</span>
 				</li>
 			</ul>
 			<div class="deal-btn">
-				<a ng-click="" class="off">取消</a>
-				<a ng-click="" class="ok">确认</a>
+				<a ng-click="cancelChange()" class="off">取消</a>
+				<a ng-click="confirmChange()" class="ok">确认</a>
 			</div>
 		</div>
 	</div>
@@ -318,6 +268,12 @@
 	top: 6px;
 	margin-right: 5px;
 }
+.change-count-box .content-box .content-table ul li .check-act{
+	width: 130px;
+	overflow: hidden;
+	text-overflow: ellipsis;
+	white-space: nowrap;
+}
 .change-count-box .content-box .content-table ul li span{
 	display: inline-block;
 	overflow: hidden;
@@ -326,7 +282,7 @@
 	line-height: 34px;
 }
 .change-count-box .content-box .content-table ul li span.width150{
-	width: 150px;
+	width: 90px;
 	margin: 0 30px;
 }
 .change-count-box .content-box .content-table ul li span.width80{

+ 7 - 3
src/main/webapp/resources/view/vendor/forstore/purchase_detail.html

@@ -653,7 +653,7 @@
 				<div class="content-box" ng-if="isShow">
 					<ul>
 						<li ng-repeat="item in purchase.installment.installmentDetails" class="line" ng-if="installmentBox">
-							<span>第{{$index+1}}期</span>
+							<span>第{{numArray[$index+1]}}期</span>
 							<span class="price" ng-if="!editBox">
 								<p ng-bind="item.price | currencySysmbol : purchase.currency"></p>
 							</span>
@@ -677,6 +677,10 @@
 								/>
 								<button class="open" ng-click="openDatePicker($event, item, 'deadlineShow')"></button>
 							</span>
+							<span class="add-span" ng-if="editBox">
+								<button class="add" ng-click="addInstallmentList()" ng-if="purchase.installment.installmentDetails.length-1 ==$index && $index+1 < 5"><i class="fa fa-plus-circle"></i></button>
+								<button class="reduce" ng-click="deleteInstallmentlist($index)" ng-if="purchase.installment.installmentDetails.length-1 !=$index"><i class="fa fa-minus-circle"></i></button>
+							</span>
 							<em class="show-img" ng-if="item.status == 504 || item.status == 505"><img src="static/img/icon/pay-ok-icon.png"/></em>
 							<span class="deal-btn" ng-if="purchase.installment.status == 503">
 								<button ng-click="editInstallment()" ng-if="purchase.installment.installmentDetails.length == $index+1 && !editBox" class="ok" style="float: right;">编辑</button>
@@ -685,7 +689,7 @@
 							</span>
 						</li>
 						<li ng-repeat="item in installmentDetails" class="line" ng-if="!installmentBox">
-							<span>第{{$index+1}}期</span>
+							<span>第{{numArray[$index+1]}}期</span>
 							<span class="price">
 								<em ng-bind="purchase.currency == RMB ? '$' : '¥'"></em>
 								<input type="text" class="form-control"  placeholder="请输入金额" ng-model="item.price" ng-blur="changeInstallmentPrice(item.price)"/>
@@ -699,7 +703,7 @@
 									   min-date="startDate" current-text="今天" clear-text="清除" close-text="关闭"
 									   ng-click="openDatePicker($event, item, 'deadlineShow')"
 									   datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
-									   ng-change="changeEndDate()" ng-blur="changeBlurDeadline(item, $index+1)"
+									   ng-change="changeEndDate()" ng-blur="changeBlurDeadline(item, $index)"
 								/>
 								<button class="open" ng-click="openDatePicker($event, item, 'deadlineShow')"></button>
 							</span>