Browse Source

修改价格提示为blur事件,价格验证依然为change事件。

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@6963 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
dongbw 9 năm trước cách đây
mục cha
commit
b463c18929

+ 66 - 55
src/main/webapp/resources/js/index/app.js

@@ -2096,11 +2096,11 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 					$scope.canSave = false;
 				}
 			} else {
-				toaster.pop('warning','格式错误','请输入有效价格');
 				$scope.canSave = false;
 			}
 		}
 		
+		
 		// prod下prods价格验证
 		$scope.verifyProds = function(price, reply) {
 			var regex = /^(0|[1-9][0-9]{0,9})(\.[0-9]{1,6})?$/;//
@@ -2111,7 +2111,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 					$scope.canSave = false;
 				}
 			} else {
-				toaster.pop('warning','格式错误','请输入有效价格');
 				$scope.canSave = false;
 			}
 		}
@@ -2131,6 +2130,13 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			});
 		}
 		
+		$scope.blurPrice = function (price) {
+			var regex = /^(0|[1-9][0-9]{0,9})(\.[0-9]{1,6})?$/;
+			if (!regex.test(price)) {
+				toaster.pop('warning','格式错误','请输入有效价格');
+			}
+		}
+		
 		$scope.uploadAttach = function(mould) {
 //			var file = mould.attachFile.$viewValue, file = file && file.length > 0 ? file[0] : null;
 			var file = mould.attachs[0];
@@ -2155,22 +2161,22 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 		// 保存并确认报价
 		$scope.onReplyClick = function(mould, withSteps) {
 			$scope.loading = true;
-//			var file = mould.attachFile.$viewValue, file = file && file.length > 0 ? file[0] : null;
-			var file = mould.attachs[0];
-			$scope.mould  = mould;
-			$upload.upload({
-				url: 'sale/mould/' + mould.id + '/send',
-				method: 'POST',
-				file: file,
-				data: {
-					json: $scope.mould
-				}
-			}).success(function(res){
-				console.log("success");
-				console.log(res);
-			}).error(function(res){
-				console.log("failure");
-			});
+////			var file = mould.attachFile.$viewValue, file = file && file.length > 0 ? file[0] : null;
+//			var file = mould.attachs[0];
+//			$scope.mould  = mould;
+//			$upload.upload({
+//				url: 'sale/mould/' + mould.id + '/send',
+//				method: 'POST',
+//				file: file,
+//				data: {
+//					json: $scope.mould
+//				}
+//			}).success(function(res){
+//				console.log("success");
+//				console.log(res);
+//			}).error(function(res){
+//				console.log("failure");
+//			});
 			
 			if(withSteps) {
 				PurcInquiryMould.reply({id: mould.id}, mould, function(){
@@ -2205,7 +2211,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 	}]);
 		
 	
-	// 模具询价单明细
+	//TODO 模具询价单明细
 	app.controller('SaleInquiryMouldDetailCtrl', ['$scope', '$stateParams', 'PurcInquiryMould','$filter', 'toaster','$upload', function($scope, $stateParams, PurcInquiryMould, $filter, toaster, $upload){
 		
 		var inquiryMould_copy = {};
@@ -2249,6 +2255,13 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			});
 		}
 		
+		$scope.blurPrice = function (price) {
+			var regex = /^(0|[1-9][0-9]{0,9})(\.[0-9]{1,6})?$/;
+			if (!regex.test(price)) {
+				toaster.pop('warning','格式错误','请输入有效价格');
+			}
+		}
+		
 		$scope.canSave = false;
 		
 		// items价格验证
@@ -2262,7 +2275,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 					$scope.canSave = false;
 				}
 			} else {
-				toaster.pop('warning','格式错误','请输入有效价格');
 				$scope.canSave = false;
 			}
 		}
@@ -2278,49 +2290,48 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 					$scope.canSave = false;
 				}
 			} else {
-				toaster.pop('warning','格式错误','请输入有效价格');
 				$scope.canSave = false;
 			}
 		}
 		
-		// 上传附件
-		$scope.uploadAttach = function(mould) {
-//			var file = mould.attachFile.$viewValue, file = file && file.length > 0 ? file[0] : null;
-			var file = mould.attachs[0];
-			$scope.mould  = mould;
-			$upload.upload({
-				url: 'sale/mould/' + mould.id + '/send',
-				method: 'POST',
-				file: file,
-				data: {
-					json: $scope.mould
-				}
-			}).success(function(res){
-				console.log("success");
-				console.log(res);
-			}).error(function(res){
-				console.log("failure");
-				console.log(res);
-			});
-		}
+//		// 上传附件
+//		$scope.uploadAttach = function(mould) {
+////			var file = mould.attachFile.$viewValue, file = file && file.length > 0 ? file[0] : null;
+//			var file = mould.attachs[0];
+//			$scope.mould  = mould;
+//			$upload.upload({
+//				url: 'sale/mould/' + mould.id + '/send',
+//				method: 'POST',
+//				file: file,
+//				data: {
+//					json: $scope.mould
+//				}
+//			}).success(function(res){
+//				console.log("success");
+//				console.log(res);
+//			}).error(function(res){
+//				console.log("failure");
+//				console.log(res);
+//			});
+//		}
 		
 		
 		$scope.onReplyClick = function(mould, withSteps) {
 			$scope.loading = true;
-			var file = mould.attachs[0];
-			$scope.mould  = mould;
-			$upload.upload({
-				url: 'sale/mould/' + mould.id + '/send',
-				method: 'POST',
-				file: file,
-				data: {
-					json: $scope.mould
-				}
-			}).success(function(res){
-				
-			}).error(function(res){
-				console.log(res);
-			});
+//			var file = mould.attachs[0];
+//			$scope.mould  = mould;
+//			$upload.upload({
+//				url: 'sale/mould/' + mould.id + '/send',
+//				method: 'POST',
+//				file: file,
+//				data: {
+//					json: $scope.mould
+//				}
+//			}).success(function(res){
+//				
+//			}).error(function(res){
+//				console.log(res);
+//			});
 			
 			if(withSteps) {
 				PurcInquiryMould.reply({id: mould.id}, mould, function(){

+ 2 - 2
src/main/webapp/resources/tpl/index/sale/inquiry_mould.html

@@ -447,13 +447,13 @@ tbody td div.text-mould {
 					<div ng-repeat="items in inquiryMould.inquiryMouldItems">
 						<span ng-if="inquiryMould.currency == 'RMB'">¥</span>
 						<span ng-if="inquiryMould.currency == 'USD'">$</span>
-						<input type="text" class="text-right input-price input-xs" ng-model="items.price" placeholder="单价(请填数字)"
+						<input type="text" class="text-right input-price input-xs" ng-model="items.price" placeholder="单价(请填数字)" ng-blur="blurPrice(items.price)"
 							ng-change="verifyItems(items.price,items.reply);notZero(inquiryMould)" ng-disabled="!inquiryMould.$editing"/>
 						<!-- <span ng-show="canSave">{{inquiryMould_copy.inquiryMouldItems[$index].price}}</span> -->
 						<div ng-repeat="prod in items.inquiryMouldDetails">
 							<span ng-if="inquiryMould.currency == 'RMB'">¥</span>
 							<span ng-if="inquiryMould.currency == 'USD'">$</span>
-							<input type="text" class="text-right input-price input-xs" ng-model="prod.price" placeholder="单价(请填数字)"
+							<input type="text" class="text-right input-price input-xs" ng-model="prod.price" placeholder="单价(请填数字)" ng-blur="blurPrice(prod.price)"
 								ng-change="verifyProds(prod.price,prod.reply);notZero(inquiryMould)" ng-disabled="!inquiryMould.$editing"/>
 							<!-- <span ng-show="canSave">{{inquiryMould_copy.inquiryMouldItems[$parent.$index].inquiryMouldDetails[$index].price}}</span> -->
 						</div>

+ 22 - 2
src/main/webapp/resources/tpl/index/sale/inquiry_mould_detail.html

@@ -16,6 +16,26 @@ tbody td div.text-mould {
 div>div .btn-items {
 	margin: 10px;
 }
+
+tbody td .text-waiting {
+	position: absolute;
+    top: 5px;
+    background-color: #fff;
+    border: 1px solid;
+    padding: 3px 14px;
+    font-size: 16px;
+    font-family: "LiShu";
+    border-radius: 10px;
+    -moz-transform: rotate(-10deg);
+    -webkit-transform: rotate(-10deg);
+    -o-transform: rotate(-10deg);
+    transform: rotate(-10deg);
+    border-radius: 10px;
+    opacity: 0.7;
+    white-space: nowrap;
+	color: #56a022;
+	border-color: #56a022;
+}
 </style>
 <div class="pane base-info">
 	<div class="pane-header">
@@ -121,13 +141,13 @@ div>div .btn-items {
 							<div ng-repeat="items in inquiryMould.inquiryMouldItems">
 								<span ng-if="inquiryMould.currency == 'RMB'">¥</span>
 								<span ng-if="inquiryMould.currency == 'USD'">$</span>
-								<input type="text" class="text-right input-price input-xs" ng-model="items.price" placeholder="单价(请填数字)"
+								<input type="text" class="text-right input-price input-xs" ng-model="items.price" placeholder="单价(请填数字)" ng-blur="blurPrice(items.price)"
 									ng-change="verifyItems(items.price,$index);notZero(inquiryMould)" ng-disabled="!inquiryMould.$editing"/>
 								<!-- <span ng-show="canSave">{{inquiryMould_copy.inquiryMouldItems[$index].price}}</span> -->
 								<div ng-repeat="prod in items.inquiryMouldDetails">
 									<span ng-if="inquiryMould.currency == 'RMB'">¥</span>
 									<span ng-if="inquiryMould.currency == 'USD'">$</span>
-									<input type="text" class="text-right input-price input-xs" ng-model="prod.price" placeholder="单价(请填数字)"
+									<input type="text" class="text-right input-price input-xs" ng-model="prod.price" placeholder="单价(请填数字)" ng-blur="blurPrice(prod.price)"
 										ng-change="verifyProds(prod.price,$index,$parent.$index);notZero(inquiryMould)" ng-disabled="!inquiryMould.$editing"/>
 									<!-- <span ng-show="canSave">{{inquiryMould_copy.inquiryMouldItems[$parent.$index].inquiryMouldDetails[$index].price}}</span> -->
 								</div>