From 467ae8837977d5a9e21d462902dde15e44e61742 Mon Sep 17 00:00:00 2001 From: SeoJin Kim Date: Thu, 18 Nov 2021 18:17:48 +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][36]=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=EC=B6=94=EA=B0=80(=EB=B7=B0=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84))=20-=205?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://kimvampa.tistory.com/264 --- .../main/webapp/WEB-INF/views/goodsDetail.jsp | 51 +++- .../main/webapp/WEB-INF/views/goodsDetail.jsp | 283 ++++++++++++++++++ 2 files changed, 331 insertions(+), 3 deletions(-) create mode 100644 VamPa_MySQL/src/main/webapp/WEB-INF/views/goodsDetail.jsp diff --git a/VamPa/src/main/webapp/WEB-INF/views/goodsDetail.jsp b/VamPa/src/main/webapp/WEB-INF/views/goodsDetail.jsp index 140a2c9..a6b01cc 100644 --- a/VamPa/src/main/webapp/WEB-INF/views/goodsDetail.jsp +++ b/VamPa/src/main/webapp/WEB-INF/views/goodsDetail.jsp @@ -130,10 +130,10 @@
주문수량 - + - - + +
@@ -232,6 +232,51 @@ $(document).ready(function(){ $(".publeyear").html(publeYear); }); + + +// 수량 버튼 조작 +let quantity = $(".quantity_input").val(); +$(".plus_btn").on("click", function(){ + $(".quantity_input").val(++quantity); +}); +$(".minus_btn").on("click", function(){ + if(quantity > 1){ + $(".quantity_input").val(--quantity); + } +}); + +// 서버로 전송할 데이터 +const form = { + memberId : '${member.memberId}', + bookId : '${goodsInfo.bookId}', + bookCount : '' +} +// 장바구니 추가 버튼 + $(".btn_cart").on("click", function(e){ + form.bookCount = $(".quantity_input").val(); + $.ajax({ + url: '/cart/add', + type: 'POST', + data: form, + success: function(result){ + cartAlert(result); + } + }) + }); + + function cartAlert(result){ + if(result == '0'){ + alert("장바구니에 추가를 하지 못하였습니다."); + } else if(result == '1'){ + alert("장바구니에 추가되었습니다."); + } else if(result == '2'){ + alert("장바구니에 이미 추가되어져 있습니다."); + } else if(result == '5'){ + alert("로그인이 필요합니다."); + } + } + + diff --git a/VamPa_MySQL/src/main/webapp/WEB-INF/views/goodsDetail.jsp b/VamPa_MySQL/src/main/webapp/WEB-INF/views/goodsDetail.jsp new file mode 100644 index 0000000..a6b01cc --- /dev/null +++ b/VamPa_MySQL/src/main/webapp/WEB-INF/views/goodsDetail.jsp @@ -0,0 +1,283 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> + + + + +Welcome BookMall + + + + + +
+
+
+ +
+
+ +
+ +
+
+
+
+
+ + "> + +
+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+

+ ${goodsInfo.bookName} +

+
+
+
+
+ + ${goodsInfo.authorName} 지음 + + | + + ${goodsInfo.publisher} + + | + + ${goodsInfo.publeYear} + +
+
+
+
+
정가 :
+
+ 판매가 : + [% + 할인]
+
+
+
+
+
+ 주문수량 + + + + + +
+ +
+
+
+
+
+
+
+ ${goodsInfo.bookIntro} +
+
+ ${goodsInfo.bookContents } +
+
+
+
+
+ 리뷰 +
+ +
+ + + + + + +
+
+ + + + + \ No newline at end of file