From f77e706f05560620d1b2c477fa5a54c2acaeea58 Mon Sep 17 00:00:00 2001 From: SeoJin Kim Date: Mon, 29 Nov 2021 11:25:10 +0900 Subject: [PATCH] =?UTF-8?q?[Spring][=EC=87=BC=ED=95=91=EB=AA=B0=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8][37]=20=EC=9E=A5=EB=B0=94?= =?UTF-8?q?=EA=B5=AC=EB=8B=88=20=EA=B8=B0=EB=8A=A5(=EC=9E=A5=EB=B0=94?= =?UTF-8?q?=EA=B5=AC=EB=8B=88=20=ED=8E=98=EC=9D=B4=EC=A7=80)=20-2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://kimvampa.tistory.com/266 --- VamPa/src/main/webapp/WEB-INF/views/cart.jsp | 72 ++++++++++++++----- VamPa/src/main/webapp/resources/css/cart.css | 13 ++++ .../maven/com.vam/controller/pom.properties | 2 +- .../src/main/webapp/WEB-INF/views/cart.jsp | 72 ++++++++++++++----- .../src/main/webapp/resources/css/cart.css | 13 ++++ .../maven/com.vam/controller/pom.properties | 2 +- 6 files changed, 140 insertions(+), 34 deletions(-) diff --git a/VamPa/src/main/webapp/WEB-INF/views/cart.jsp b/VamPa/src/main/webapp/WEB-INF/views/cart.jsp index f31dd6d..c7e1c73 100644 --- a/VamPa/src/main/webapp/WEB-INF/views/cart.jsp +++ b/VamPa/src/main/webapp/WEB-INF/views/cart.jsp @@ -95,6 +95,11 @@
+ +
+ 전체선택 +
+ @@ -116,6 +121,7 @@
표 제목 부분
+ @@ -274,25 +280,58 @@ $(document).ready(function(){ /* 종합 정보 섹션 정보 삽입 */ + setTotalInfo(); + +}); + +/* 체크여부에따른 종합 정보 변화 */ +$(".individual_cart_checkbox").on("change", function(){ + /* 총 주문 정보 세팅(배송비, 총 가격, 마일리지, 물품 수, 종류) */ + setTotalInfo($(".cart_info_td")); +}); + +/* 체크박스 전체 선택 */ +$(".all_check_input").on("click", function(){ + + /* 체크박스 체크/해제 */ + if($(".all_check_input").prop("checked")){ + $(".individual_cart_checkbox").attr("checked", true); + } else{ + $(".individual_cart_checkbox").attr("checked", false); + } + + /* 총 주문 정보 세팅(배송비, 총 가격, 마일리지, 물품 수, 종류) */ + setTotalInfo($(".cart_info_td")); + +}); + + +/* 총 주문 정보 세팅(배송비, 총 가격, 마일리지, 물품 수, 종류) */ +function setTotalInfo(){ + let totalPrice = 0; // 총 가격 let totalCount = 0; // 총 갯수 let totalKind = 0; // 총 종류 let totalPoint = 0; // 총 마일리지 let deliveryPrice = 0; // 배송비 - let finalTotalPrice = 0; // 최종 가격(총 가격 + 배송비) + let finalTotalPrice = 0; // 최종 가격(총 가격 + 배송비) + $(".cart_info_td").each(function(index, element){ - // 총 가격 - totalPrice += parseInt($(element).find(".individual_totalPrice_input").val()); - // 총 갯수 - totalCount += parseInt($(element).find(".individual_bookCount_input").val()); - // 총 종류 - totalKind += 1; - // 총 마일리지 - totalPoint += parseInt($(element).find(".individual_totalPoint_input").val()); + if($(element).find(".individual_cart_checkbox").is(":checked") === true){ //체크여부 + // 총 가격 + totalPrice += parseInt($(element).find(".individual_totalPrice_input").val()); + // 총 갯수 + totalCount += parseInt($(element).find(".individual_bookCount_input").val()); + // 총 종류 + totalKind += 1; + // 총 마일리지 + totalPoint += parseInt($(element).find(".individual_totalPoint_input").val()); + } - }); + }); + /* 배송비 결정 */ if(totalPrice >= 30000){ @@ -301,12 +340,12 @@ $(document).ready(function(){ deliveryPrice = 0; } else { deliveryPrice = 3000; - } + } - /* 최종 가격 */ - finalTotalPrice = totalPrice + deliveryPrice; + finalTotalPrice = totalPrice + deliveryPrice; + + /* ※ 세자리 컴마 Javscript Number 객체의 toLocaleString() */ - /* 값 삽입 */ // 총 가격 $(".totalPrice_span").text(totalPrice.toLocaleString()); // 총 갯수 @@ -319,8 +358,9 @@ $(document).ready(function(){ $(".delivery_price").text(deliveryPrice); // 최종 가격(총 가격 + 배송비) $(".finalTotalPrice_span").text(finalTotalPrice.toLocaleString()); - -}); +} + + diff --git a/VamPa/src/main/webapp/resources/css/cart.css b/VamPa/src/main/webapp/resources/css/cart.css index 6aee767..dd1e85c 100644 --- a/VamPa/src/main/webapp/resources/css/cart.css +++ b/VamPa/src/main/webapp/resources/css/cart.css @@ -316,6 +316,19 @@ a{ border: 1px dotted #d1c7c7; margin: 5px 0 5px 0; } + + .input_size_20{ + width:20px; + height:20px; + } + .all_check_input{ + margin: 18px 0 18px 18px; + } + .all_chcek_span{ + padding-left: 8px; + font-size: 20px; + font-weight: bold; + } 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 4592178..0c63e54 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 -#Wed Nov 24 18:29:52 KST 2021 +#Mon Nov 29 11:24:17 KST 2021 m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project2\\VamPa m2e.projectName=VamPa groupId=com.vam diff --git a/VamPa_MySQL/src/main/webapp/WEB-INF/views/cart.jsp b/VamPa_MySQL/src/main/webapp/WEB-INF/views/cart.jsp index f31dd6d..c7e1c73 100644 --- a/VamPa_MySQL/src/main/webapp/WEB-INF/views/cart.jsp +++ b/VamPa_MySQL/src/main/webapp/WEB-INF/views/cart.jsp @@ -95,6 +95,11 @@
+ +
+ 전체선택 +
+ @@ -116,6 +121,7 @@
표 제목 부분
+ @@ -274,25 +280,58 @@ $(document).ready(function(){ /* 종합 정보 섹션 정보 삽입 */ + setTotalInfo(); + +}); + +/* 체크여부에따른 종합 정보 변화 */ +$(".individual_cart_checkbox").on("change", function(){ + /* 총 주문 정보 세팅(배송비, 총 가격, 마일리지, 물품 수, 종류) */ + setTotalInfo($(".cart_info_td")); +}); + +/* 체크박스 전체 선택 */ +$(".all_check_input").on("click", function(){ + + /* 체크박스 체크/해제 */ + if($(".all_check_input").prop("checked")){ + $(".individual_cart_checkbox").attr("checked", true); + } else{ + $(".individual_cart_checkbox").attr("checked", false); + } + + /* 총 주문 정보 세팅(배송비, 총 가격, 마일리지, 물품 수, 종류) */ + setTotalInfo($(".cart_info_td")); + +}); + + +/* 총 주문 정보 세팅(배송비, 총 가격, 마일리지, 물품 수, 종류) */ +function setTotalInfo(){ + let totalPrice = 0; // 총 가격 let totalCount = 0; // 총 갯수 let totalKind = 0; // 총 종류 let totalPoint = 0; // 총 마일리지 let deliveryPrice = 0; // 배송비 - let finalTotalPrice = 0; // 최종 가격(총 가격 + 배송비) + let finalTotalPrice = 0; // 최종 가격(총 가격 + 배송비) + $(".cart_info_td").each(function(index, element){ - // 총 가격 - totalPrice += parseInt($(element).find(".individual_totalPrice_input").val()); - // 총 갯수 - totalCount += parseInt($(element).find(".individual_bookCount_input").val()); - // 총 종류 - totalKind += 1; - // 총 마일리지 - totalPoint += parseInt($(element).find(".individual_totalPoint_input").val()); + if($(element).find(".individual_cart_checkbox").is(":checked") === true){ //체크여부 + // 총 가격 + totalPrice += parseInt($(element).find(".individual_totalPrice_input").val()); + // 총 갯수 + totalCount += parseInt($(element).find(".individual_bookCount_input").val()); + // 총 종류 + totalKind += 1; + // 총 마일리지 + totalPoint += parseInt($(element).find(".individual_totalPoint_input").val()); + } - }); + }); + /* 배송비 결정 */ if(totalPrice >= 30000){ @@ -301,12 +340,12 @@ $(document).ready(function(){ deliveryPrice = 0; } else { deliveryPrice = 3000; - } + } - /* 최종 가격 */ - finalTotalPrice = totalPrice + deliveryPrice; + finalTotalPrice = totalPrice + deliveryPrice; + + /* ※ 세자리 컴마 Javscript Number 객체의 toLocaleString() */ - /* 값 삽입 */ // 총 가격 $(".totalPrice_span").text(totalPrice.toLocaleString()); // 총 갯수 @@ -319,8 +358,9 @@ $(document).ready(function(){ $(".delivery_price").text(deliveryPrice); // 최종 가격(총 가격 + 배송비) $(".finalTotalPrice_span").text(finalTotalPrice.toLocaleString()); - -}); +} + + diff --git a/VamPa_MySQL/src/main/webapp/resources/css/cart.css b/VamPa_MySQL/src/main/webapp/resources/css/cart.css index 6aee767..dd1e85c 100644 --- a/VamPa_MySQL/src/main/webapp/resources/css/cart.css +++ b/VamPa_MySQL/src/main/webapp/resources/css/cart.css @@ -316,6 +316,19 @@ a{ border: 1px dotted #d1c7c7; margin: 5px 0 5px 0; } + + .input_size_20{ + width:20px; + height:20px; + } + .all_check_input{ + margin: 18px 0 18px 18px; + } + .all_chcek_span{ + padding-left: 8px; + font-size: 20px; + font-weight: bold; + } 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 d24884f..51c0676 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 -#Wed Nov 24 18:29:52 KST 2021 +#Mon Nov 29 11:24:18 KST 2021 m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project2\\VamPa_MySQL m2e.projectName=VamPa_MySQL groupId=com.vam