@@ -1,11 +1,15 @@
|
||||
package com.vam.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import com.vam.model.OrderDTO;
|
||||
import com.vam.model.OrderPageDTO;
|
||||
import com.vam.service.MemberService;
|
||||
import com.vam.service.OrderService;
|
||||
@@ -29,4 +33,12 @@ public class OrderController {
|
||||
return "/order";
|
||||
}
|
||||
|
||||
@PostMapping("/order")
|
||||
public String orderPagePost(OrderDTO od, HttpServletRequest request) {
|
||||
|
||||
System.out.println(od);
|
||||
|
||||
return "redirect:/main";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
190
VamPa/src/main/java/com/vam/model/OrderDTO.java
Normal file
190
VamPa/src/main/java/com/vam/model/OrderDTO.java
Normal file
@@ -0,0 +1,190 @@
|
||||
package com.vam.model;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class OrderDTO {
|
||||
|
||||
/* 주문 번호 */
|
||||
private String orderId;
|
||||
|
||||
/* 배송 받는이 */
|
||||
private String addressee;
|
||||
|
||||
/* 주문 회원 아이디 */
|
||||
private String memberId;
|
||||
|
||||
/* 우편번호 */
|
||||
private String memberAddr1;
|
||||
|
||||
/* 회원 주소 */
|
||||
private String memberAddr2;
|
||||
|
||||
/* 회원 상세주소 */
|
||||
private String memberAddr3;
|
||||
|
||||
/* 주문 상태 */
|
||||
private String orderState;
|
||||
|
||||
/* 주문 상품 */
|
||||
private List<OrderItemDTO> orders;
|
||||
|
||||
/* 배송비 */
|
||||
private int deliveryCost;
|
||||
|
||||
/* 사용 포인트 */
|
||||
private int usePoint;
|
||||
|
||||
/* 주문 날짜 */
|
||||
private Date orderDate;
|
||||
|
||||
/* DB테이블 존재 하지 않는 데이터 */
|
||||
|
||||
/* 판매가(모든 상품 비용) */
|
||||
private int orderSalePrice;
|
||||
|
||||
/* 적립 포인트 */
|
||||
private int orderSavePoint;
|
||||
|
||||
/* 최종 판매 비용 */
|
||||
private int orderFinalSalePrice;
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getAddressee() {
|
||||
return addressee;
|
||||
}
|
||||
|
||||
public void setAddressee(String addressee) {
|
||||
this.addressee = addressee;
|
||||
}
|
||||
|
||||
public String getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
public void setMemberId(String memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
public String getMemberAddr1() {
|
||||
return memberAddr1;
|
||||
}
|
||||
|
||||
public void setMemberAddr1(String memberAddr1) {
|
||||
this.memberAddr1 = memberAddr1;
|
||||
}
|
||||
|
||||
public String getMemberAddr2() {
|
||||
return memberAddr2;
|
||||
}
|
||||
|
||||
public void setMemberAddr2(String memberAddr2) {
|
||||
this.memberAddr2 = memberAddr2;
|
||||
}
|
||||
|
||||
public String getMemberAddr3() {
|
||||
return memberAddr3;
|
||||
}
|
||||
|
||||
public void setMemberAddr3(String memberAddr3) {
|
||||
this.memberAddr3 = memberAddr3;
|
||||
}
|
||||
|
||||
public String getOrderState() {
|
||||
return orderState;
|
||||
}
|
||||
|
||||
public void setOrderState(String orderState) {
|
||||
this.orderState = orderState;
|
||||
}
|
||||
|
||||
public List<OrderItemDTO> getOrders() {
|
||||
return orders;
|
||||
}
|
||||
|
||||
public void setOrders(List<OrderItemDTO> orders) {
|
||||
this.orders = orders;
|
||||
}
|
||||
|
||||
public int getDeliveryCost() {
|
||||
return deliveryCost;
|
||||
}
|
||||
|
||||
public void setDeliveryCost(int deliveryCost) {
|
||||
this.deliveryCost = deliveryCost;
|
||||
}
|
||||
|
||||
public int getUsePoint() {
|
||||
return usePoint;
|
||||
}
|
||||
|
||||
public void setUsePoint(int usePoint) {
|
||||
this.usePoint = usePoint;
|
||||
}
|
||||
|
||||
public Date getOrderDate() {
|
||||
return orderDate;
|
||||
}
|
||||
|
||||
public void setOrderDate(Date orderDate) {
|
||||
this.orderDate = orderDate;
|
||||
}
|
||||
|
||||
public int getOrderSalePrice() {
|
||||
return orderSalePrice;
|
||||
}
|
||||
|
||||
public void setOrderSalePrice(int orderSalePrice) {
|
||||
this.orderSalePrice = orderSalePrice;
|
||||
}
|
||||
|
||||
public int getOrderSavePoint() {
|
||||
return orderSavePoint;
|
||||
}
|
||||
|
||||
public void setOrderSavePoint(int orderSavePoint) {
|
||||
this.orderSavePoint = orderSavePoint;
|
||||
}
|
||||
|
||||
public int getOrderFinalSalePrice() {
|
||||
return orderFinalSalePrice;
|
||||
}
|
||||
|
||||
public void setOrderFinalSalePrice(int orderFinalSalePrice) {
|
||||
this.orderFinalSalePrice = orderFinalSalePrice;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrderDTO [orderId=" + orderId + ", addressee=" + addressee + ", memberId=" + memberId + ", memberAddr1="
|
||||
+ memberAddr1 + ", memberAddr2=" + memberAddr2 + ", memberAddr3=" + memberAddr3 + ", orderState="
|
||||
+ orderState + ", orders=" + orders + ", deliveryCost=" + deliveryCost + ", usePoint=" + usePoint
|
||||
+ ", orderDate=" + orderDate + ", orderSalePrice=" + orderSalePrice + ", orderSavePoint="
|
||||
+ orderSavePoint + ", orderFinalSalePrice=" + orderFinalSalePrice + "]";
|
||||
}
|
||||
|
||||
public void getOrderPriceInfo() {
|
||||
/* 상품 비용 & 적립포인트 */
|
||||
for(OrderItemDTO order : orders) {
|
||||
orderSalePrice += order.getTotalPrice();
|
||||
orderSavePoint += order.getTotalSavePoint();
|
||||
}
|
||||
/* 배송비용 */
|
||||
if(orderSalePrice >= 30000) {
|
||||
deliveryCost = 0;
|
||||
} else {
|
||||
deliveryCost = 3000;
|
||||
}
|
||||
/* 최종 비용(상품 비용 + 배송비 - 사용 포인트) */
|
||||
orderFinalSalePrice = orderSalePrice + deliveryCost - usePoint;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
134
VamPa/src/main/java/com/vam/model/OrderItemDTO.java
Normal file
134
VamPa/src/main/java/com/vam/model/OrderItemDTO.java
Normal file
@@ -0,0 +1,134 @@
|
||||
package com.vam.model;
|
||||
|
||||
public class OrderItemDTO {
|
||||
|
||||
/* 주문 번호 */
|
||||
private String orderId;
|
||||
|
||||
/* 상품 번호 */
|
||||
private int bookId;
|
||||
|
||||
/* 주문 수량 */
|
||||
private int bookCount;
|
||||
|
||||
/* vam_orderItem 기본키 */
|
||||
private int orderItemId;
|
||||
|
||||
/* 상품 한 개 가격 */
|
||||
private int bookPrice;
|
||||
|
||||
/* 상품 할인 율 */
|
||||
private double bookDiscount;
|
||||
|
||||
/* 상품 한개 구매 시 획득 포인트 */
|
||||
private int savePoint;
|
||||
|
||||
/* DB테이블 존재 하지 않는 데이터 */
|
||||
|
||||
/* 할인 적용된 가격 */
|
||||
private int salePrice;
|
||||
|
||||
/* 총 가격(할인 적용된 가격 * 주문 수량) */
|
||||
private int totalPrice;
|
||||
|
||||
/* 총 획득 포인트(상품 한개 구매 시 획득 포인트 * 수량) */
|
||||
private int totalSavePoint;
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public int getBookId() {
|
||||
return bookId;
|
||||
}
|
||||
|
||||
public void setBookId(int bookId) {
|
||||
this.bookId = bookId;
|
||||
}
|
||||
|
||||
public int getBookCount() {
|
||||
return bookCount;
|
||||
}
|
||||
|
||||
public void setBookCount(int bookCount) {
|
||||
this.bookCount = bookCount;
|
||||
}
|
||||
|
||||
public int getOrderItemId() {
|
||||
return orderItemId;
|
||||
}
|
||||
|
||||
public void setOrderItemId(int orderItemId) {
|
||||
this.orderItemId = orderItemId;
|
||||
}
|
||||
|
||||
public int getBookPrice() {
|
||||
return bookPrice;
|
||||
}
|
||||
|
||||
public void setBookPrice(int bookPrice) {
|
||||
this.bookPrice = bookPrice;
|
||||
}
|
||||
|
||||
public double getBookDiscount() {
|
||||
return bookDiscount;
|
||||
}
|
||||
|
||||
public void setBookDiscount(double bookDiscount) {
|
||||
this.bookDiscount = bookDiscount;
|
||||
}
|
||||
|
||||
public int getSavePoint() {
|
||||
return savePoint;
|
||||
}
|
||||
|
||||
public void setSavePoint(int savePoint) {
|
||||
this.savePoint = savePoint;
|
||||
}
|
||||
|
||||
public int getSalePrice() {
|
||||
return salePrice;
|
||||
}
|
||||
|
||||
public void setSalePrice(int salePrice) {
|
||||
this.salePrice = salePrice;
|
||||
}
|
||||
|
||||
public int getTotalPrice() {
|
||||
return totalPrice;
|
||||
}
|
||||
|
||||
public void setTotalPrice(int totalPrice) {
|
||||
this.totalPrice = totalPrice;
|
||||
}
|
||||
|
||||
public int getTotalSavePoint() {
|
||||
return totalSavePoint;
|
||||
}
|
||||
|
||||
public void setTotalSavePoint(int totalSavePoint) {
|
||||
this.totalSavePoint = totalSavePoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrderItemDTO [orderId=" + orderId + ", bookId=" + bookId + ", bookCount=" + bookCount + ", orderItemId="
|
||||
+ orderItemId + ", bookPrice=" + bookPrice + ", bookDiscount=" + bookDiscount + ", savePoint="
|
||||
+ savePoint + ", salePrice=" + salePrice + ", totalPrice=" + totalPrice + ", totalSavePoint="
|
||||
+ totalSavePoint + "]";
|
||||
}
|
||||
|
||||
public void initSaleTotal() {
|
||||
this.salePrice = (int) (this.bookPrice * (1-this.bookDiscount));
|
||||
this.totalPrice = this.salePrice*this.bookCount;
|
||||
this.savePoint = (int)(Math.floor(this.salePrice*0.05));
|
||||
this.totalSavePoint =this.savePoint * this.bookCount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -128,7 +128,12 @@
|
||||
<tr>
|
||||
<th>주소</th>
|
||||
<td>
|
||||
${memberInfo.memberAddr1} ${memberInfo.memberAddr2}<br>${memberInfo.memberAddr3}
|
||||
${memberInfo.memberAddr1} ${memberInfo.memberAddr2}<br>${memberInfo.memberAddr3}
|
||||
<input class="selectAddress" value="T" type="hidden">
|
||||
<input class="addressee_input" value="${memberInfo.memberName}" type="hidden">
|
||||
<input class="address1_input" type="hidden" value="${memberInfo.memberAddr1}">
|
||||
<input class="address2_input" type="hidden" value="${memberInfo.memberAddr2}">
|
||||
<input class="address3_input" type="hidden" value="${memberInfo.memberAddr3}">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -275,6 +280,20 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 주문 요청 form -->
|
||||
<form class="order_form" action="/order" method="post">
|
||||
<!-- 주문자 회원번호 -->
|
||||
<input name="memberId" value="${memberInfo.memberId}" type="hidden">
|
||||
<!-- 주소록 & 받는이-->
|
||||
<input name="addressee" type="hidden">
|
||||
<input name="memberAddr1" type="hidden">
|
||||
<input name="memberAddr2" type="hidden">
|
||||
<input name="memberAddr3" type="hidden">
|
||||
<!-- 사용 포인트 -->
|
||||
<input name="usePoint" type="hidden">
|
||||
<!-- 상품 정보 -->
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -362,6 +381,14 @@ function showAdress(className){
|
||||
$(".address_btn").css('backgroundColor', '#555');
|
||||
/* 지정 색상 변경 */
|
||||
$(".address_btn_"+className).css('backgroundColor', '#3c3838');
|
||||
/* selectAddress T/F */
|
||||
/* 모든 selectAddress F만들기 */
|
||||
$(".addressInfo_input_div").each(function(i, obj){
|
||||
$(obj).find(".selectAddress").val("F");
|
||||
});
|
||||
/* 선택한 selectAdress T만들기 */
|
||||
$(".addressInfo_input_div_" + className).find(".selectAddress").val("T");
|
||||
|
||||
}
|
||||
|
||||
/* 다음 주소 연동 */
|
||||
@@ -530,6 +557,40 @@ function setTotalInfo(){
|
||||
|
||||
}
|
||||
|
||||
/* 주문 요청 */
|
||||
$(".order_btn").on("click", function(){
|
||||
|
||||
/* 주소 정보 & 받는이*/
|
||||
$(".addressInfo_input_div").each(function(i, obj){
|
||||
if($(obj).find(".selectAddress").val() === 'T'){
|
||||
$("input[name='addressee']").val($(obj).find(".addressee_input").val());
|
||||
$("input[name='memberAddr1']").val($(obj).find(".address1_input").val());
|
||||
$("input[name='memberAddr2']").val($(obj).find(".address2_input").val());
|
||||
$("input[name='memberAddr3']").val($(obj).find(".address3_input").val());
|
||||
}
|
||||
});
|
||||
|
||||
/* 사용 포인트 */
|
||||
$("input[name='usePoint']").val($(".order_point_input").val());
|
||||
|
||||
/* 상품정보 */
|
||||
let form_contents = '';
|
||||
$(".goods_table_price_td").each(function(index, element){
|
||||
let bookId = $(element).find(".individual_bookId_input").val();
|
||||
let bookCount = $(element).find(".individual_bookCount_input").val();
|
||||
let bookId_input = "<input name='orders[" + index + "].bookId' type='hidden' value='" + bookId + "'>";
|
||||
form_contents += bookId_input;
|
||||
let bookCount_input = "<input name='orders[" + index + "].bookCount' type='hidden' value='" + bookCount + "'>";
|
||||
form_contents += bookCount_input;
|
||||
});
|
||||
$(".order_form").append(form_contents);
|
||||
|
||||
/* 서버 전송 */
|
||||
$(".order_form").submit();
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package com.vam.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import com.vam.model.OrderDTO;
|
||||
import com.vam.model.OrderPageDTO;
|
||||
import com.vam.service.MemberService;
|
||||
import com.vam.service.OrderService;
|
||||
@@ -27,6 +31,14 @@ public class OrderController {
|
||||
|
||||
|
||||
return "/order";
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/order")
|
||||
public String orderPagePost(OrderDTO od, HttpServletRequest request) {
|
||||
|
||||
System.out.println(od);
|
||||
|
||||
return "redirect:/main";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
189
VamPa_MySQL/src/main/java/com/vam/model/OrderDTO.java
Normal file
189
VamPa_MySQL/src/main/java/com/vam/model/OrderDTO.java
Normal file
@@ -0,0 +1,189 @@
|
||||
package com.vam.model;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class OrderDTO {
|
||||
|
||||
/* 주문 번호 */
|
||||
private String orderId;
|
||||
|
||||
/* 배송 받는이 */
|
||||
private String addressee;
|
||||
|
||||
/* 주문 회원 아이디 */
|
||||
private String memberId;
|
||||
|
||||
/* 우편번호 */
|
||||
private String memberAddr1;
|
||||
|
||||
/* 회원 주소 */
|
||||
private String memberAddr2;
|
||||
|
||||
/* 회원 상세주소 */
|
||||
private String memberAddr3;
|
||||
|
||||
/* 주문 상태 */
|
||||
private String orderState;
|
||||
|
||||
/* 주문 상품 */
|
||||
private List<OrderItemDTO> orders;
|
||||
|
||||
/* 배송비 */
|
||||
private int deliveryCost;
|
||||
|
||||
/* 사용 포인트 */
|
||||
private int usePoint;
|
||||
|
||||
/* 주문 날짜 */
|
||||
private Date orderDate;
|
||||
|
||||
/* DB테이블 존재 하지 않는 데이터 */
|
||||
|
||||
/* 판매가(모든 상품 비용) */
|
||||
private int orderSalePrice;
|
||||
|
||||
/* 적립 포인트 */
|
||||
private int orderSavePoint;
|
||||
|
||||
/* 최종 판매 비용 */
|
||||
private int orderFinalSalePrice;
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getAddressee() {
|
||||
return addressee;
|
||||
}
|
||||
|
||||
public void setAddressee(String addressee) {
|
||||
this.addressee = addressee;
|
||||
}
|
||||
|
||||
public String getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
public void setMemberId(String memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
public String getMemberAddr1() {
|
||||
return memberAddr1;
|
||||
}
|
||||
|
||||
public void setMemberAddr1(String memberAddr1) {
|
||||
this.memberAddr1 = memberAddr1;
|
||||
}
|
||||
|
||||
public String getMemberAddr2() {
|
||||
return memberAddr2;
|
||||
}
|
||||
|
||||
public void setMemberAddr2(String memberAddr2) {
|
||||
this.memberAddr2 = memberAddr2;
|
||||
}
|
||||
|
||||
public String getMemberAddr3() {
|
||||
return memberAddr3;
|
||||
}
|
||||
|
||||
public void setMemberAddr3(String memberAddr3) {
|
||||
this.memberAddr3 = memberAddr3;
|
||||
}
|
||||
|
||||
public String getOrderState() {
|
||||
return orderState;
|
||||
}
|
||||
|
||||
public void setOrderState(String orderState) {
|
||||
this.orderState = orderState;
|
||||
}
|
||||
|
||||
public List<OrderItemDTO> getOrders() {
|
||||
return orders;
|
||||
}
|
||||
|
||||
public void setOrders(List<OrderItemDTO> orders) {
|
||||
this.orders = orders;
|
||||
}
|
||||
|
||||
public int getDeliveryCost() {
|
||||
return deliveryCost;
|
||||
}
|
||||
|
||||
public void setDeliveryCost(int deliveryCost) {
|
||||
this.deliveryCost = deliveryCost;
|
||||
}
|
||||
|
||||
public int getUsePoint() {
|
||||
return usePoint;
|
||||
}
|
||||
|
||||
public void setUsePoint(int usePoint) {
|
||||
this.usePoint = usePoint;
|
||||
}
|
||||
|
||||
public Date getOrderDate() {
|
||||
return orderDate;
|
||||
}
|
||||
|
||||
public void setOrderDate(Date orderDate) {
|
||||
this.orderDate = orderDate;
|
||||
}
|
||||
|
||||
public int getOrderSalePrice() {
|
||||
return orderSalePrice;
|
||||
}
|
||||
|
||||
public void setOrderSalePrice(int orderSalePrice) {
|
||||
this.orderSalePrice = orderSalePrice;
|
||||
}
|
||||
|
||||
public int getOrderSavePoint() {
|
||||
return orderSavePoint;
|
||||
}
|
||||
|
||||
public void setOrderSavePoint(int orderSavePoint) {
|
||||
this.orderSavePoint = orderSavePoint;
|
||||
}
|
||||
|
||||
public int getOrderFinalSalePrice() {
|
||||
return orderFinalSalePrice;
|
||||
}
|
||||
|
||||
public void setOrderFinalSalePrice(int orderFinalSalePrice) {
|
||||
this.orderFinalSalePrice = orderFinalSalePrice;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrderDTO [orderId=" + orderId + ", addressee=" + addressee + ", memberId=" + memberId + ", memberAddr1="
|
||||
+ memberAddr1 + ", memberAddr2=" + memberAddr2 + ", memberAddr3=" + memberAddr3 + ", orderState="
|
||||
+ orderState + ", orders=" + orders + ", deliveryCost=" + deliveryCost + ", usePoint=" + usePoint
|
||||
+ ", orderDate=" + orderDate + ", orderSalePrice=" + orderSalePrice + ", orderSavePoint="
|
||||
+ orderSavePoint + ", orderFinalSalePrice=" + orderFinalSalePrice + "]";
|
||||
}
|
||||
|
||||
public void getOrderPriceInfo() {
|
||||
/* 상품 비용 & 적립포인트 */
|
||||
for(OrderItemDTO order : orders) {
|
||||
orderSalePrice += order.getTotalPrice();
|
||||
orderSavePoint += order.getTotalSavePoint();
|
||||
}
|
||||
/* 배송비용 */
|
||||
if(orderSalePrice >= 30000) {
|
||||
deliveryCost = 0;
|
||||
} else {
|
||||
deliveryCost = 3000;
|
||||
}
|
||||
/* 최종 비용(상품 비용 + 배송비 - 사용 포인트) */
|
||||
orderFinalSalePrice = orderSalePrice + deliveryCost - usePoint;
|
||||
}
|
||||
|
||||
}
|
||||
132
VamPa_MySQL/src/main/java/com/vam/model/OrderItemDTO.java
Normal file
132
VamPa_MySQL/src/main/java/com/vam/model/OrderItemDTO.java
Normal file
@@ -0,0 +1,132 @@
|
||||
package com.vam.model;
|
||||
|
||||
public class OrderItemDTO {
|
||||
|
||||
/* 주문 번호 */
|
||||
private String orderId;
|
||||
|
||||
/* 상품 번호 */
|
||||
private int bookId;
|
||||
|
||||
/* 주문 수량 */
|
||||
private int bookCount;
|
||||
|
||||
/* vam_orderItem 기본키 */
|
||||
private int orderItemId;
|
||||
|
||||
/* 상품 한 개 가격 */
|
||||
private int bookPrice;
|
||||
|
||||
/* 상품 할인 율 */
|
||||
private double bookDiscount;
|
||||
|
||||
/* 상품 한개 구매 시 획득 포인트 */
|
||||
private int savePoint;
|
||||
|
||||
/* DB테이블 존재 하지 않는 데이터 */
|
||||
|
||||
/* 할인 적용된 가격 */
|
||||
private int salePrice;
|
||||
|
||||
/* 총 가격(할인 적용된 가격 * 주문 수량) */
|
||||
private int totalPrice;
|
||||
|
||||
/* 총 획득 포인트(상품 한개 구매 시 획득 포인트 * 수량) */
|
||||
private int totalSavePoint;
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public int getBookId() {
|
||||
return bookId;
|
||||
}
|
||||
|
||||
public void setBookId(int bookId) {
|
||||
this.bookId = bookId;
|
||||
}
|
||||
|
||||
public int getBookCount() {
|
||||
return bookCount;
|
||||
}
|
||||
|
||||
public void setBookCount(int bookCount) {
|
||||
this.bookCount = bookCount;
|
||||
}
|
||||
|
||||
public int getOrderItemId() {
|
||||
return orderItemId;
|
||||
}
|
||||
|
||||
public void setOrderItemId(int orderItemId) {
|
||||
this.orderItemId = orderItemId;
|
||||
}
|
||||
|
||||
public int getBookPrice() {
|
||||
return bookPrice;
|
||||
}
|
||||
|
||||
public void setBookPrice(int bookPrice) {
|
||||
this.bookPrice = bookPrice;
|
||||
}
|
||||
|
||||
public double getBookDiscount() {
|
||||
return bookDiscount;
|
||||
}
|
||||
|
||||
public void setBookDiscount(double bookDiscount) {
|
||||
this.bookDiscount = bookDiscount;
|
||||
}
|
||||
|
||||
public int getSavePoint() {
|
||||
return savePoint;
|
||||
}
|
||||
|
||||
public void setSavePoint(int savePoint) {
|
||||
this.savePoint = savePoint;
|
||||
}
|
||||
|
||||
public int getSalePrice() {
|
||||
return salePrice;
|
||||
}
|
||||
|
||||
public void setSalePrice(int salePrice) {
|
||||
this.salePrice = salePrice;
|
||||
}
|
||||
|
||||
public int getTotalPrice() {
|
||||
return totalPrice;
|
||||
}
|
||||
|
||||
public void setTotalPrice(int totalPrice) {
|
||||
this.totalPrice = totalPrice;
|
||||
}
|
||||
|
||||
public int getTotalSavePoint() {
|
||||
return totalSavePoint;
|
||||
}
|
||||
|
||||
public void setTotalSavePoint(int totalSavePoint) {
|
||||
this.totalSavePoint = totalSavePoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrderItemDTO [orderId=" + orderId + ", bookId=" + bookId + ", bookCount=" + bookCount + ", orderItemId="
|
||||
+ orderItemId + ", bookPrice=" + bookPrice + ", bookDiscount=" + bookDiscount + ", savePoint="
|
||||
+ savePoint + ", salePrice=" + salePrice + ", totalPrice=" + totalPrice + ", totalSavePoint="
|
||||
+ totalSavePoint + "]";
|
||||
}
|
||||
|
||||
public void initSaleTotal() {
|
||||
this.salePrice = (int) (this.bookPrice * (1-this.bookDiscount));
|
||||
this.totalPrice = this.salePrice*this.bookCount;
|
||||
this.savePoint = (int)(Math.floor(this.salePrice*0.05));
|
||||
this.totalSavePoint =this.savePoint * this.bookCount;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -128,7 +128,12 @@
|
||||
<tr>
|
||||
<th>주소</th>
|
||||
<td>
|
||||
${memberInfo.memberAddr1} ${memberInfo.memberAddr2}<br>${memberInfo.memberAddr3}
|
||||
${memberInfo.memberAddr1} ${memberInfo.memberAddr2}<br>${memberInfo.memberAddr3}
|
||||
<input class="selectAddress" value="T" type="hidden">
|
||||
<input class="addressee_input" value="${memberInfo.memberName}" type="hidden">
|
||||
<input class="address1_input" type="hidden" value="${memberInfo.memberAddr1}">
|
||||
<input class="address2_input" type="hidden" value="${memberInfo.memberAddr2}">
|
||||
<input class="address3_input" type="hidden" value="${memberInfo.memberAddr3}">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -275,6 +280,20 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 주문 요청 form -->
|
||||
<form class="order_form" action="/order" method="post">
|
||||
<!-- 주문자 회원번호 -->
|
||||
<input name="memberId" value="${memberInfo.memberId}" type="hidden">
|
||||
<!-- 주소록 & 받는이-->
|
||||
<input name="addressee" type="hidden">
|
||||
<input name="memberAddr1" type="hidden">
|
||||
<input name="memberAddr2" type="hidden">
|
||||
<input name="memberAddr3" type="hidden">
|
||||
<!-- 사용 포인트 -->
|
||||
<input name="usePoint" type="hidden">
|
||||
<!-- 상품 정보 -->
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -362,6 +381,14 @@ function showAdress(className){
|
||||
$(".address_btn").css('backgroundColor', '#555');
|
||||
/* 지정 색상 변경 */
|
||||
$(".address_btn_"+className).css('backgroundColor', '#3c3838');
|
||||
/* selectAddress T/F */
|
||||
/* 모든 selectAddress F만들기 */
|
||||
$(".addressInfo_input_div").each(function(i, obj){
|
||||
$(obj).find(".selectAddress").val("F");
|
||||
});
|
||||
/* 선택한 selectAdress T만들기 */
|
||||
$(".addressInfo_input_div_" + className).find(".selectAddress").val("T");
|
||||
|
||||
}
|
||||
|
||||
/* 다음 주소 연동 */
|
||||
@@ -530,6 +557,40 @@ function setTotalInfo(){
|
||||
|
||||
}
|
||||
|
||||
/* 주문 요청 */
|
||||
$(".order_btn").on("click", function(){
|
||||
|
||||
/* 주소 정보 & 받는이*/
|
||||
$(".addressInfo_input_div").each(function(i, obj){
|
||||
if($(obj).find(".selectAddress").val() === 'T'){
|
||||
$("input[name='addressee']").val($(obj).find(".addressee_input").val());
|
||||
$("input[name='memberAddr1']").val($(obj).find(".address1_input").val());
|
||||
$("input[name='memberAddr2']").val($(obj).find(".address2_input").val());
|
||||
$("input[name='memberAddr3']").val($(obj).find(".address3_input").val());
|
||||
}
|
||||
});
|
||||
|
||||
/* 사용 포인트 */
|
||||
$("input[name='usePoint']").val($(".order_point_input").val());
|
||||
|
||||
/* 상품정보 */
|
||||
let form_contents = '';
|
||||
$(".goods_table_price_td").each(function(index, element){
|
||||
let bookId = $(element).find(".individual_bookId_input").val();
|
||||
let bookCount = $(element).find(".individual_bookCount_input").val();
|
||||
let bookId_input = "<input name='orders[" + index + "].bookId' type='hidden' value='" + bookId + "'>";
|
||||
form_contents += bookId_input;
|
||||
let bookCount_input = "<input name='orders[" + index + "].bookCount' type='hidden' value='" + bookCount + "'>";
|
||||
form_contents += bookCount_input;
|
||||
});
|
||||
$(".order_form").append(form_contents);
|
||||
|
||||
/* 서버 전송 */
|
||||
$(".order_form").submit();
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user