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);
+ }
+
+
+ });
+
+