Parcourir la source

세트수량 변경시 판매가 변경처리

eskim il y a 4 ans
Parent
commit
5355983730
1 fichiers modifiés avec 21 ajouts et 3 suppressions
  1. 21 3
      src/main/webapp/WEB-INF/views/goods/GoodsSetForm.html

+ 21 - 3
src/main/webapp/WEB-INF/views/goods/GoodsSetForm.html

@@ -135,7 +135,10 @@
 		{headerName: "구성상품코드", field: "compsGoodsCd" , width: 130, cellClass: 'text-center'},
 		{headerName: "구성상품명", field: "goodsNm" , width: 200, cellClass: 'text-left'},
 		//{headerName: "순서", field: "dispOrd" , width: 100, cellClass: 'text-center',editable: true, required: true},
-		{headerName: "세트구성수량", field: "qty" , width: 120, cellClass: 'text-right',editable: true, required: true},
+		{headerName: "세트구성수량", field: "qty" , width: 120, cellClass: 'text-right',editable: true, required: true,
+			cellEditor: 'textCellEditor',
+			cellEditorParams: { maxlength: 14, validType: 'numeric'}
+		},
 		{headerName: "세트구성상품판매가", field: "compsCurrPrice" , width: 150, cellClass: 'text-right', editable: true, required: true,
 			cellEditor: 'textCellEditor',
 			cellEditorParams: { maxlength: 14, validType: 'numeric'}
@@ -179,7 +182,6 @@
 			return { background: '#ffffff' };
 		}	
 	}
-	
 
 	// Row 
 	gridGoodsSetOptions.onCellValueChanged = function(event) {
@@ -206,8 +208,24 @@
 			}	
 		}
 		
+		//세트구상상품판매가
 		if (event.colDef.field == "compsCurrPrice"){
-			var setGoodsCurrPrice = 0;
+			let setGoodsCurrPrice = 0;
+			
+			gridGoodsSetOptions.api.forEachNode(function(rowNode, index) {
+				if (!gagajf.isNull(rowNode.data.compsCurrPrice)){
+					setGoodsCurrPrice += Number(rowNode.data.compsCurrPrice);
+				}
+			});
+			$('#goodsSetForm').find('#setGoodsCurrPrice').html(setGoodsCurrPrice.addComma());
+		}
+		
+		// 세트구성수량 수저시
+		if (event.colDef.field == "qty"){
+			event.data.compsCurrPrice = Number(event.data.qty) * Number(event.data.currPrice);
+			gridGoodsSetOptions.api.updateRowData({update: [event.data]});	
+			
+			let setGoodsCurrPrice = 0;
 			
 			gridGoodsSetOptions.api.forEachNode(function(rowNode, index) {
 				if (!gagajf.isNull(rowNode.data.compsCurrPrice)){