Browse Source

批量发货限制重复提交

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

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

@@ -5564,7 +5564,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 		}, true);
 		}, true);
 	}]);
 	}]);
 	
 	
-	app.controller('SaleNoticeSendByBatchCtrl', ['$scope', '$modalInstance', 'Symbol', 'selectedNotices', 'PurcNotice', 'toaster', '$state', function($scope, $modalInstance, Symbol, selectedNotices, PurcNotice, toaster, $state){
+	app.controller('SaleNoticeSendByBatchCtrl', ['$scope', '$modalInstance', 'Symbol', 'selectedNotices', 'PurcNotice', 'toaster', '$state', '$timeout', function($scope, $modalInstance, Symbol, selectedNotices, PurcNotice, toaster, $state, $timeout){
 		$scope.notices = angular.copy(selectedNotices);
 		$scope.notices = angular.copy(selectedNotices);
 		$scope.currency = Symbol.currency;//将币别转化为对应的符号
 		$scope.currency = Symbol.currency;//将币别转化为对应的符号
 		$scope.saleSend = {
 		$scope.saleSend = {
@@ -5600,6 +5600,20 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			$scope.notices.splice(index, 1);
 			$scope.notices.splice(index, 1);
 		};
 		};
 		
 		
+		$scope.lockstatus = false;
+        // 锁定时间按钮5秒
+        $scope.lockClick = function(notice) {
+        	if($scope.saleSend.code == '') {//送货单号为空
+				return;
+			}else {
+				$scope.lockstatus = true;
+				$timeout(function() {
+					$scope.lockstatus = false;
+				}, 5000);
+			}
+        };
+        
+		var isSumbit = false;
 		//确认送货
 		//确认送货
 		$scope.sendByBatch = function () {
 		$scope.sendByBatch = function () {
 			$scope.saleSend.sendItems = [];
 			$scope.saleSend.sendItems = [];
@@ -5630,13 +5644,19 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			if(!valid) {
 			if(!valid) {
 				toaster.pop('error', '错误', '只有客户一致、币别一致、付款方式一致才能一起发货。');
 				toaster.pop('error', '错误', '只有客户一致、币别一致、付款方式一致才能一起发货。');
 			} else {
 			} else {
-				PurcNotice.sendByBatch({}, $scope.saleSend, function(data){
-					toaster.pop('success', '提示', '发货成功,跳转至发货单:' + $scope.saleSend.code);
-					$modalInstance.close('success');
-					$state.go('sale.send_detail', {id: data.id});
-				}, function(response){
-					toaster.pop('error', '错误', response.data);
-				});
+				if(!isSumbit) {
+					PurcNotice.sendByBatch({}, $scope.saleSend, function(data){
+						toaster.pop('success', '提示', '发货成功,跳转至发货单:' + $scope.saleSend.code);
+						$modalInstance.close('success');
+						$state.go('sale.send_detail', {id: data.id});
+					}, function(response){
+						toaster.pop('error', '错误', response.data);
+					});
+					isSumbit = true;
+					return true;
+				} else {
+					return false;
+				}
 			}
 			}
   		};
   		};
 
 

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

@@ -86,7 +86,7 @@
 					class="text-num text-bold" ng-bind="total | number:2"></span></li>
 					class="text-num text-bold" ng-bind="total | number:2"></span></li>
 			</ul>
 			</ul>
 		</div>
 		</div>
-		<button class="btn btn-primary" ng-click="sendByBatch()" type="button">确认发货</button>
+		<button class="btn btn-primary" ng-click="lockClick();sendByBatch()" type="button">确认发货</button>
 		<button class="btn btn-warning" ng-click="cancel()" type="button">取消</button>
 		<button class="btn btn-warning" ng-click="cancel()" type="button">取消</button>
 	</div>
 	</div>
 </form>
 </form>