Browse Source

发货限制重复提交

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@9699 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 8 years ago
parent
commit
50fd501ed3

+ 28 - 16
src/main/webapp/resources/js/index/app.js

@@ -5426,31 +5426,42 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 
         $scope.lockstatus = false;
         // 锁定时间按钮5秒
-        $scope.lockClick = function() {
-            $scope.lockstatus = true;
-            $timeout(function() {
-                $scope.lockstatus = false;
-            }, 5000);
+        $scope.lockClick = function(notice) {
+        	if(!notice.send || !notice.send.qty || notice.send.qty > notice.qty - (notice.endQty || 0)) {
+			} else if(!notice.send.code) {
+			} else {
+				$scope.lockstatus = true;
+				$timeout(function() {
+					$scope.lockstatus = false;
+				}, 5000);
+			}
         };
 		
+        var isSumbit = false;
 		$scope.onReplyClick = function(notice) {
 			if(!notice.send || !notice.send.qty || notice.send.qty > notice.qty - (notice.endQty || 0)) {
 				toaster.pop('warning', '警告', '数量填写错误!');
 			} else if(!notice.send.code) {
 				toaster.pop('warning', '警告', '请填写发货单号!');
 			} else {
-				var send = {code: notice.send.code, remark: notice.send.remark, sendItems: [{qty: notice.send.qty}]};
-				$scope.loading = true;
-				PurcNotice.save({id: notice.id}, send, function(data){
-					$scope.loading = false;
-					toaster.pop('success', '提示', '发货成功,跳转至发货单:' + notice.send.code);
-					$state.go('sale.send_detail', {id: data.id});
-				}, function(response){
-					$scope.loading = false;
-					toaster.pop('error', '发货失败', response.data);
-				});
+				if(!isSumbit) {
+					var send = {code: notice.send.code, remark: notice.send.remark, sendItems: [{qty: notice.send.qty}]};
+					$scope.loading = true;
+					PurcNotice.save({id: notice.id}, send, function(data){
+						$scope.loading = false;
+						toaster.pop('success', '提示', '发货成功,跳转至发货单:' + notice.send.code);
+						$state.go('sale.send_detail', {id: data.id});
+					}, function(response){
+						$scope.loading = false;
+						toaster.pop('error', '发货失败', response.data);
+					});
+					isSumbit = true;
+					 return true;
+				} else {
+					 return false;
+				}
 			}
-		};
+		} 
 		
 		$scope.checkboxes = {
 			checked : false
@@ -5552,6 +5563,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			data &&	($scope.tableParams.reload());
 		}, true);
 	}]);
+	
 	app.controller('SaleNoticeSendByBatchCtrl', ['$scope', '$modalInstance', 'Symbol', 'selectedNotices', 'PurcNotice', 'toaster', '$state', function($scope, $modalInstance, Symbol, selectedNotices, PurcNotice, toaster, $state){
 		$scope.notices = angular.copy(selectedNotices);
 		$scope.currency = Symbol.currency;//将币别转化为对应的符号

+ 1 - 1
src/main/webapp/resources/tpl/index/sale/notice.html

@@ -465,7 +465,7 @@
 						</div>
 						<br>
 						<div>
-							<a ng-click="lockClick();onReplyClick(notice);" ng-disabled="lockstatus" class="btn btn-link btn-xs text-inverse">确认发货</a>
+							<a ng-click="lockClick(notice);onReplyClick(notice);" ng-disabled="lockstatus" class="btn btn-link btn-xs text-inverse">确认发货</a>
 						</div>
 					</div>
 				</div>