diff --git a/VamPa/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp b/VamPa/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp index 012170a..a3294bd 100644 --- a/VamPa/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp +++ b/VamPa/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp @@ -111,8 +111,10 @@
- - 상품 할인율을 입력해주세요. + + + 할인 가격 : + 1~99 숫자를 입력해주세요.
@@ -179,7 +181,7 @@ $("#enrollBtn").on("click",function(e){ let cateCode = $("select[name='cateCode']").val(); let bookPrice = $("input[name='bookPrice']").val(); let bookStock = $("input[name='bookStock']").val(); - let bookDiscount = $("input[name='bookDiscount']").val(); + let bookDiscount = $("#discount_interface").val(); let bookIntro = $(".bit p").html(); let bookContents = $(".bct p").html(); @@ -240,7 +242,7 @@ $("#enrollBtn").on("click",function(e){ stockCk = false; } - if(bookDiscount < 1 && bookDiscount != ''){ + if(!isNaN(bookDiscount)){ $(".bookDiscount_warn").css('display','none'); discountCk = true; } else { @@ -414,6 +416,44 @@ $("#enrollBtn").on("click",function(e){ }); + /* 할인율 Input 설정 */ + + $("#discount_interface").on("propertychange change keyup paste input", function(){ + + let userInput = $("#discount_interface"); + let discountInput = $("input[name='bookDiscount']"); + + let discountRate = userInput.val(); // 사용자가 입력한 할인값 + let sendDiscountRate = discountRate / 100; // 서버에 전송할 할인값 + let goodsPrice = $("input[name='bookPrice']").val(); // 원가 + let discountPrice = goodsPrice * (1 - sendDiscountRate); // 할인가격 + + if(!isNaN(discountRate)){ + $(".span_discount").html(discountPrice); + discountInput.val(sendDiscountRate); + } + + + }); + + $("input[name='bookPrice']").on("change", function(){ + + let userInput = $("#discount_interface"); + let discountInput = $("input[name='bookDiscount']"); + + let discountRate = userInput.val(); // 사용자가 입력한 할인값 + let sendDiscountRate = discountRate / 100; // 서버에 전송할 할인값 + let goodsPrice = $("input[name='bookPrice']").val(); // 원가 + let discountPrice = goodsPrice * (1 - sendDiscountRate); // 할인가격 + + if(!isNaN(discountRate)){ + $(".span_discount").html(discountPrice); + } + + + }); + + diff --git a/VamPa/src/main/webapp/resources/css/admin/goodsEnroll.css b/VamPa/src/main/webapp/resources/css/admin/goodsEnroll.css index 3b94d93..16ab02b 100644 --- a/VamPa/src/main/webapp/resources/css/admin/goodsEnroll.css +++ b/VamPa/src/main/webapp/resources/css/admin/goodsEnroll.css @@ -194,6 +194,12 @@ input[name='publeYear'] { font-weight: 300; } +.step_val{ /* 할인 가격 문구 */ + display: block; + padding-top: 5px; + font-weight: 500; +} + /* 버튼 영역 */ .btn_section{ diff --git a/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties b/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties index 291a3f1..6898e53 100644 --- a/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties +++ b/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven Integration for Eclipse -#Mon Mar 29 18:10:20 KST 2021 +#Wed Mar 31 15:59:23 KST 2021 m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project\\VamPa m2e.projectName=VamPa groupId=com.vam diff --git a/VamPa_MySQL/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp b/VamPa_MySQL/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp index 8f40160..a3294bd 100644 --- a/VamPa_MySQL/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp +++ b/VamPa_MySQL/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp @@ -111,8 +111,10 @@
- - 상품 할인율을 입력해주세요. + + + 할인 가격 : + 1~99 숫자를 입력해주세요.
@@ -179,7 +181,7 @@ $("#enrollBtn").on("click",function(e){ let cateCode = $("select[name='cateCode']").val(); let bookPrice = $("input[name='bookPrice']").val(); let bookStock = $("input[name='bookStock']").val(); - let bookDiscount = $("input[name='bookDiscount']").val(); + let bookDiscount = $("#discount_interface").val(); let bookIntro = $(".bit p").html(); let bookContents = $(".bct p").html(); @@ -240,7 +242,7 @@ $("#enrollBtn").on("click",function(e){ stockCk = false; } - if(bookDiscount < 1 && bookDiscount != ''){ + if(!isNaN(bookDiscount)){ $(".bookDiscount_warn").css('display','none'); discountCk = true; } else { @@ -264,7 +266,7 @@ $("#enrollBtn").on("click",function(e){ contentsCk = false; } - /* 최종확인 */ + /* 최종 확인 */ if(bookNameCk && authorIdCk && publeYearCk && publisherCk && cateCodeCk && priceCk && stockCk && discountCk && introCk && contentsCk ){ //alert('통과'); enrollForm.submit(); @@ -414,6 +416,44 @@ $("#enrollBtn").on("click",function(e){ }); + /* 할인율 Input 설정 */ + + $("#discount_interface").on("propertychange change keyup paste input", function(){ + + let userInput = $("#discount_interface"); + let discountInput = $("input[name='bookDiscount']"); + + let discountRate = userInput.val(); // 사용자가 입력한 할인값 + let sendDiscountRate = discountRate / 100; // 서버에 전송할 할인값 + let goodsPrice = $("input[name='bookPrice']").val(); // 원가 + let discountPrice = goodsPrice * (1 - sendDiscountRate); // 할인가격 + + if(!isNaN(discountRate)){ + $(".span_discount").html(discountPrice); + discountInput.val(sendDiscountRate); + } + + + }); + + $("input[name='bookPrice']").on("change", function(){ + + let userInput = $("#discount_interface"); + let discountInput = $("input[name='bookDiscount']"); + + let discountRate = userInput.val(); // 사용자가 입력한 할인값 + let sendDiscountRate = discountRate / 100; // 서버에 전송할 할인값 + let goodsPrice = $("input[name='bookPrice']").val(); // 원가 + let discountPrice = goodsPrice * (1 - sendDiscountRate); // 할인가격 + + if(!isNaN(discountRate)){ + $(".span_discount").html(discountPrice); + } + + + }); + + diff --git a/VamPa_MySQL/src/main/webapp/resources/css/admin/goodsEnroll.css b/VamPa_MySQL/src/main/webapp/resources/css/admin/goodsEnroll.css index 3b94d93..16ab02b 100644 --- a/VamPa_MySQL/src/main/webapp/resources/css/admin/goodsEnroll.css +++ b/VamPa_MySQL/src/main/webapp/resources/css/admin/goodsEnroll.css @@ -194,6 +194,12 @@ input[name='publeYear'] { font-weight: 300; } +.step_val{ /* 할인 가격 문구 */ + display: block; + padding-top: 5px; + font-weight: 500; +} + /* 버튼 영역 */ .btn_section{ diff --git a/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties b/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties index 871b8a0..3ffd3a0 100644 --- a/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties +++ b/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven Integration for Eclipse -#Mon Mar 29 18:10:21 KST 2021 +#Wed Mar 31 15:59:24 KST 2021 m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project\\VamPa_MySQL m2e.projectName=VamPa_MySQL groupId=com.vam