Ver Fonte

[ST24PRJ-461][결함][FRONT][주문서] 배송지 등록시 휴대폰번호 연속번호 등록시 오류

card007 há 4 anos atrás
pai
commit
58fd69e433

+ 14 - 5
src/main/webapp/WEB-INF/views/mob/popup/DelvAddrAddPopMob.html

@@ -175,6 +175,14 @@ $("#btn_delivery_addr_save").on("click", function(){
 	
 	var recipPhnno = fnPhnnoSet($("#deliveryAddForm input[name=recipPhnno]").val());
 	
+	// 전화번호 유효성 검증 추가
+	let regExp = /^(050[0-9]|01[016789]|02|0[3-9][0-9])-?[0-9]{3,4}-?[0-9]{4}$/;
+	if (!regExp.test(recipPhnno)) {
+		mcxDialog.alert("휴대폰번호를 정확히 입력해주세요.");
+		$('#deliveryAddForm input[name=recipPhnno]').focus();
+		return false;
+	}
+	
 	// custDelvAddrSq 부모창으로 전달
 	var delvObj = {
 		"custDelvAddrSq"	: 0
@@ -225,26 +233,27 @@ $("#btn_delivery_addr_save").on("click", function(){
 
 // 유효성체크 함수
 var deliveryAddFormCheck = function() {
-	// TODO 유효성 체크 추가
+	let phnno = $('#deliveryAddForm input[name=recipPhnno]').val();
+
 	if (gagajf.isNull($("#deliveryAddForm input[name=recipNm]").val())) {
 		mcxDialog.alert("받는분을 입력해주세요.");
 		$('#deliveryAddForm input[name=custNm]').focus();
 		return false;
 	}
 	
-	if (gagajf.isNull($("#deliveryAddForm input[name=recipPhnno]").val())) {
+	if (gagajf.isNull(phnno)) {
 		mcxDialog.alert("휴대폰번호를 입력해주세요.");
 		$('#deliveryAddForm input[name=recipPhnno]').focus();
 		return false;
 	}
 
-	if ($("#deliveryAddForm input[name=recipPhnno]").val().length < 9) {
+	if (phnno.length < 9) {
 		mcxDialog.alert("휴대폰번호를 정확히 입력해주세요.");
 		$('#deliveryAddForm input[name=recipPhnno]').focus();
 		return false;
 	}
 	
-	if ($("#deliveryAddForm input[name=recipPhnno]").val().length > 12) {
+	if (phnno.length > 12) {
 		mcxDialog.alert("휴대폰번호를 정확히 입력해주세요.");
 		$('#deliveryAddForm input[name=recipPhnno]').focus();
 		return false;
@@ -293,7 +302,7 @@ var fnOpenDaumAddr = function() {
 
 // 하이픈처리
 var fnPhnnoSet = function(str) {
-	var rtnStr = str.replace(/[^0-9]/g, "").replace(/(^02|^0505|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3").replace("--", "-");
+	var rtnStr = str.replace(/[^0-9]/g, "").replace(/(^02|^050[0-9]|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3").replace("--", "-");
 	return rtnStr;
 }
 

+ 14 - 5
src/main/webapp/WEB-INF/views/mob/popup/DelvAddrModifyPopMob.html

@@ -209,6 +209,14 @@ $("#btn_delivery_modi_save").on("click", function(){
 	
 	var recipPhnno = fnPhnnoSet($("#deliveryModifyForm input[name=recipPhnno]").val());
 	
+	// 전화번호 유효성 검증 추가
+	let regExp = /^(050[0-9]|01[016789]|02|0[3-9][0-9])-?[0-9]{3,4}-?[0-9]{4}$/;
+	if (!regExp.test(recipPhnno)) {
+		mcxDialog.alert("휴대폰번호를 정확히 입력해주세요.");
+		$('#deliveryModifyForm input[name=recipPhnno]').focus();
+		return false;
+	}
+	
 	// 배송지정보설정
 	var jsonObj = {
 		"defaultYn"			: defaultYn
@@ -257,25 +265,26 @@ $("#btn_delivery_modi_save").on("click", function(){
 
 // 유효성체크 함수
 var deliveryModifyFormCheck = function() {
-	// TODO 유효성 체크 추가
+	let phnno = $('#deliveryModifyForm input[name=recipPhnno]').val();
+
 	if (gagajf.isNull($("#deliveryModifyForm input[name=recipNm]").val())) {
 		mcxDialog.alert("받는분을 입력해주세요.");
 		$('#deliveryModifyForm input[name=custNm]').focus();
 		return false;
 	}
-	if (gagajf.isNull($("#deliveryModifyForm input[name=recipPhnno]").val())) {
+	if (gagajf.isNull(phnno)) {
 		mcxDialog.alert("휴대폰번호를 입력해주세요.");
 		$('#deliveryModifyForm input[name=recipPhnno]').focus();
 		return false;
 	}
 
-	if ($("#deliveryModifyForm input[name=recipPhnno]").val().length < 9) {
+	if (phnno.length < 9) {
 		mcxDialog.alert("휴대폰번호를 정확히 입력해주세요.");
 		$('#deliveryModifyForm input[name=recipPhnno]').focus();
 		return false;
 	}
 	
-	if ($("#deliveryModifyForm input[name=recipPhnno]").val().length > 12) {
+	if (phnno.length > 12) {
 		mcxDialog.alert("휴대폰번호를 정확히 입력해주세요.");
 		$('#deliveryModifyForm input[name=recipPhnno]').focus();
 		return false;
@@ -325,7 +334,7 @@ var fnOpenDaumAddr = function() {
 
 //하이픈처리
 var fnPhnnoSet = function(str) {
-	var rtnStr = str.replace(/[^0-9]/g, "").replace(/(^02|^0505|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3").replace("--", "-");
+	var rtnStr = str.replace(/[^0-9]/g, "").replace(/(^02|^050[0-9]|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3").replace("--", "-");
 	return rtnStr;
 }
 

+ 14 - 6
src/main/webapp/WEB-INF/views/web/popup/DelvAddrAddPopWeb.html

@@ -26,7 +26,7 @@
 					<label class="input_label sr-only">휴대폰 번호</label>
 					<div class="ui_col_12">
 						<div class="input_wrap"> 
-							<input type="text" name="recipPhnno" placeholder="휴대폰 번호" class="form_control" minlength="12" maxlength="13"/>
+							<input type="text" name="recipPhnno" placeholder="휴대폰 번호" class="form_control" minlength="11" maxlength="14"/>
 						</div>
 					</div>
 				</div>
@@ -191,26 +191,34 @@ $("#btn_delivery_addr_save").on("click", function(){
 
 // 유효성체크 함수
 var deliveryAddFormCheck = function() {
-	// TODO 유효성 체크 추가
+	let phnno = $('#deliveryAddForm input[name=recipPhnno]').val();
+	let regExp = /^(050[0-9]|01[016789]|02|0[3-9][0-9])-?[0-9]{3,4}-?[0-9]{4}$/;
+
 	if (gagajf.isNull($("#deliveryAddForm input[name=recipNm]").val())) {
 		mcxDialog.alert("받는분을 입력해주세요.");
 		$('#deliveryAddForm input[name=custNm]').focus();
 		return false;
 	}
 	
-	if (gagajf.isNull($("#deliveryAddForm input[name=recipPhnno]").val())) {
+	if (gagajf.isNull(phnno)) {
 		mcxDialog.alert("휴대폰번호를 입력해주세요.");
 		$('#deliveryAddForm input[name=recipPhnno]').focus();
 		return false;
 	}
 	
-	if ($("#deliveryAddForm input[name=recipPhnno]").val().length < 12) {
+	if (phnno.length < 11) {
+		mcxDialog.alert("휴대폰번호를 정확히 입력해주세요.");
+		$('#deliveryAddForm input[name=recipPhnno]').focus();
+		return false;
+	}
+	
+	if (phnno.length > 14) {
 		mcxDialog.alert("휴대폰번호를 정확히 입력해주세요.");
 		$('#deliveryAddForm input[name=recipPhnno]').focus();
 		return false;
 	}
 	
-	if ($("#deliveryAddForm input[name=recipPhnno]").val().length > 13) {
+	if (!regExp.test(phnno)) {
 		mcxDialog.alert("휴대폰번호를 정확히 입력해주세요.");
 		$('#deliveryAddForm input[name=recipPhnno]').focus();
 		return false;
@@ -254,7 +262,7 @@ var fnOpenDaumAddr = function() {
 
 // 2021.04.09 하이픈처리
 $(document).on("keyup", "#deliveryAddForm input[name=recipPhnno]", function() { 
-	$(this).val( $(this).val().replace(/[^0-9]/g, "").replace(/(^02|^0505|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3").replace("--", "-") ); 
+	$(this).val( $(this).val().replace(/[^0-9]/g, "").replace(/(^02|^050[0-9]|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3").replace("--", "-") ); 
 });
 </script>
 

+ 15 - 7
src/main/webapp/WEB-INF/views/web/popup/DelvAddrModifyPopWeb.html

@@ -33,7 +33,7 @@
 					<label class="input_label sr-only">휴대폰 번호</label>
 					<div class="ui_col_12">
 						<div class="input_wrap"> 
-							<input type="text" name="recipPhnno" placeholder="휴대폰 번호" class="form_control" minlength="12" maxlength="13" th:value="${deliveryAddrInfo.recipPhnno}"/>
+							<input type="text" name="recipPhnno" placeholder="휴대폰 번호" class="form_control" minlength="11" maxlength="14" th:value="${deliveryAddrInfo.recipPhnno}"/>
 						</div>
 					</div>
 				</div>
@@ -219,26 +219,34 @@ $("#btn_delivery_modi_save").on("click", function(){
 
 // 유효성체크 함수
 var deliveryModifyFormCheck = function() {
-	// TODO 유효성 체크 추가
+	let phnno = $('#deliveryModifyForm input[name=recipPhnno]').val();
+	let regExp = /^(050[0-9]|01[016789]|02|0[3-9][0-9])-?[0-9]{3,4}-?[0-9]{4}$/;
+
 	if (gagajf.isNull($("#deliveryModifyForm input[name=recipNm]").val())) {
 		mcxDialog.alert("받는분을 입력해주세요.");
 		$('#deliveryModifyForm input[name=custNm]').focus();
 		return false;
 	}
 	
-	if (gagajf.isNull($("#deliveryModifyForm input[name=recipPhnno]").val())) {
+	if (gagajf.isNull(phnno)) {
 		mcxDialog.alert("휴대폰번호를 입력해주세요.");
 		$('#deliveryModifyForm input[name=recipPhnno]').focus();
 		return false;
 	}
 	
-	if ($("#deliveryModifyForm input[name=recipPhnno]").val().length < 12) {
+	if (phnno.length < 11) {
 		mcxDialog.alert("휴대폰번호를 정확히 입력해주세요.");
 		$('#deliveryModifyForm input[name=recipPhnno]').focus();
 		return false;
 	}
 	
-	if ($("#deliveryModifyForm input[name=recipPhnno]").val().length > 13) {
+	if (phnno.length > 14) {
+		mcxDialog.alert("휴대폰번호를 정확히 입력해주세요.");
+		$('#deliveryModifyForm input[name=recipPhnno]').focus();
+		return false;
+	}
+
+	if (!regExp.test(phnno)) {
 		mcxDialog.alert("휴대폰번호를 정확히 입력해주세요.");
 		$('#deliveryModifyForm input[name=recipPhnno]').focus();
 		return false;
@@ -282,7 +290,7 @@ var fnOpenDaumAddr = function() {
 }
 
 // 2021.04.09 하이픈처리
-$(document).on("keyup", "#deliveryModifyForm input[name=recipPhnno]", function() { 
-	$(this).val( $(this).val().replace(/[^0-9]/g, "").replace(/(^02|^0505|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3").replace("--", "-") ); 
+$(document).on("keyup", "#deliveryModifyForm input[name=recipPhnno]", function() {
+	$(this).val( $(this).val().replace(/[^0-9]/g, "").replace(/(^02|^050[0-9]|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3").replace("--", "-") ); 
 });
 </script>