Sfoglia il codice sorgente

이태영 - 20210503 장바구니 모바일 헤더 장바구니 수량 추가

xodud1202 5 anni fa
parent
commit
aba2e4ddec

+ 26 - 0
src/main/java/com/style24/front/biz/service/TsfCartService.java

@@ -511,6 +511,32 @@ public class TsfCartService {
 		return order;
 	}
 
+	// 장바구니 수량 계산(품절제거)
+	@SuppressWarnings("unchecked")
+	public Order getCartNotSoldoutCnt() {
+		Order order = new Order();
+		//ModelAndView result = new ModelAndView();
+		GagaMap result = new GagaMap();							// return
+		List<Integer> cartSqs = new ArrayList<Integer>();				// 품절 제외 장바구니 리스트
+
+		// 로그인 체크
+		if(TsfSession.isLogin()) {
+			order.setCustNo(TsfSession.getInfo().getCustNo());
+		} else {
+			order.setCustNo(0);
+		}
+		order.setFrontGb(TsfSession.getFrontGb());
+		order.setJsessionId(TscSession.getSessionId());
+
+		// 장바구니 상품 조회
+		Collection<Order> cartGoodsList = cartDao.getCartGoodsList(order);
+
+		// 총계 금액 계산 (수량 계산 내부에 존재)
+		setCartListTotAmtInfo(cartGoodsList, order);
+
+		return order;
+	}
+
 	/**
 	 * 다다익선 할인 금액 조회
 	 * @param param

+ 12 - 4
src/main/java/com/style24/front/biz/web/TsfCartController.java

@@ -359,10 +359,6 @@ public class TsfCartController extends TsfBaseController {
 	@ResponseBody
 	public Order getCartList() {
 		Order cart = new Order();
-		int custNo = 0;
-		if(TsfSession.isLogin()) {
-			custNo = TsfSession.getInfo().getCustNo();
-		}
 
 		// 장바구니 상품목록
 		cart = cartService.getCartGoodsList(cart);
@@ -380,6 +376,18 @@ public class TsfCartController extends TsfBaseController {
 		return cart;
 	}
 
+	/**
+	 * 장바구니 수량 조회(모바일 헤더)
+	 * @return
+	 * @author xodud1202
+	 * @since 2021. 05. 04
+	 */
+	@ResponseBody
+	@GetMapping("/goods/not/soldout/cnt")
+	public Order getCartNotSoldoutCnt() {
+		return cartService.getCartNotSoldoutCnt();
+	}
+
 	/**
 	 * 상품 품절 제외 옵션 조회
 	 * @param param

+ 11 - 1
src/main/webapp/WEB-INF/views/mob/common/fragments/FooterMob.html

@@ -113,7 +113,17 @@
 
 <script th:inline="javascript">
 /*<![CDATA[*/
-	$(document).ready( function() {
+	$(document).ready(function() {
+		$.getJSON('/cart/goods/not/soldout/cnt', function (order, status) {
+			let cartCnt;
+			if (order.totCartCnt > 99) {
+				cartCnt = "99+";
+			} else {
+				cartCnt = order.totCartCnt;
+			}
+
+			$("header #htopSub .button_wrap .store>span").text(cartCnt);
+		});
 	});
 /*]]>*/
 </script>

+ 14 - 0
src/main/webapp/ux/style24_link.js

@@ -282,6 +282,20 @@ function cfnAddCart(cartList) {
 						// PC버전에서만 동작해야함(퀵메뉴)
 						if (navigator.userAgent.indexOf('Mobile') == -1) {
 							fnGetCartGoodsList();
+						} else {
+							if($("header #htopSub .button_wrap .store>span")) {
+								// 장바구니 수량 조회
+								$.getJSON('/cart/goods/not/soldout/cnt', function (order, status) {
+									let cartCnt;
+									if (order.totCartCnt > 99) {
+										cartCnt = "99+";
+									} else {
+										cartCnt = order.totCartCnt;
+									}
+									
+									$("header #htopSub .button_wrap .store>span").text(cartCnt);
+								});
+							}
 						}
 						
 						// 장바구니 팝업에서