ソースを参照

Merge remote-tracking branch 'origin/xodud1202' into jsh77b

jsh77b 5 年 前
コミット
559fe36244

+ 2 - 0
src/main/java/com/style24/front/biz/dao/TsfCartDao.java

@@ -131,4 +131,6 @@ public interface TsfCartDao {
      * @since 2021. 02. 08
      */
     Collection<Order> getCartListDelvFeeInfoList(Order param);
+
+    void deleteCart(Cart param);
 }

+ 18 - 0
src/main/java/com/style24/front/biz/dao/TsfCustomerDao.java

@@ -29,4 +29,22 @@ public interface TsfCustomerDao {
 	 * @since 2021. 02. 18
 	 */
 	Customer getCustomerInfo(Customer customer);
+
+	/**
+	 * 고객 데이터 생성
+	 * @param customer - 고객정보
+	 * @return 성공여부 - 카운트
+	 * @author jsshin
+	 * @since 2021. 02. 19
+	 */
+	int createCustomer(Customer customer);
+
+	/**
+	 * 고객소셜 데이터 생성
+	 * @param customer - 고객정보
+	 * @return 성공여부 - 카운트
+	 * @author jsshin
+	 * @since 2021. 02. 22
+	 */
+	int createCustomerSns(Customer customer);
 }

+ 168 - 250
src/main/java/com/style24/front/biz/service/TsfCartService.java

@@ -2,6 +2,8 @@ package com.style24.front.biz.service;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -21,6 +23,7 @@ import com.style24.persistence.domain.Cart;
 import com.style24.persistence.domain.Coupon;
 import com.style24.persistence.domain.Goods;
 import com.style24.persistence.domain.GoodsStock;
+import com.style24.persistence.domain.Login;
 import com.style24.persistence.domain.Order;
 
 import lombok.extern.slf4j.Slf4j;
@@ -52,17 +55,21 @@ public class TsfCartService {
 	 */
 	public String saveCartInfo(Collection<Cart> params) {
 		Cart cart = new Cart();
-		// JSESSION_ID 저장
-
 
 		// 로그인 유무 확인 (로그인이 되어 있지 않으면 regNo 를 0으로 장바구니에 저장한다.)
-		// TODO 로그인여부체크
+		Login login = new Login();
+		if(TsfSession.isLogin()) {
+			login = TsfSession.getInfo();
+		} else {
+			 login.setCustNo(0);
+		}
 
 		// 장바구니 상품 및 재고 가능 여부 체크
 		for(Cart param : params) {
 			cart.setJsessionId(TscSession.getSessionId());
-			cart.setRegNo(0);
-			cart.setUpdNo(0);
+			cart.setRegNo(login.getCustNo());
+			cart.setUpdNo(login.getCustNo());
+			cart.setCustNo(login.getCustNo());
 
 			// 상품 마스터 정보 확인
 			Goods goods = new Goods();
@@ -114,10 +121,18 @@ public class TsfCartService {
 		Cart cart = new Cart();
 		StringBuilder sb = new StringBuilder();
 
-		// TODO 로그인 정보 세팅
-		cart.setRegNo(1000006);
-		cart.setCustNo(1000006);
-		cart.setUpdNo(1000006);
+		// 로그인 정보
+		if(TsfSession.isLogin()) {
+			Login login = TsfSession.getInfo();
+			cart.setRegNo(login.getCustNo());
+			cart.setCustNo(login.getCustNo());
+			cart.setUpdNo(login.getCustNo());
+		} else {
+			cart.setCustNo(0);
+			cart.setRegNo(0);
+			cart.setUpdNo(0);
+		}
+
 		cart.setJsessionId(TscSession.getSessionId());
 
 		// 장바구니 보유 CART_SQ 쿼리
@@ -187,11 +202,19 @@ public class TsfCartService {
 
 	@Transactional("shopTxnManager")
 	public void saveNormalDealCartInfo(Cart param) {
-		// TODO 로그인 정보 세팅
+		// 로그인 정보
+		if(TsfSession.isLogin()) {
+			Login login = TsfSession.getInfo();
+			param.setRegNo(login.getCustNo());
+			param.setCustNo(login.getCustNo());
+			param.setUpdNo(login.getCustNo());
+		} else {
+			param.setCustNo(0);
+			param.setRegNo(0);
+			param.setUpdNo(0);
+		}
 		param.setJsessionId(TscSession.getSessionId());
-		param.setRegNo(1000006);
-		param.setCustNo(1000006);
-		param.setUpdNo(1000006);
+
 
 		if("C".equals(param.getCartGb())) {
 			param.setCartGb(TscConstants.CartGb.CART.value());
@@ -229,101 +252,62 @@ public class TsfCartService {
 	public Order getCartGoodsList(Order order) {
 		//ModelAndView result = new ModelAndView();
 		GagaMap result = new GagaMap();							// return
-		List<Integer> cartSqs = new ArrayList<Integer>();		// 품절 제외 장바구니 리스트
+		List<Integer> cartSqs = new ArrayList<Integer>();				// 품절 제외 장바구니 리스트
 
-		// Device check
+		// 로그인 체크
+		if(TsfSession.isLogin()) {
+			order.setCustNo(TsfSession.getInfo().getCustNo());
+		}
 		order.setFrontGb(TsfSession.getFrontGb());
-
-		// TODO 로그인 체크
 		order.setJsessionId(TscSession.getSessionId());
-		order.setJsessionId("aaec62cc-5f91-47bb-ba65-ebc9a61385cf");
-		order.setCustNo(1000006);
-		order.setRegNo(1000006);
-		order.setUpdNo(1000006);
 
 		// 장바구니 상품 조회
 		Collection<Order> cartGoodsList = cartDao.getCartGoodsList(order);
 
-		// 품절체크
+		// 품절 아닌 상품만 체크
 		for(Order goods : cartGoodsList) {
-			// 상품 재고 확인
-			GoodsStock checkParam = new GoodsStock();
-
-			String stockResult = "";
-			// 세트 상품일 경우
-			if(TscConstants.GoodsType.SET.value().equals(goods.getGoodsType())) {
-				Order tempItem = new Order();
-				// 세트 구성품이 여러개일 경우
-				if (goods.getItemCd().contains(",")) {
-					tempItem.setItemCdArr(goods.getItemCd().split(","));
-					tempItem.setOptCdArr(goods.getOptCd().split(","));
-					for(int i = 0 ; i < tempItem.getItemCdArr().length ; i++) {
-						checkParam.setGoodsCd(goods.getGoodsCd());
-						checkParam.setItemCd(tempItem.getItemCdArr()[i]);
-						checkParam.setOptCd(tempItem.getOptCdArr()[i]);
-						checkParam.setGoodsQty(goods.getGoodsQty());
-						checkParam.setGoodsType(goods.getGoodsType());
-						stockResult = goodsService.getCheckStock(checkParam);
-					}
-				} else {		// 세트 구성품이 하나일 경우
-					checkParam.setGoodsCd(goods.getGoodsCd());
-					checkParam.setItemCd(goods.getItemCd());
-					checkParam.setOptCd(goods.getOptCd());
-					checkParam.setGoodsQty(goods.getGoodsQty());
-					checkParam.setGoodsType(goods.getGoodsType());
-					stockResult = goodsService.getCheckStock(checkParam);
-				}
-			} else {
-				// 세트상품이 아닐 경우
-				checkParam.setGoodsCd(goods.getGoodsCd());
-				checkParam.setItemCd(goods.getItemCd());
-				checkParam.setOptCd(goods.getOptCd());
-				checkParam.setGoodsQty(goods.getGoodsQty());
-				checkParam.setGoodsType(goods.getGoodsType());
-				stockResult = goodsService.getCheckStock(checkParam);
-			}
-
-			//String stockResult = "SUCCESS";
-
-			if("SUCCESS".equals(stockResult)) {
-				goods.setSoldoutYn("N");
+			if("N".equals(goods.getSoldoutYn())) {
 				cartSqs.add(goods.getCartSq());
-			} else {
-				goods.setSoldoutYn("Y");
 			}
 		}
 
 		order.setCartSqArr(cartSqs.stream().mapToInt(Integer::intValue).toArray());
 
-		// 다다익선 할인 상품 조회 (품절 상품 제외)
-		Collection<Order> moreBetterAmtList = getMoreBetterAmtList(order);
+		if(cartSqs.size() > 0) {
+			// 다다익선 할인 상품 조회 (품절 상품 제외)
+			Collection<Order> moreBetterAmtList = new ArrayList<Order>();
+			if(order.getCustNo() > 0) {
+				moreBetterAmtList = getMoreBetterAmtList(order);
+			}
+
+			// 다다익선 할인 정보 및 상품 정보 장바구니에 등록
+			for (Order cart : cartGoodsList) {
+				for (Order info : moreBetterAmtList) {
+					if (cart.getCartSq() == info.getCartSq()) {
+						cart.setTmtbDcAmt(info.getTmtbDcAmt());
+						cart.setApplyAmtSectionYn(info.getApplyAmtSectionYn());
+						cart.setApplyQtySectionYn(info.getApplyQtySectionYn());
+						cart.setQtyTmtbNm(info.getQtyTmtbNm());
+						cart.setAmtTmtbNm(info.getAmtTmtbNm());
+						cart.setQtyTmtbSq(info.getQtyTmtbSq());
+						cart.setAmtTmtbSq(info.getAmtTmtbSq());
+					}
+				}
 
-		// 다다익선 할인 정보 및 상품 정보 장바구니에 등록
-		for(Order cart : cartGoodsList) {
-			for(Order info : moreBetterAmtList) {
-				if(cart.getCartSq() == info.getCartSq()) {
-					cart.setTmtbDcAmt(info.getTmtbDcAmt());
-					cart.setApplyAmtSectionYn(info.getApplyAmtSectionYn());
-					cart.setApplyQtySectionYn(info.getApplyQtySectionYn());
-					cart.setQtyTmtbNm(info.getQtyTmtbNm());
-					cart.setAmtTmtbNm(info.getAmtTmtbNm());
-					cart.setQtyTmtbSq(info.getQtyTmtbSq());
-					cart.setAmtTmtbSq(info.getAmtTmtbSq());
+				if (cart.getTmtbDcAmt() == 0) {
+					cart.setTmtbDcAmt(cart.getCurrPrice());
 				}
 			}
-			if(cart.getTmtbDcAmt() == 0) {
-				cart.setTmtbDcAmt(cart.getCurrPrice());
-			}
-		}
 
-		// 장바구니 업체별 배송비 계산
-		setCartListDelvFeeInfo(cartGoodsList);
+			// 장바구니 업체별 배송비 계산
+			setCartListDelvFeeInfo(cartGoodsList);
 
-		// 자사 / 입점업체 리스트 분리
-		order = getCartDelvGoodsCntList(cartGoodsList);
+			// 자사 / 입점업체 리스트 분리
+			order = getCartDelvGoodsCntList(cartGoodsList);
 
-		// 총계 금액 계산
-		setCartListTotAmtInfo(cartGoodsList, order);
+			// 총계 금액 계산
+			setCartListTotAmtInfo(cartGoodsList, order);
+		}
 
 		return order;
 	}
@@ -342,203 +326,140 @@ public class TsfCartService {
 		Collection<Order> cartGoodsList = coreOrderService.getCartGoodsList(param);
 
 		// 장바구니 내 수량 다다익선 적용 가능 리스트 조회 (등록된 기본,적용 상품 정보 전체 조회)
-		param.setApplyGb(TscConstants.ApplyGb.QTY.value());
-		Collection<Order> tmtbQtyApplyList = cartDao.selectMoreBetterApplyCartList(param);
+		Collection<Order> tmtbApplyList = cartDao.selectMoreBetterApplyCartList(param);
 
-		// 장바구니에 담긴 상품 금액 즉시할인가를 tmtbApplyList 에 저장 (추후 계산식을 위함)
-		for(Order cart : cartGoodsList) {
-			for(Order apply : tmtbQtyApplyList) {
-				if(cart.getCartSq() == apply.getCartSq()) {
-					apply.setCurrPrice(cart.getCurrPrice() + cart.getOptAddPrice());        /* 즉시할인 적용가 */
-				}
-			}
-		}
-
-		// 장바구니 등록 수량 다다익선 일련번호 지정
+		// 장바구니 등록 다다익선 일련번호 지정
+		List<Integer> applySq = new ArrayList<Integer>();
 		List<Integer> qtyApplySq = new ArrayList<Integer>();
-		for(Order tmtbApply : tmtbQtyApplyList) {
-			if(TscConstants.GoodsGb.BASE.value().equals(tmtbApply.getGoodsGb())) {
-				qtyApplySq.add(tmtbApply.getTmtbSq());
-			}
-		}
-		param.setTmtbSqs(qtyApplySq.stream().mapToInt(Integer::intValue).toArray());
-
-		// 장바구니 등록 다다익선 총합 금액
-		Collection<Order> tmtbQtySumDataList = cartDao.selectApplyMoreBetterCartInfoList(param);
-		// 기본상품 목록에 총합 데이터 등록
-		for(Order applyInfo : tmtbQtyApplyList) {
-			for(Order tmtbSumInfo : tmtbQtySumDataList) {
-				if(applyInfo.getTmtbSq() == tmtbSumInfo.getTmtbSq()) {
-					applyInfo.setTmtbSumAmt(tmtbSumInfo.getTmtbSumAmt());
-					applyInfo.setTmtbSumQty(tmtbSumInfo.getTmtbSumQty());
+		List<Integer> amtApplySq = new ArrayList<Integer>();
+		for(Order tmtbApply : tmtbApplyList) {
+			if(TscConstants.GoodsGb.BASE.value().equals(tmtbApply.getQtyGoodsGb()) || TscConstants.GoodsGb.BASE.value().equals(tmtbApply.getAmtGoodsGb())) {
+				if(TscConstants.GoodsGb.BASE.value().equals(tmtbApply.getQtyGoodsGb())) {
+					applySq.add(tmtbApply.getQtyTmtbSq());
+				}
+				if(TscConstants.GoodsGb.BASE.value().equals(tmtbApply.getAmtGoodsGb())) {
+					applySq.add(tmtbApply.getAmtTmtbSq());
 				}
 			}
 		}
+		param.setTmtbSqs(applySq.stream().mapToInt(Integer::intValue).toArray());
 
 		// 섹션 정보 조회 후 할인 여부 판단
-		Collection<Order> tmtbQtySectionList = cartDao.selectTmtbSectionValList(qtyApplySq);
-		for(Order applyInfo : tmtbQtyApplyList) {						// 기준 상품 및 다다익선 정보 조회
-			for(Order section : tmtbQtySectionList) {						// 다다익선 할인 조건 조회
-				if(applyInfo.getTmtbSq() == section.getTmtbSq()) {
-					if(TscConstants.ApplyGb.QTY.value().equals(applyInfo.getApplyGb())) {		// 수량 적용
-						if(section.getSectionVal() <= applyInfo.getTmtbSumQty()) {				// 장바구니 수량 할인 기준 달성시
-							if(applyInfo.getSectionVal() <= section.getSectionVal()) {			// 기존 달성된 기준치보다 할인폭이 클 경우 기준할인 수정
-								applyInfo.setSectionVal(section.getSectionVal());
-								applyInfo.setApplyQtySectionYn("Y");
-								applyInfo.setDcWay(section.getDcWay());
-								applyInfo.setDcVal(section.getDcVal());
-							}
-						} else {
-							if(applyInfo.getSectionVal() < 1 && applyInfo.getGoodsGb().equals(TscConstants.GoodsGb.BASE.value())) {
-								applyInfo.setApplyQtySectionYn("N");
-							}
+		Collection<Order> tmtbSectionList = cartDao.selectTmtbSectionValList(applySq);
+		for(Order applyInfo : tmtbApplyList) {													// 기준 상품 및 다다익선 정보 조회
+			// 다다익선 할인 조건 조회
+			for(Order section : tmtbSectionList) {
+				if(applyInfo.getQtyTmtbSq() == section.getTmtbSq()) {
+					// 수량 적용 다다익선
+					if (section.getSectionVal() <= applyInfo.getQtyTmtbSumQty()) {             // 장바구니 수량 할인 기준 달성시
+						if (applyInfo.getQtySectionVal() <= section.getSectionVal()) {            // 기존 달성된 기준치보다 할인폭이 클 경우 기준할인 수정
+							applyInfo.setQtySectionVal(section.getSectionVal());
+							applyInfo.setApplyQtySectionYn("Y");
+							applyInfo.setQtyDcWay(section.getDcWay());
+							applyInfo.setQtyDcVal(section.getDcVal());
+						}
+					} else {
+						if (applyInfo.getQtySectionVal() < 1 && applyInfo.getQtyGoodsGb().equals(TscConstants.GoodsGb.BASE.value())) {
+							applyInfo.setApplyQtySectionYn("N");
+						}
+					}
+				}
+
+				if(applyInfo.getAmtTmtbSq() == section.getTmtbSq()) {
+					// 금액 적용 다다익선
+					if(section.getSectionVal() <= applyInfo.getAmtTmtbSumAmt()) {			// 장바구니 수량 할인 기준 달성시
+						if(applyInfo.getAmtSectionVal() <= section.getSectionVal()) {			// 기존 달성된 기준치보다 할인폭이 클 경우 기준할인 수정
+							applyInfo.setAmtSectionVal(section.getSectionVal());
+							applyInfo.setApplyAmtSectionYn("Y");
+							applyInfo.setAmtDcWay(section.getDcWay());
+							applyInfo.setAmtDcVal(section.getDcVal());
+						}
+					} else {
+						if(applyInfo.getAmtSectionVal() < 1 && applyInfo.getAmtGoodsGb().equals(TscConstants.GoodsGb.BASE.value())) {
+							applyInfo.setApplyAmtSectionYn("N");
 						}
 					}
 				}
 			}
 		}
 
+		// 수량 다다익선에 맞춰 정렬
+		Collections.sort((ArrayList<Order>) tmtbApplyList, new Comparator<Order>() {
+			@Override
+			public int compare(Order c1, Order c2) {
+				return c1.getQtyTmtbSq() - c2.getQtyTmtbSq();
+			}
+		});
+
+
+
 		// 수량 다다익선 적용 상품 할인 금액 계산
 		int leftAmt = 0;
 		int i = 0;
-		for(Order resultAmt : tmtbQtyApplyList) {
-			if("Y".equals(resultAmt.getApplyQtySectionYn())) {
-				if (TscConstants.DcWay.AMT.value().equals(resultAmt.getDcWay())) {        // 할인 방식 금액일경우
+
+		for(Order resultAmt : tmtbApplyList) {
+			if("Y".equals(resultAmt.getApplyQtySectionYn()) && resultAmt.getQtyTmtbSq() > 0) {
+				if (TscConstants.DcWay.AMT.value().equals(resultAmt.getQtyDcWay())) {        // 할인 방식 금액일경우
 					i++;
-					int tempAmt = resultAmt.getCurrPrice() * resultAmt.getGoodsQty();
+					int tempAmt = resultAmt.getCurrPrice();
+
 					if (i == 1) {
-						leftAmt = resultAmt.getDcVal();
+						leftAmt = resultAmt.getQtyDcVal();
 					}
 
-					if (i == resultAmt.getTmtbCnt()) {
+					if (i == resultAmt.getQtyTmtbCnt()) {
 						resultAmt.setTmtbDcAmt(tempAmt - leftAmt);
 						leftAmt = 0;
 						i = 0;
 					} else {
-						double tempDcAmt = resultAmt.getDcVal() * ((tempAmt) / (double)resultAmt.getTmtbSumAmt());
+						double tempDcAmt = resultAmt.getQtyDcVal() * ((tempAmt) / (double)resultAmt.getQtyTmtbSumAmt());
 						leftAmt -= (int)tempDcAmt;
 						resultAmt.setTmtbDcAmt(tempAmt - (int)tempDcAmt);
 					}
 				} else {                                                                // 할인 방식 할인율일 경우
-					int tempAmt = resultAmt.getCurrPrice() * resultAmt.getGoodsQty();
-					tempAmt = (int) (tempAmt - (tempAmt * (resultAmt.getDcVal() / 100.0)));
+					int tempAmt = resultAmt.getCurrPrice();
+					tempAmt = (int) (tempAmt - (tempAmt * (resultAmt.getQtyDcVal() / 100.0)));
 					resultAmt.setTmtbDcAmt(tempAmt);
 				}
 			}
-		}
-
-		// 장바구니 정보에 수량 다다익선 정보 입력
-		for(Order cart : cartGoodsList) {
-			for(Order apply : tmtbQtyApplyList) {
-				if(cart.getCartSq() == apply.getCartSq()) {
-					cart.setTmtbDcAmt(apply.getTmtbDcAmt());
-					cart.setApplyQtySectionYn(apply.getApplyQtySectionYn());
-					cart.setQtyTmtbNm(apply.getTmtbNm());
-					cart.setQtyTmtbSq(apply.getTmtbSq());
-				}
-			}
-		}
-
-		// 장바구니 내 금액 다다익선 적용 가능 리스트 조회 (등록된 기본,적용 상품 정보 전체 조회)
-		param.setApplyGb(TscConstants.ApplyGb.AMT.value());
-		Collection<Order> tmtbAmtApplyList = cartDao.selectMoreBetterApplyCartList(param);
-
-		// 장바구니에 담긴 상품 금액 즉시할인가를 tmtbAmtApplyList 에 저장 (추후 계산식을 위함)
-		for(Order cart : cartGoodsList) {
-			for(Order apply : tmtbAmtApplyList) {
-				if(cart.getCartSq() == apply.getCartSq()) {
-					if (StringUtils.isEmpty(cart.getQtyTmtbNm())) {
-						apply.setCurrPrice((cart.getCurrPrice() + cart.getOptAddPrice()) * cart.getGoodsQty());
-					} else {
-						apply.setCurrPrice(cart.getTmtbDcAmt());                                                    /* 수량 다다익선 할인된 금액 적용 */
-					}
-				}
-			}
-		}
-
-		// 장바구니 등록 수량 다다익선 일련번호 지정
-		List<Integer> amtApplySq = new ArrayList<Integer>();
-		for(Order tmtbApply : tmtbAmtApplyList) {
-			if(TscConstants.GoodsGb.BASE.value().equals(tmtbApply.getGoodsGb())) {
-				amtApplySq.add(tmtbApply.getTmtbSq());
-			}
-		}
-		param.setTmtbSqs(amtApplySq.stream().mapToInt(Integer::intValue).toArray());
 
-		// 장바구니 등록 금액 다다익선 총합 금액
-		Collection<Order> tmtbAmtSumDataList = cartDao.selectApplyMoreBetterCartInfoList(param);
-
-		Map<Integer, Integer> tmtbAmtSumData = new HashMap<Integer, Integer>();		// 각 상품별 할인 금액을 다다익선별 SUM하기 위한 MAP
-		for(Order applyInfo : tmtbAmtApplyList) {
-			// SUM AMT는 할인된 금액으로 묶어야함.
-			if(tmtbAmtSumData.get(applyInfo.getTmtbSq()) != null && tmtbAmtSumData.get(applyInfo.getTmtbSq()) > 0) {
-				tmtbAmtSumData.put(applyInfo.getTmtbSq(), tmtbAmtSumData.get(applyInfo.getTmtbSq()) + applyInfo.getCurrPrice());
-			} else {
-				tmtbAmtSumData.put(applyInfo.getTmtbSq(), applyInfo.getCurrPrice());
+			if(resultAmt.getTmtbDcAmt() > 0) {
+				resultAmt.setCurrPrice(resultAmt.getTmtbDcAmt());
 			}
 		}
 
-		// 기본상품 목록에 총합 데이터 등록
-		for(Order applyInfo : tmtbAmtApplyList) {
-			for(Order tmtbSumInfo : tmtbAmtSumDataList) {
-				if(applyInfo.getTmtbSq() == tmtbSumInfo.getTmtbSq()) {
-					applyInfo.setTmtbSumQty(tmtbSumInfo.getTmtbSumQty());
-
-					if(tmtbAmtSumData.get(applyInfo.getTmtbSq()) != null && tmtbAmtSumData.get(applyInfo.getTmtbSq()) > 0) {
-						applyInfo.setTmtbSumAmt(tmtbAmtSumData.get(applyInfo.getTmtbSq()));
-					}
-				}
-			}
-		}
-
-
-		// 섹션 정보 조회 후 할인 여부 판단
-		Collection<Order> tmtbAmtSectionList = cartDao.selectTmtbSectionValList(amtApplySq);
-		for(Order applyInfo : tmtbAmtApplyList) {					// 기준 상품 및 다다익선 정보 조회
-			for(Order section : tmtbAmtSectionList) {					// 다다익선 할인 조건 조회
-				if(applyInfo.getTmtbSq() == section.getTmtbSq()) {
-					if (TscConstants.ApplyGb.AMT.value().equals(applyInfo.getApplyGb())) {
-						if(section.getSectionVal() <= applyInfo.getTmtbSumAmt()) {				// 장바구니 수량 할인 기준 달성시
-							if(applyInfo.getSectionVal() <= section.getSectionVal()) {			// 기존 달성된 기준치보다 할인폭이 클 경우 기준할인 수정
-								applyInfo.setSectionVal(section.getSectionVal());
-								applyInfo.setApplyAmtSectionYn("Y");
-								applyInfo.setDcWay(section.getDcWay());
-								applyInfo.setDcVal(section.getDcVal());
-							}
-						} else {
-							if(applyInfo.getSectionVal() < 1 && applyInfo.getGoodsGb().equals(TscConstants.GoodsGb.BASE.value())) {
-								applyInfo.setApplyAmtSectionYn("N");
-							}
-						}
-					}
-				}
+		// 금액 다다익선에 맞춰 정렬
+		Collections.sort((ArrayList<Order>) tmtbApplyList, new Comparator<Order>() {
+			@Override
+			public int compare(Order c1, Order c2) {
+				return c1.getAmtTmtbSq() - c2.getAmtTmtbSq();
 			}
-		}
+		});
 
 		// 금액 다다익선 할인 계산
 		leftAmt = 0;
 		i = 0;
-		for(Order resultAmt : tmtbAmtApplyList) {
-			if("Y".equals(resultAmt.getApplyAmtSectionYn())) {
-				if (TscConstants.DcWay.AMT.value().equals(resultAmt.getDcWay())) {        // 할인 방식 금액일경우
+		for(Order resultAmt : tmtbApplyList) {
+			if("Y".equals(resultAmt.getApplyAmtSectionYn()) && resultAmt.getAmtTmtbSq() > 0) {
+				if (TscConstants.DcWay.AMT.value().equals(resultAmt.getAmtDcWay())) {        // 할인 방식 금액일경우
 					i++;
 					int tempAmt = resultAmt.getCurrPrice();
 					if (i == 1) {
-						leftAmt = resultAmt.getDcVal();
+						leftAmt = resultAmt.getAmtDcVal();
 					}
 
-					if (i == resultAmt.getTmtbCnt()) {
+					if (i == resultAmt.getAmtTmtbCnt()) {
 						resultAmt.setTmtbDcAmt(tempAmt - leftAmt);
 						leftAmt = 0;
 						i = 0;
 					} else {
-						double tempDcAmt = resultAmt.getDcVal() * ((tempAmt) / (double)resultAmt.getTmtbSumAmt());
+						double tempDcAmt = resultAmt.getAmtDcVal() * ((tempAmt) / (double)resultAmt.getAmtTmtbSumAmt());
 						leftAmt -= (int)tempDcAmt;
 						resultAmt.setTmtbDcAmt(tempAmt - (int)tempDcAmt);
 					}
 				} else {                                                                // 할인 방식 할인율일 경우
 					int tempAmt = resultAmt.getCurrPrice();
-					tempAmt = (int) (tempAmt - (tempAmt * (resultAmt.getDcVal() / 100.0)));
+					tempAmt = (int) (tempAmt - (tempAmt * (resultAmt.getAmtDcVal() / 100.0)));
 					resultAmt.setTmtbDcAmt(tempAmt);
 				}
 			}
@@ -546,14 +467,15 @@ public class TsfCartService {
 
 		// 장바구니 정보에 수량 다다익선 정보 입력
 		for(Order cart : cartGoodsList) {
-			for(Order apply : tmtbAmtApplyList) {
+			for(Order apply : tmtbApplyList) {
 				if(cart.getCartSq() == apply.getCartSq()) {
-					if(apply.getTmtbDcAmt() > 0) {
-						cart.setTmtbDcAmt(apply.getTmtbDcAmt());
-					}
+					cart.setTmtbDcAmt(apply.getTmtbDcAmt());
+					cart.setApplyQtySectionYn(apply.getApplyQtySectionYn());
+					cart.setQtyTmtbNm(apply.getQtyTmtbNm());
+					cart.setQtyTmtbSq(apply.getQtyTmtbSq());
 					cart.setApplyAmtSectionYn(apply.getApplyAmtSectionYn());
-					cart.setAmtTmtbNm(apply.getTmtbNm());
-					cart.setAmtTmtbSq(apply.getTmtbSq());
+					cart.setAmtTmtbNm(apply.getAmtTmtbNm());
+					cart.setAmtTmtbSq(apply.getAmtTmtbSq());
 				}
 			}
 		}
@@ -590,9 +512,6 @@ public class TsfCartService {
 				order.setItemQtyArr(arr3);
 			}
 
-			// 1.2 즉시할인 적용가 * 주문수량(장바구니수량)
-			order.setCurrPrice(order.getCurrPrice() * order.getGoodsQty());
-
 			// 1.3 배송정책별 상품 구분
 			if (order.getDelvFeeCd().equals("WMS")) {
 				wmsCartList.add(order);
@@ -628,7 +547,7 @@ public class TsfCartService {
 				if(param.getDelvFeeCd().equals(delv.getDelvFeeCd())) {
 					compCnt++;
 					if("N".equals(param.getSoldoutYn())) {
-						delv.setCompSumPrice(delv.getCompSumPrice() + (param.getCurrPrice() * param.getGoodsQty()));
+						delv.setCompSumPrice(delv.getCompSumPrice() + param.getCurrPrice());
 					}
 
 					if(compCnt == 1) {
@@ -661,9 +580,9 @@ public class TsfCartService {
 		int wmsSumPrice = 0;
 		compCnt = 0;
 		for(Order param : params) {
-			compCnt++;
 			if("WMS".equals(param.getDelvFeeCd())) {
-				wmsSumPrice = wmsSumPrice + (param.getCurrPrice() * param.getGoodsQty());
+				compCnt++;
+				wmsSumPrice = wmsSumPrice + param.getCurrPrice();
 				if(compCnt == 1) {
 					param.setFirstCompYn("Y");
 				}
@@ -685,18 +604,13 @@ public class TsfCartService {
 	public void setCartListTotAmtInfo(Collection<Order> cartGoodsList, Order order) {
 		// 장바구니 합계 금액 계산
 		int notSoldoutCnt = 0;
+
 		for(Order cart : cartGoodsList) {
 			if("N".equals(cart.getSoldoutYn())) {
 				notSoldoutCnt++;
 				// 상품 금액 합계
 				order.setSumOrdAmt(order.getSumOrdAmt() + cart.getCurrPrice());
-
-				// 할인 제외 금액 총계
-				if(cart.getTmtbDcAmt() == 0) {
-					order.setSumRealPayAmt(order.getSumRealPayAmt() + cart.getCurrPrice());
-				} else {
-					order.setSumRealPayAmt(order.getSumRealPayAmt() + cart.getTmtbDcAmt());
-				}
+				order.setSumRealPayAmt(order.getSumRealPayAmt() + cart.getTmtbDcAmt());
 
 				// 배송비 합계
 				if("Y".equals(cart.getFirstCompYn())) {
@@ -711,4 +625,8 @@ public class TsfCartService {
 		// 장바구니 총액 계산 상품 총 수량
 		order.setTotCartCnt(notSoldoutCnt);
 	}
+
+	public void deleteCart(Cart param) {
+		cartDao.deleteCart(param);
+	}
 }

+ 45 - 23
src/main/java/com/style24/front/biz/service/TsfCouponService.java

@@ -15,6 +15,7 @@ import com.style24.front.biz.dao.TsfCouponDao;
 import com.style24.front.support.security.session.TsfSession;
 import com.style24.persistence.domain.Coupon;
 import com.style24.persistence.domain.CustCoupon;
+import com.style24.persistence.domain.Login;
 import com.style24.persistence.domain.Order;
 
 import lombok.extern.slf4j.Slf4j;
@@ -58,9 +59,13 @@ public class TsfCouponService {
 	 */
 	public Coupon serialCpnApplyInfo(Coupon param) {
 		// TODO 로그인 정보 입력
-		param.setCustNo(1000006);
-		param.setRegNo(1000006);
-		param.setUpdNo(1000006);
+		if(TsfSession.isLogin()) {
+			Login login = TsfSession.getInfo();
+			param.setCustNo(login.getCustNo());
+			param.setRegNo(login.getCustNo());
+			param.setUpdNo(login.getCustNo());
+		}
+
 		param.setFrontGb(TsfSession.getFrontGb());
 
 		// 시리얼키의 쿠폰이 다운로드 가능한지 확인
@@ -121,30 +126,47 @@ public class TsfCouponService {
 		int totCurrPrice = 0;
 		int maxDcAmt = 0;
 		int buyLimitAmt = 0;
+		log.info("CHECK INFO >> {}", 1);
+		if(param != null && param.getCartSqArr().length > 0) {
+			log.info("CHECK INFO >> {}", 2);
+			Collection<Order> serialGoodsList = coreOrderService.getSerialCpnApplyGoodsList(order);
+			log.info("CHECK INFO >> {} / {}", 3, serialGoodsList.size());
+			for (int i = 0; i < param.getCartSqArr().length; i++) {
+				log.info("CHECK INFO >> {}", 4);
+				for (Order cpnInfo : serialGoodsList) {
+					if("A".equals(cpnInfo.getApplyScope()) || param.getCartSqArr()[i] == cpnInfo.getCartSq()) {
+						cpnInfo.setCurrPrice(param.getCurrPrices()[i]);
+						log.info("CHECK INFO >> {}", param.getCurrPrices()[i]);
+					}
+				}
+			}
 
-		Collection<Order> serialGoodsList = coreOrderService.getSerialCpnApplyGoodsList(order);
-
-		// 각 필요 데이터 세팅
-		for(Order info : serialGoodsList) {
-			totCurrPrice = totCurrPrice + info.getCurrPrice();				// 적용 상품 구매 금액 합계((즉시할인쿠폰 + 옵션추가) * 수량)
-			maxDcAmt = info.getMaxDcAmt();									// 최대할인율과 최소주문금액은 한 쿠폰에 값이 동일
-			buyLimitAmt = info.getBuyLimitAmt();							// 최대할인율과 최소주문금액은 한 쿠폰에 값이 동일
-			if(TscConstants.DcWay.RATE.value().equals(info.getDcWay())) {	// 할인방식이 할인율이면 각 상품별 할인금액을 따로 계산해야함
-				int dcAmt = (int) (info.getCurrPrice() * (info.getDcVal() / 100.0));		// 해당상품 할인금
-				totDcAmt = totDcAmt + dcAmt;								// 적용 상품 총 할인금액
-			} else {														// 할인 방식이 금액일 경우
-				totDcAmt = info.getDcVal();
+			// 각 필요 데이터 세팅
+			for (Order info : serialGoodsList) {
+				totCurrPrice = totCurrPrice + info.getCurrPrice();					// 적용 상품 구매 금액 합계((즉시할인쿠폰 + 옵션추가) * 수량)
+				maxDcAmt = info.getMaxDcAmt();										// 최대할인율과 최소주문금액은 한 쿠폰에 값이 동일
+				buyLimitAmt = info.getBuyLimitAmt();								// 최대할인율과 최소주문금액은 한 쿠폰에 값이 동일
+				if (TscConstants.DcWay.RATE.value().equals(info.getDcWay())) {		// 할인방식이 할인율이면 각 상품별 할인금액을 따로 계산해야함
+					int dcAmt = (int)(info.getCurrPrice() * (info.getDcVal() / 100.0));		// 해당상품 할인금
+					totDcAmt = totDcAmt + dcAmt;									// 적용 상품 총 할인금액
+				} else {															// 할인 방식이 금액일 경우
+					totDcAmt = info.getDcVal();
+				}
 			}
-		}
 
-		// 최대 할인 금액 요건 확인 (0은 제한 없음. 최대 할인 금액보다 할인금액이 크다면 최대할인금액만큼만 할인)
-		if(maxDcAmt > 0 && maxDcAmt < totDcAmt) {
-			totDcAmt = maxDcAmt;
-		}
+			if(totCurrPrice < totDcAmt) {
+				totDcAmt = totCurrPrice;
+			}
 
-		// 주문 최소 금액 요건 확인 (최소 주문 금액보다 총 상품 금액이 적으면 0원으로 세팅)
-		if(buyLimitAmt > totCurrPrice) {
-			totDcAmt = 0;
+			// 최대 할인 금액 요건 확인 (0은 제한 없음. 최대 할인 금액보다 할인금액이 크다면 최대할인금액만큼만 할인)
+			if (maxDcAmt > 0 && maxDcAmt < totDcAmt) {
+				totDcAmt = maxDcAmt;
+			}
+
+			// 주문 최소 금액 요건 확인 (최소 주문 금액보다 총 상품 금액이 적으면 0원으로 세팅)
+			if (buyLimitAmt > totCurrPrice) {
+				totDcAmt = 0;
+			}
 		}
 
 		return totDcAmt;

+ 56 - 2
src/main/java/com/style24/front/biz/service/TsfCustomerService.java

@@ -1,10 +1,13 @@
 package com.style24.front.biz.service;
 
 import com.gagaframework.web.parameter.GagaMap;
+import com.gagaframework.web.security.GagaPasswordEncoder;
 import com.style24.core.biz.service.TscCustomerService;
 import com.style24.core.support.env.TscConstants;
 import com.style24.core.support.session.TscSession;
+import com.style24.persistence.domain.Coupon;
 import com.style24.persistence.domain.Customer;
+import com.style24.persistence.domain.Point;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -30,6 +33,8 @@ public class TsfCustomerService {
 	@Autowired
 	private TscCustomerService coreCustomerService;
 
+	@Autowired
+	private GagaPasswordEncoder passwordEncoder;
 
 	/**
 	 * 고객아이디 찾기
@@ -65,6 +70,7 @@ public class TsfCustomerService {
 	 */
 	@Transactional("shopTxnManager")
 	public void saveCustomerPassword(Customer customer) {
+		customer.setEncodedPasswd(passwordEncoder.encode(customer.getPasswd()));
 		coreCustomerService.saveCustomerPassword(customer);
 	}
 
@@ -183,14 +189,62 @@ public class TsfCustomerService {
 	}
 
 	/**
-	 * 회원가입
+	 * 회원가입 처리
 	 * @param customer - 일반가입, SNS 가입
 	 * @author jsshin
 	 * @since 2021. 02. 19
 	 */
 	@Transactional("shopTxnManager")
 	public void saveJoinCustomer(Customer customer) {
-		//
+		boolean isSnsJoin = isSnsJoin(customer);
+		if (isSnsJoin) {
+			customer.setEncodedPasswd(" ");
+		} else {
+			customer.setEncodedPasswd(passwordEncoder.encode(customer.getPasswd()));
+		}
+		customer.encryptData();
+		customerDao.createCustomer(customer);
+		saveJoinPostProcessing(customer);
+	}
+
+	/**
+	 * 가입 후 처리 혜택(쿠폰,포인트)
+	 * @param customer - 일반가입, SNS 가입
+	 * @author jsshin
+	 * @since 2021. 02. 19
+	 */
+	@Transactional("shopTxnManager")
+	public void saveJoinPostProcessing(Customer customer) {
+		// 1. 쿠폰
+		// 어드민 > 회원등급정책 관리 > 신규회원등급으로 설정된 쿠폰
+
+
+		// 2. 포인트
+		// 어드민 > 포인트 정책설정 > 신규회원 등록된 포인트
+
+
+	}
+	/**
+	 * SNS 가입인지 확인
+	 * @param customer - 일반가입, SNS 가입
+	 * @return boolean - sns 가입이면 true 아니면 false
+	 * @author jsshin
+	 * @since 2021. 02. 19
+	 */
+	public boolean isSnsJoin(Customer customer) {
+		boolean result = false;
+
+		if (StringUtils.isNotBlank(customer.getKkJoinId())) {
+			result = true;
+		}
+		if (StringUtils.isNotBlank(customer.getNvJoinId())) {
+			result = true;
+		}
+		if (StringUtils.isNotBlank(customer.getYsJoinId())) {
+			result = true;
+		}
+
+		return result;
 	}
 
 }

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

@@ -1,10 +1,8 @@
 package com.style24.front.biz.web;
 
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
-import java.util.List;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
@@ -16,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
-import org.thymeleaf.util.StringUtils;
 
 import com.gagaframework.web.parameter.GagaMap;
 import com.style24.core.biz.service.TscOrderService;
@@ -24,6 +21,7 @@ import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.front.biz.service.TsfCartService;
 import com.style24.front.biz.service.TsfCouponService;
 import com.style24.front.support.controller.TsfBaseController;
+import com.style24.front.support.security.session.TsfSession;
 import com.style24.persistence.domain.Cart;
 import com.style24.persistence.domain.Coupon;
 import com.style24.persistence.domain.Order;
@@ -121,7 +119,7 @@ public class TsfCartController extends TsfBaseController {
 			order.setShotDelvYn("N");
 		}
 
-		model.addAttribute("param", param);
+		model.addAttribute("loginInfo", TsfSession.getInfo());
 		model.addAttribute("order", order);
 		model.addAttribute("wmsCartList", order.getWmsCartList());
 		model.addAttribute("delvCartList", order.getDelvCartList());
@@ -130,6 +128,14 @@ public class TsfCartController extends TsfBaseController {
 		return super.getDeviceViewName("cart/cartListAjaxForm");
 	}
 
+	@ResponseBody
+	@PostMapping("/change/goods/list")
+	public Order selectCartGoodsJsonList(@RequestBody Order param) {
+		Order order = cartService.getCartGoodsList(param);
+		order.setImgPath1(env.getProperty("upload.goods.view"));
+		return order;
+	}
+
 	/**
 	 * 프로모션 할인 쿠폰 조회
 	 * @param param
@@ -151,4 +157,20 @@ public class TsfCartController extends TsfBaseController {
 
 		return result;
 	}
+
+	/**
+	 * 장바구니 삭제
+	 * @param param
+	 * rdCpnNm : 시리얼쿠폰명
+	 * cartSqArr[] : 장바구니 번호 배열
+	 * @return GagaMap
+	 * @author xodud1202
+	 * @since 2021. 02. 23
+	 */
+	@ResponseBody
+	@PostMapping("/deleteCart")
+	public GagaMap deleteCart(@RequestBody Cart param) {
+		cartService.deleteCart(param);
+		return new GagaMap();
+	}
 }

+ 21 - 8
src/main/java/com/style24/front/biz/web/TsfCustomerController.java

@@ -52,9 +52,6 @@ public class TsfCustomerController extends TsfBaseController {
 	@Autowired
 	private NiceCertify niceCertify;
 
-	@Autowired
-	private GagaPasswordEncoder passwordEncoder;
-
 	/**
 	 * 아이디 찾기 화면
 	 *
@@ -195,7 +192,6 @@ public class TsfCustomerController extends TsfBaseController {
 			log.info("tempPasswd  ====> {}", tempPasswd);
 			customer.setTempPasswdYn("Y"); // 임시비밀번호여부
 			customer.setPasswd(tempPasswd);
-			customer.setEncodedPasswd(passwordEncoder.encode(tempPasswd));
 			customer.setRegNo(custInfo.getCustNo());
 			customer.setUpdNo(custInfo.getCustNo());
 			customer.setCustNo(custInfo.getCustNo());
@@ -309,7 +305,6 @@ public class TsfCustomerController extends TsfBaseController {
 		Customer custInfo = customerService.getCustomerFindId(params);
 		if (custInfo != null) {
 			customer.setTempPasswdYn("N"); // 임시비밀번호여부
-			customer.setEncodedPasswd(passwordEncoder.encode(customer.getPasswd()));
 			customer.setRegNo(custInfo.getCustNo());
 			customer.setUpdNo(custInfo.getCustNo());
 			customer.setCustNo(custInfo.getCustNo());
@@ -570,27 +565,45 @@ public class TsfCustomerController extends TsfBaseController {
 		return result;
 	}
 
-
+	/**
+	 * 가입
+	 *
+	 * @param customer - 고객정보
+	 * @return GagaMap - 결과정보
+	 * @author jsshin
+	 * @since 2021. 02. 18
+	 */
 	@PostMapping("/join/save")
 	@ResponseBody
 	public GagaMap saveJoinCustomer(@RequestBody Customer customer) {
+		GagaMap result = new GagaMap();
 		String encData = TscSession.getAttribute("encData");
 		customer.setEncData(encData);
 		GagaMap authInfo = niceCertify.getCertifyCellPhoneResultInfo(customer);
+		customer.setCustNm(authInfo.getString("sName"));
+		customer.setBirthYmd(authInfo.getString("sBirthDate"));
+		customer.setForeignerYn(authInfo.getString("sforeignerYn"));
 		customer.setCi(authInfo.getString("sCi"));
+		String gender = "G007_"+authInfo.getString("sGender");
+		customer.setSexGb(gender);
+		customer.setSiteCd(TscConstants.Site.STYLE24.value());
+		customer.setFrontGb(TsfSession.getFrontGb());
+		customer.setAfLinkCd(TsfSession.getAttribute("afLinkCd"));
 
 		// 1.입력 받은 데이터 검증
 
 		// 2.고객정보 생성 및 혜택 처리
+		customerService.saveJoinCustomer(customer);
 
 		// 3.알림톡 및 메일 발송
 		try {
-
+			kakaoService.sendJoinCongrat(customer);
 		} catch (Exception e) {
 			log.error("error", e);
 		}
+		result.setBoolean("isJoin", true);
 
-		return new GagaMap();
+		return result;
 	}
 
 }

+ 2 - 0
src/main/java/com/style24/persistence/domain/Coupon.java

@@ -17,6 +17,8 @@ public class Coupon extends TscBaseDomain {
 	// 쿠폰 정보
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 	private int[] cartSqArr;		// 장바구니 일련번호 배열
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private int[] currPrices;		// 상품가격 배열
 	private int cpnId;				// 쿠폰번호
 	private int custNo;				// 회원번호
 	private int availDays;			// 쿠폰 다운로드 후 유효기간일

+ 201 - 55
src/main/java/com/style24/persistence/mybatis/shop/TsfCart.xml

@@ -109,7 +109,7 @@
 		          CART_SQ
 		        , ITEM_CD
 		        , OPT_CD
-		        , OPT_CD1TSF
+		        , OPT_CD1
 		        , OPT_CD2
 		        , SKU_MODEL_NO
 		        , PRODUCT_NO
@@ -242,58 +242,135 @@
 	<!-- 다다익선 기본 상품 조회 -->
 	<select id="selectMoreBetterApplyCartList" parameterType="Order" resultType="Order">
 		/* TsfCart.selectMoreBetterApplyCartList : 다다익선 기본 상품 조회 */
-		SELECT C.CART_SQ
-			 , T.TMTB_SQ
-			 , T.APPLY_GB
-		     , TAG.GOODS_CD
-		     , TAG.GOODS_GB
-		     , TAG2.TMTB_CNT
-			 , T.TMTB_NM
-			 , C.GOODS_QTY
-		FROM   TB_CART C
-		INNER  JOIN TB_TMTB_APPLY_GOODS TAG
-		ON	   C.GOODS_CD = TAG.GOODS_CD
-		AND	   TAG.DEL_YN = 'N'
-		INNER  JOIN (SELECT TAG.TMTB_SQ
-						  , COUNT(1) AS TMTB_CNT
-					 FROM   TB_TMTB_APPLY_GOODS TAG
-					 INNER  JOIN TB_CART C
-					 ON     TAG.GOODS_CD = C.GOODS_CD
-					 WHERE  TAG.DEL_YN = 'N'
-					<if test="cartSqArr != null and cartSqArr.length > 0">
-					 AND    C.CART_SQ IN
-						<foreach collection="cartSqArr" item="item" index="index"  open="(" close=")" separator=",">
-								#{item}
-						</foreach>
-					</if>
-					 GROUP  BY TAG.TMTB_SQ) AS TAG2
-		ON     TAG.TMTB_SQ = TAG2.TMTB_SQ
-		INNER  JOIN TB_TMTB T
-		ON	   T.TMTB_SQ = TAG.TMTB_SQ
-		AND	   T.TMTB_STAT = 'G232_11' /*진행*/
-		INNER  JOIN TB_GOODS G
-		ON	   C.GOODS_CD = G.GOODS_CD
-		LEFT   OUTER JOIN TB_TMTB_APPLY_GOODS NOT_APPLY
-		ON     T.TMTB_SQ = NOT_APPLY.TMTB_SQ
-		AND    C.GOODS_CD = NOT_APPLY.GOODS_CD
-		AND    NOT_APPLY.GOODS_GB = 'G800_30'   /* 제외상품 */
-		AND    NOT_APPLY.DEL_YN = 'N'
+		SELECT A.CART_SQ
+			 , MAX(A.QTY_TMTB_SQ) AS QTY_TMTB_SQ
+			 , MAX(A.AMT_TMTB_SQ) AS AMT_TMTB_SQ
+			 , MAX(A.QTY_TMTB_NM) AS QTY_TMTB_NM
+			 , MAX(A.AMT_TMTB_NM) AS AMT_TMTB_NM
+			 , MAX(A.QTY_GOODS_GB) AS QTY_GOODS_GB
+			 , MAX(A.AMT_GOODS_GB) AS AMT_GOODS_GB
+			 , MAX(A.QTY_TMTB_SUM_QTY) AS QTY_TMTB_SUM_QTY
+			 , MAX(A.QTY_TMTB_SUM_AMT) AS QTY_TMTB_SUM_AMT
+			 , MAX(A.AMT_TMTB_SUM_QTY) AS AMT_TMTB_SUM_QTY
+			 , MAX(A.AMT_TMTB_SUM_AMT) AS AMT_TMTB_SUM_AMT
+			 , MAX(A.AMT_TMTB_CNT) AS AMT_TMTB_CNT
+			 , MAX(A.QTY_TMTB_CNT) AS QTY_TMTB_CNT
+			 , A.GOODS_CD
+			 , A.GOODS_QTY
+			 , (A.CURR_PRICE + A.OPT_ADD_PRICE) * A.GOODS_QTY AS CURR_PRICE
+		FROM   (SELECT C.CART_SQ
+					 , CASE WHEN T.APPLY_GB = 'G810_10' THEN T.TMTB_SQ END QTY_TMTB_SQ
+					 , CASE WHEN T.APPLY_GB = 'G810_11' THEN T.TMTB_SQ END AMT_TMTB_SQ
+					 , CASE WHEN T.APPLY_GB = 'G810_10' THEN T.TMTB_NM END QTY_TMTB_NM
+					 , CASE WHEN T.APPLY_GB = 'G810_11' THEN T.TMTB_NM END AMT_TMTB_NM
+					 , CASE WHEN T.APPLY_GB = 'G810_10' THEN TAG.GOODS_GB END QTY_GOODS_GB
+					 , CASE WHEN T.APPLY_GB = 'G810_11' THEN TAG.GOODS_GB END AMT_GOODS_GB
+					 , CASE WHEN T.APPLY_GB = 'G810_10' THEN SUM_DATA.TMTB_SUM_QTY END QTY_TMTB_SUM_QTY
+					 , CASE WHEN T.APPLY_GB = 'G810_10' THEN SUM_DATA.TMTB_SUM_AMT END QTY_TMTB_SUM_AMT
+					 , CASE WHEN T.APPLY_GB = 'G810_11' THEN SUM_DATA.TMTB_SUM_QTY END AMT_TMTB_SUM_QTY
+					 , CASE WHEN T.APPLY_GB = 'G810_11' THEN SUM_DATA.TMTB_SUM_AMT END AMT_TMTB_SUM_AMT
+					 , CASE WHEN T.APPLY_GB = 'G810_10' THEN TAG2.TMTB_CNT END QTY_TMTB_CNT
+					 , CASE WHEN T.APPLY_GB = 'G810_11' THEN TAG2.TMTB_CNT END AMT_TMTB_CNT
+					, TAG.GOODS_CD
+					, C.GOODS_QTY
+					, FN_GET_APPLY_CPN1_PRICE(C.GOODS_CD, #{frontGb}) AS CURR_PRICE
+					, IFNULL(OP.ADD_PRICE, 0) AS OPT_ADD_PRICE
+				FROM   TB_CART C
+				INNER  JOIN TB_TMTB_APPLY_GOODS TAG
+				ON	   C.GOODS_CD = TAG.GOODS_CD
+				AND	   TAG.DEL_YN = 'N'
+				INNER  JOIN (SELECT TAG.TMTB_SQ
+								  , COUNT(1) AS TMTB_CNT
+							 FROM   TB_TMTB_APPLY_GOODS TAG
+							 INNER  JOIN TB_CART C
+							 ON     TAG.GOODS_CD = C.GOODS_CD
+							 WHERE  TAG.DEL_YN = 'N'
+							<if test="cartSqArr != null and cartSqArr.length > 0">
+							 AND    C.CART_SQ IN
+								<foreach collection="cartSqArr" item="item" index="index"  open="(" close=")" separator=",">
+										#{item}
+								</foreach>
+							</if>
+							 GROUP  BY TAG.TMTB_SQ) AS TAG2
+				ON     TAG.TMTB_SQ = TAG2.TMTB_SQ
+				INNER  JOIN TB_TMTB T
+				ON	   T.TMTB_SQ = TAG.TMTB_SQ
+				AND	   T.TMTB_STAT = 'G232_11' /*진행*/
+				INNER  JOIN TB_GOODS G
+				ON	   C.GOODS_CD = G.GOODS_CD
+				INNER  JOIN TB_CART_DETAIL CD
+				ON     C.CART_SQ = CD.CART_SQ
+				INNER  JOIN (SELECT TAG.TMTB_SQ
+								  , SUM((FN_GET_APPLY_CPN1_PRICE(C.GOODS_CD, #{frontGb}) + IFNULL(OP.ADD_PRICE, 0)) * C.GOODS_QTY) AS TMTB_SUM_AMT
+								  , SUM(C.GOODS_QTY) AS TMTB_SUM_QTY
+							 FROM   TB_TMTB_APPLY_GOODS TAG
+							 INNER  JOIN TB_CART C
+							 ON     TAG.GOODS_CD = C.GOODS_CD
+							 INNER  JOIN TB_GOODS G
+							 ON     C.GOODS_CD = G.GOODS_CD
+							 INNER  JOIN TB_TMTB T
+							 ON     TAG.TMTB_SQ = T.TMTB_SQ
+							 LEFT   OUTER JOIN TB_TMTB_APPLY_GOODS NOT_APPLY
+							 ON     TAG.GOODS_CD = NOT_APPLY.GOODS_CD
+							 AND    TAG.TMTB_SQ = NOT_APPLY.TMTB_SQ
+							 AND    NOT_APPLY.GOODS_GB = 'G800_30'   /* 제외상품 */
+							 LEFT   OUTER JOIN (SELECT OP.ADD_PRICE
+							 						 , C.CART_SQ
+							 					FROM   TB_CART C
+							 					INNER  JOIN TB_CART_DETAIL CD
+							 					ON     C.CART_SQ = CD.CART_SQ
+												 INNER  JOIN TB_OPTION OP
+												 ON     C.GOODS_CD = OP.GOODS_CD
+												 AND    CD.OPT_CD = OP.OPT_CD
+												 WHERE  1=1) OP
+							 ON     C.CART_SQ = OP.CART_SQ
+							 WHERE  1=1
+							 AND    NOT_APPLY.TMTB_SQ IS NULL
+							 AND    T.DEL_YN = 'N'
+							 AND    TAG.DEL_YN = 'N'
+							 AND    C.CART_GB = 'G026_BC'
+							 AND    G.GOODS_STAT = 'G008_90'
+							 AND    G.SELF_MALL_YN = 'Y'
+							 <if test="cartSqArr != null and cartSqArr.length > 0">
+							 	AND    C.CART_SQ IN
+							 	<foreach collection="cartSqArr" item="item" index="index"  open="(" close=")" separator=",">
+							 		#{item}
+							 	</foreach>
+							 </if>
+							 GROUP BY TAG.TMTB_SQ
+					   ) SUM_DATA
+				ON     T.TMTB_SQ = SUM_DATA.TMTB_SQ
+				LEFT   JOIN TB_OPTION OP
+				ON     CD.ITEM_CD = OP.GOODS_CD
+				AND    CD.OPT_CD1 = OP.OPT_CD1
+				AND    CD.OPT_CD2 = OP.OPT_CD2
+				LEFT   OUTER JOIN TB_TMTB_APPLY_GOODS NOT_APPLY
+				ON     T.TMTB_SQ = NOT_APPLY.TMTB_SQ
+				AND    C.GOODS_CD = NOT_APPLY.GOODS_CD
+				AND    NOT_APPLY.GOODS_GB = 'G800_30'   /* 제외상품 */
+				AND    NOT_APPLY.DEL_YN = 'N'
+				WHERE  1=1
+				AND    NOT_APPLY.TMTB_SQ IS NULL
+				AND    T.DEL_YN = 'N'
+				AND    T.TMTB_ST_DT <![CDATA[<=]]> NOW()
+				AND    T.TMTB_ED_DT >= NOW()
+				AND    C.CART_GB = 'G026_BC'
+				AND    G.GOODS_STAT = 'G008_90'
+				AND    G.SELF_MALL_YN = 'Y'
+				<if test="cartSqArr != null and cartSqArr.length > 0">
+				AND    C.CART_SQ IN
+					<foreach collection="cartSqArr" item="item" index="index"  open="(" close=")" separator=",">
+						#{item}
+					</foreach>
+				</if>
+			   ) A
 		WHERE  1=1
-		AND    NOT_APPLY.TMTB_SQ IS NULL
-		AND    T.DEL_YN = 'N'
-		AND    T.TMTB_ST_DT <![CDATA[<=]]> NOW()
-		AND    T.TMTB_ED_DT >= NOW()
-		AND    T.APPLY_GB = #{applyGb}
-		AND    C.CART_GB = 'G026_BC'
-		AND    G.GOODS_STAT = 'G008_90'
-		AND    G.SELF_MALL_YN = 'Y'
-		<if test="cartSqArr != null and cartSqArr.length > 0">
-		AND    C.CART_SQ IN
-			<foreach collection="cartSqArr" item="item" index="index"  open="(" close=")" separator=",">
-				#{item}
-			</foreach>
-		</if>
-		ORDER BY TAG.TMTB_SQ, TAG.GOODS_GB
+		GROUP  BY A.CART_SQ
+			 , A.GOODS_CD
+			 , A.GOODS_QTY
+			 , A.CURR_PRICE
+			 , A.OPT_ADD_PRICE
+		ORDER BY A.CART_SQ
 	</select>
 
 	<!-- 다다익선 적용 상품 SUM DATA 조회 -->
@@ -378,6 +455,7 @@
 			 , GROUP_CONCAT(Z.OPT_CD1 ORDER BY Z.CART_DTL_SQ) AS OPT_CD1
 			 , GROUP_CONCAT(Z.OPT_CD2 ORDER BY Z.CART_DTL_SQ) AS OPT_CD2
 			 , GROUP_CONCAT(Z.ITEM_QTY ORDER BY Z.CART_DTL_SQ) AS ITEM_QTYR
+			 , (SELECT COUNT(1) CNT FROM TB_WISHLIST WHERE CUST_NO = ${custNo} AND CUST_NO != 0 AND GOODS_CD = Z.GOODS_CD) AS WISH_CNT
 			 , Z.CART_SQ
 			 , Z.GOODS_CD
 			 , Z.GOODS_NM
@@ -387,7 +465,8 @@
 			 , Z.GOODS_TYPE
 			 , Z.SUPPLY_COMP_CD
 			 , Z.DELV_FEE_CD
-		     , Z.CURR_PRICE
+		     , (Z.CURR_PRICE + Z.OPT_ADD_PRICE) * Z.GOODS_QTY AS CURR_PRICE
+		     , Z.SOLDOUT_YN
 			 , CASE WHEN #{frontGb} = 'P' THEN (Z.CURR_PRICE * Z.GOODS_QTY) * (Z.PNT_PRATE/100)
 					ELSE (Z.CURR_PRICE * Z.GOODS_QTY) * (Z.PNT_MRATE/100) END AS SAVE_PNT_AMT
 			 , GI.SYS_IMG_NM
@@ -406,7 +485,9 @@
 		             , G.BRAND_CD
 		             , G.PNT_PRATE
 					 , G.PNT_MRATE
+		             , STOCK.SOLDOUT_YN
 		             , FN_GET_APPLY_CPN1_PRICE(C.GOODS_CD, #{frontGb}) AS CURR_PRICE
+		             , IFNULL(O.ADD_PRICE, 0) AS OPT_ADD_PRICE
 		             , (SELECT BRAND_KNM FROM TB_BRAND WHERE BRAND_CD = G.BRAND_CD) AS BRAND_NM
 		             , (SELECT SUPPLY_COMP_NM FROM TB_SUPPLY_COMPANY WHERE SUPPLY_COMP_CD = G.SUPPLY_COMP_CD) AS SUPPLY_COMP_NM
 					 , (SELECT GOODS_NM FROM TB_GOODS WHERE GOODS_CD = CD.ITEM_CD) AS ITEM_NM
@@ -422,6 +503,60 @@
 				INNER  JOIN TB_OPTION O
 				ON     CD.ITEM_CD = O.GOODS_CD
 				AND    CD.OPT_CD = O.OPT_CD
+				INNER  JOIN (   SELECT A.CART_SQ
+									 , MIN(A.SOLDOUT_YN) AS SOLDOUT_YN
+								FROM   (SELECT C.CART_SQ
+											 , CASE WHEN VS.SOLDOUT_YN = 'N' AND VS.CURR_STOCK_QTY > C.GOODS_QTY * GC.QTY THEN 'N'
+													ELSE 'Y' END AS SOLDOUT_YN
+										FROM   TB_CART C
+										INNER  JOIN TB_CART_DETAIL CD
+										ON     C.CART_SQ = CD.CART_SQ
+										INNER  JOIN TB_GOODS G
+										ON     C.GOODS_CD = G.GOODS_CD
+										INNER  JOIN TB_GOODS_COMPOSE GC
+										ON     C.GOODS_CD = GC.GOODS_CD
+										AND    CD.ITEM_CD = GC.COMPS_GOODS_CD
+										INNER  JOIN VW_STOCK VS
+										ON     CD.ITEM_CD = VS.GOODS_CD
+										AND    CD.OPT_CD = VS.OPT_CD
+										WHERE  1=1
+										AND    C.CART_GB = 'G026_BC'
+										AND    G.GOODS_STAT = 'G008_90'
+										AND    G.SELF_MALL_YN = 'Y'
+										<if test="custNo == 0">
+											AND    C.CUST_NO = 0
+											AND    C.JSESSION_ID = #{jsessionId}
+										</if>
+										<if test="custNo != 0">
+											AND    C.CUST_NO = #{custNo}
+										</if>
+										UNION ALL
+										SELECT C.CART_SQ
+											 , CASE WHEN VS.SOLDOUT_YN = 'N' AND VS.CURR_STOCK_QTY > C.GOODS_QTY THEN 'N'
+													ELSE 'Y' END AS SOLDOUT_YN
+										FROM   TB_CART C
+										INNER  JOIN TB_CART_DETAIL CD
+										ON     C.CART_SQ = CD.CART_SQ
+										INNER  JOIN TB_GOODS G
+										ON     C.GOODS_CD = G.GOODS_CD
+										INNER  JOIN VW_STOCK VS
+										ON     C.GOODS_CD = VS.GOODS_CD
+										AND    CD.OPT_CD = VS.OPT_CD
+										WHERE  1=1
+										AND    C.CART_GB = 'G026_BC'
+										AND    G.GOODS_STAT = 'G008_90'
+										AND    G.SELF_MALL_YN = 'Y'
+										<if test="custNo == 0">
+											AND    C.CUST_NO = 0
+											AND    C.JSESSION_ID = #{jsessionId}
+										</if>
+										<if test="custNo != 0">
+											AND    C.CUST_NO = #{custNo}
+										</if>
+								       ) A
+								GROUP  BY  A.CART_SQ
+					   ) STOCK
+				ON     C.CART_SQ = STOCK.CART_SQ
 				WHERE  G.SELF_MALL_YN = 'Y'
 				AND    G.GOODS_STAT = 'G008_90'
 				<if test="custNo == 0">
@@ -454,9 +589,10 @@
 		     , Z.CURR_PRICE
 		     , Z.PNT_PRATE
 			 , Z.PNT_MRATE
+		     , Z.OPT_ADD_PRICE
 			 , GI.SYS_IMG_NM
-		ORDER  BY Z.SUPPLY_COMP_CD
-			 , Z.GOODS_CD
+		ORDER  BY Z.DELV_FEE_CD
+			 , Z.CART_SQ
 	</select>
 
 	<!-- 장바구니 업체별 배송비 -->
@@ -484,4 +620,14 @@
 			 , DFP.DELV_FEE_CD
 			 , DFP.DELV_FEE
 	</select>
+
+	<!-- 장바구니 삭제 -->
+	<delete id="deleteCart" parameterType="Cart">
+		<!-- TsfCart.deleteCart : 장바구니 삭제 -->
+		DELETE FROM TB_CART
+		WHERE  CART_SQ IN
+		<foreach collection="cartSqArr" item="item" index="index"  open="(" close=")" separator=",">
+			#{item}
+		</foreach>
+	</delete>
 </mapper>

+ 107 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsfCustomer.xml

@@ -147,4 +147,111 @@
 		     ) A
 	</select>
 
+	<!--고객정보 생성-->
+	<insert id="createCustomer" parameterType="Customer" keyProperty="custNo">
+		/* TsfCustomer.createCustomer */
+		INSERT INTO TB_CUSTOMER (
+		       CUST_NO
+		     , CUST_ID
+		     , CUST_NM
+		     , PASSWD
+		     , BIRTH_YMD
+		     , BIRTH_SM
+		     , SEX_GB
+		     , CELL_PHNNO
+		     , APP_AGREE_YN
+		     , APP_AGREE_DT
+		     , SMS_AGREE_YN
+		     , SMS_AGREE_DT
+		     , EMAIL
+		     , EMAIL_AGREE_YN
+		     , EMAIL_AGREE_DT
+		     , HOME_ZIPCODE
+		     , HOME_BASE_ADDR
+		     , HOME_DTL_ADDR
+		     , SITE_CD
+		     , FRONT_GB
+		     , AF_LINK_CD
+		     , CUST_GB
+		     , CUST_GRADE
+		     , JOIN_DT
+		     , FOREIGNER_YN
+		     , CUST_STAT
+		     , PASSWD_CHG_DT
+		     , TEMP_PASSWD_YN
+		     , LOGIN_LDT
+		     , CI
+		     , AUTH_DT
+		     , MANAGED_RSN
+		     , MANAGED_DTL_RSN
+		     , MANAGED_DT
+		     , SECEDE_RSN
+		     , SECEDE_DTL_RSN
+		     , SECEDE_DT
+		     , REG_NO
+		     , REG_DT
+		     , UPD_NO
+		     , UPD_DT
+		)
+		SELECT #{custNo}                           AS CUST_NO
+		     , #{custId}                           AS CUST_ID
+		     , #{encodedCustNm}                    AS CUST_NM
+		     , #{encodedPasswd}                    AS PASSWD
+		     , #{encodedBirthYmd}                  AS BIRTH_YMD
+		     , #{birthSm}                          AS BIRTH_SM
+		     , #{encodedSexGb}                     AS SEX_GB
+		     , #{encodedCellPhnno}                 AS CELL_PHNNO
+		     , #{appAgreeYn}                       AS APP_AGREE_YN
+		     , #{appAgreeDt}                       AS APP_AGREE_DT
+		     , #{smsAgreeYn}                       AS SMS_AGREE_YN
+		     , #{smsAgreeDt}                       AS SMS_AGREE_DT
+		     , #{encodedEmail}                     AS EMAIL
+		     , #{emailAgreeYn}                     AS EMAIL_AGREE_YN
+		     , #{emailAgreeDt}                     AS EMAIL_AGREE_DT
+		     , #{homeZipcode}                      AS HOME_ZIPCODE
+		     , #{encodedHomeBaseAddr}              AS HOME_BASE_ADDR
+		     , #{encodedHomeDtlAddr}               AS HOME_DTL_ADDR
+		     , #{siteCd}                           AS SITE_CD
+		     , #{frontGb}                          AS FRONT_GB
+		     , #{afLinkCd}                         AS AF_LINK_CD
+		     , #{custGb}                           AS CUST_GB
+		     , #{custGrade}                        AS CUST_GRADE
+		     , NOW()                               AS JOIN_DT
+		     , #{foreignerYn}                      AS FOREIGNER_YN
+		     , #{custStat}                         AS CUST_STAT
+		     , #{passwdChgDt}                      AS PASSWD_CHG_DT
+		     , 'N'                                 AS TEMP_PASSWD_YN
+		     , NOW()                               AS LOGIN_LDT
+		     , #{ci}                               AS CI
+		     , NOW()                               AS AUTH_DT
+		     , #{managedRsn}                       AS MANAGED_RSN
+		     , #{managedDtlRsn}                    AS MANAGED_DTL_RSN
+		     , #{managedDt}                        AS MANAGED_DT
+		     , #{secedeRsn}                        AS SECEDE_RSN
+		     , #{secedeDtlRsn}                     AS SECEDE_DTL_RSN
+		     , #{secedeDt}                         AS SECEDE_DT
+		     , #{custNo}                           AS REG_NO
+		     , NOW()                               AS REG_DT
+		     , #{custNo}                           AS UPD_NO
+		     , NOW()                               AS UPD_DT
+	</insert>
+
+	<!--고객소셜정보 생성-->
+	<insert id="createCustomerSns" parameterType="Customer">
+		/* TsfCustomer.createCustomerSns */
+		INSERT INTO TB_CUSTOMER_SNS (
+		       CUST_NO
+		     , SNS_TYPE
+		     , SNS_ID
+		     , REG_NO
+		     , REG_DT
+		) VALUES (
+		       #{custNo}
+		     , #{snsType}
+		     , #{snsId}
+		     , #{custNo}
+		     , NOW()
+		)
+	</insert>
+
 </mapper>

+ 386 - 82
src/main/webapp/WEB-INF/views/web/cart/cartListAjaxFormWeb.html

@@ -36,7 +36,7 @@
     </div>
     <div class="sec_body">
         <!-- 총알배송 -->
-        <div class="part_deliver" th:if="${wmsCartList.size() > 0}">
+        <div class="part_deliver wmsList" th:if="${wmsCartList != null and wmsCartList.size() > 0}">
             <h3 class="subH2 mb20" th:if="${order.shotCanYn.equals('Y')}">
                 STYLE24 총알배송
                 <span class="ml10">오늘 자정까지 도착</span>
@@ -52,7 +52,7 @@
                     </colgroup>
                     <tbody>
                     <th:block th:each="cart, status : ${wmsCartList}">
-                    <tr>
+                    <tr class="cartInfo wmsCartInfo">
                         <input type="hidden" name="applyQtySectionYn" th:value="${cart.applyQtySectionYn}" />
                         <input type="hidden" name="applyAmtSectionYn" th:value="${cart.applyAmtSectionYn}" />
                         <input type="hidden" name="qtyTmtbSq" th:value="${cart.qtyTmtbSq}" />
@@ -60,8 +60,11 @@
                         <input type="hidden" name="amtTmtbSq" th:value="${cart.amtTmtbSq}" />
                         <input type="hidden" name="amtTmtbNm" th:value="${cart.amtTmtbNm}" />
                         <input type="hidden" name="currPrice" th:value="${cart.currPrice}" />
+                        <input type="hidden" name="soldoutYn" th:value="${cart.soldoutYn}" />
+                        <input type="hidden" name="tmtbDcAmt" th:value="${cart.tmtbDcAmt}" />
+                        <input type="hidden" name="cartSq" th:value="${cart.cartSq}" />
 
-                        <td style="border-left:none;">
+                        <td>
                             <!-- 주문가능 상품 -->
                             <div class="info_item" th:classappend="${cart.soldoutYn.equals('Y')} ? unable"> <!-- 주문불가시 class="unable" 추가 / 인풋, 버튼 disable 처리 -->
                                 <div class="form_box">
@@ -87,32 +90,35 @@
                                     </p>
                                     <p class="od_opt" th:each="opt, index : ${cart.itemNmArr}">
                                         <span class="option"><em th:text="${cart.itemNmArr[index.index]} + '_' + ${cart.optCdArr[index.index]}"></em></span>
-                                        <span class="count">수량:<em th:text="${cart.itemQtyArr[index.index]} * ${cart.goodsQty}"></em>개</span>
                                     </p>
+                                    <p class="od_opt">
+                                        <span class="count">수량:<em th:text="${cart.goodsQty}"></em>개</span>
+                                    </p>
+
                                     <p class="od_modify">
                                         <button type="button" class="btn_opt_pop"><span>옵션/수량변경</span></button>
                                     </p>
                                     <!-- 다다익선 적용 -->
-                                    <div class="od_moresale" th:if="${cart.applyQtySectionYn == 'Y' or cart.applyAmtSectionYn == 'Y'}">
+                                    <div class="od_moresale applyTmtb" th:if="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'Y') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'Y')}">
                                         <a href="" class="btn_moresale">
                                             <i class="ico ico_saletag"></i><span>다다익선 할인적용!</span>
                                         </a>
-                                        <div class="li_moresale">
+                                        <div class="li_moresale applyTmtbNm">
                                             <ul>
-                                                <li th:if="${cart.applyQtySectionYn == 'Y'}" th:text="${cart.qtyTmtbNm}"></li>
-                                                <li th:if="${cart.applyAmtSectionYn == 'Y'}" th:text="${cart.amtTmtbNm}"></li>
+                                                <li th:if="${cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'Y'}" th:text="${cart.qtyTmtbNm}"></li>
+                                                <li th:if="${cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'Y'}" th:text="${cart.amtTmtbNm}"></li>
                                             </ul>
                                         </div>
                                     </div>
                                     <!-- 다다익선 미적용 -->
-                                    <div class="od_moresale" th:if="${cart.applyQtySectionYn == 'N' or cart.applyAmtSectionYn == 'N'}">
+                                    <div class="od_moresale notApplyTmtb" th:if="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'N') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'N')}">
                                         <a href="" class="btn_moresale">
                                             <i class="ico ico_saletag"></i><span>다다익선 상품보기</span>
                                         </a>
-                                        <div class="li_moresale">
+                                        <div class="li_moresale notApplyTmtbNm">
                                             <ul>
-                                                <li th:if="${cart.applyQtySectionYn == 'N'}" th:inline="text">[[${cart.qtyTmtbNm}]]<a href=''>대상 상품 보기</a></li>
-                                                <li th:if="${cart.applyAmtSectionYn == 'N'}" th:inline="text">[[${cart.amtTmtbNm}]]<a href=''>대상 상품 보기</a></li>
+                                                <li th:if="${cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'N'}" th:inline="text">[[${cart.qtyTmtbNm}]]<a href=''>대상 상품 보기</a></li>
+                                                <li th:if="${cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'N'}" th:inline="text">[[${cart.amtTmtbNm}]]<a href=''>대상 상품 보기</a></li>
                                             </ul>
                                         </div>
                                     </div>
@@ -123,11 +129,11 @@
                                     <!-- //주문불가시 안내추가 -->
                                 </div>
                                 <div class="info_calc">
-                                    <p class="price" th:if="${cart.tmtbDcAmt > 0}">
+                                    <p class="price" th:if="${cart.tmtbDcAmt < cart.currPrice}">
                                         <span class="selling_price" th:text="|${#numbers.formatInteger(cart.tmtbDcAmt, 1, 'COMMA')} 원|"></span>
                                         <del th:text="|${#numbers.formatInteger(cart.currPrice, 1, 'COMMA')} 원|"></del>
                                     </p>
-                                    <p class="price" th:if="${cart.tmtbDcAmt == 0}">
+                                    <p class="price" th:if="${cart.tmtbDcAmt == cart.currPrice}">
                                         <span class="selling_price" th:text="|${#numbers.formatInteger(cart.currPrice, 1, 'COMMA')} 원|"></span>
                                     </p>
                                     <p class="point"><span th:text="${#numbers.formatInteger(cart.savePntAmt, 1, 'COMMA')}"></span>p 적립예정</p>
@@ -137,17 +143,17 @@
                                     </p>
                                     <p class="util">
                                         <span>
-                                            <button type="button" class="btn_favorite"><span><i class="ico ico_like2"></i><em class="sr-only">관심상품 추가</em></span></button>
+                                            <button type="button" class="btn_favorite" th:classappend="${cart.wishCnt > 0} ? active"><span><i class="ico ico_like2"></i><em class="sr-only">관심상품 추가</em></span></button>
                                         </span>
                                         <span>
-                                            <button type="button" class="btn_delete"><span><i class="ico ico_trash"></i><em class="sr-only">상품삭제</em></span></button>
+                                            <button type="button" class="btn_delete" th:onclick="|deleteCart(${cart.cartSq})|"><span><i class="ico ico_trash"></i><em class="sr-only">상품삭제</em></span></button>
                                         </span>
                                     </p>
                                 </div>
                             </div>
                             <!-- //주문가능 상품 -->
                         </td>
-                        <td class="merge_row" th:if="${status.index == 0}" th:rowspan="${wmsCartList.size()}"> <!-- 같은 데이터 노출시 동일 영역끼리 병합 : 클래스명 merge_row 추가 -->
+                        <td class="merge_row delvFeeArea" th:classappend="|delv_${cart.delvFeeCd}|" th:if="${cart.firstCompYn == 'Y'}" th:rowspan="${wmsCartList.size()}"> <!-- 같은 데이터 노출시 동일 영역끼리 병합 : 클래스명 merge_row 추가 -->
                             <div class="info_dlvr">
                                 <span class="dlvr_fee" th:if="${cart.delvFee == 0}">배송비 무료</span>
                                 <span class="dlvr_fee" th:if="${cart.delvFee > 0}" th:text="|배송비 ${#numbers.formatInteger(cart.delvFee, 1, 'COMMA')} 원|"></span>
@@ -160,14 +166,14 @@
                 </table>
             </div>
             <div class="btn_area">
-                <button type="button" class="btn btn_default"><span>선택 삭제</span></button>
-                <button type="button" class="btn btn_default"><span>전체 삭제</span></button>
+                <button type="button" class="btn btn_default" onclick="deleteCart('WMS_SELECT')"><span>선택 삭제</span></button>
+                <button type="button" class="btn btn_default" onclick="deleteCart('WMS_ALL')"><span>전체 삭제</span></button>
             </div>
         </div>
         <!-- //총알배송 -->
 
         <!-- 업체직배송 -->
-        <div class="part_deliver" th:if="${delvCartList.size() > 0}">
+        <div class="part_deliver delvList" th:if="${delvCartList != null and delvCartList.size() > 0}">
             <h3 class="subH2 mb20">
                 업체직배송
             </h3>
@@ -179,7 +185,7 @@
                     </colgroup>
                     <tbody>
                     <th:block th:each="cart, status : ${delvCartList}">
-                    <tr>
+                    <tr class="cartInfo delvCartInfo">
                         <input type="hidden" name="applyQtySectionYn" th:value="${cart.applyQtySectionYn}" />
                         <input type="hidden" name="applyAmtSectionYn" th:value="${cart.applyAmtSectionYn}" />
                         <input type="hidden" name="qtyTmtbSq" th:value="${cart.qtyTmtbSq}" />
@@ -187,12 +193,16 @@
                         <input type="hidden" name="amtTmtbSq" th:value="${cart.amtTmtbSq}" />
                         <input type="hidden" name="amtTmtbNm" th:value="${cart.amtTmtbNm}" />
                         <input type="hidden" name="currPrice" th:value="${cart.currPrice}" />
-                        <td style="border-left:none;">
-                            <div class="info_item">
+                        <input type="hidden" name="soldoutYn" th:value="${cart.soldoutYn}" />
+                        <input type="hidden" name="tmtbDcAmt" th:value="${cart.tmtbDcAmt}" />
+                        <input type="hidden" name="cartSq" th:value="${cart.cartSq}" />
+
+                        <td>
+                            <div class="info_item" th:classappend="${cart.soldoutYn.equals('Y')} ? unable">
                                 <div class="form_box">
                                     <p class="form_field">
-                                        <input id="od_item_21" name="cartSqArr" type="checkbox" th:value="${cart.cartSq}" th:checked="${cart.soldoutYn.equals('N')}">
-                                        <label for="od_item_21">
+                                        <input th:id="|od_item_${cart.cartSq}|" name="cartSqArr" type="checkbox" th:value="${cart.cartSq}" th:checked="${cart.soldoutYn.equals('N')}" th:disabled="${cart.soldoutYn.equals('Y')}"/>
+                                        <label th:for="|od_item_${cart.cartSq}|">
                                             <span class="sr-only">상품선택</span>
                                         </label>
                                     </p>
@@ -211,32 +221,34 @@
                                     </p>
                                     <p class="od_opt" th:each="opt, index : ${cart.itemNmArr}">
                                         <span class="option"><em th:text="${cart.itemNmArr[index.index]} + '_' + ${cart.optCdArr[index.index]}"></em></span>
-                                        <span class="count">수량:<em th:text="${cart.itemQtyArr[index.index]} * ${cart.goodsQty}"></em>개</span>
+                                    </p>
+                                    <p class="od_opt">
+                                        <span class="count">수량:<em th:text="${cart.goodsQty}"></em>개</span>
                                     </p>
                                     <p class="od_modify">
                                         <button type="button" class="btn_opt_pop"><span>옵션/수량변경</span></button>
                                     </p>
                                     <!-- 다다익선 적용 -->
-                                    <div class="od_moresale" th:if="${cart.applyQtySectionYn == 'Y' or cart.applyAmtSectionYn == 'Y'}">
+                                    <div class="od_moresale applyTmtb" th:if="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'Y') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'Y')}">
                                         <a href="" class="btn_moresale">
                                             <i class="ico ico_saletag"></i><span>다다익선 할인적용!</span>
                                         </a>
-                                        <div class="li_moresale">
+                                        <div class="li_moresale applyTmtbNm">
                                             <ul>
-                                                <li th:if="${cart.applyQtySectionYn == 'Y'}" th:text="${cart.qtyTmtbNm}"></li>
-                                                <li th:if="${cart.applyAmtSectionYn == 'Y'}" th:text="${cart.amtTmtbNm}"></li>
+                                                <li th:if="${cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'Y'}" th:text="${cart.qtyTmtbNm}"></li>
+                                                <li th:if="${cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'Y'}" th:text="${cart.amtTmtbNm}"></li>
                                             </ul>
                                         </div>
                                     </div>
                                     <!-- 다다익선 미적용 -->
-                                    <div class="od_moresale" th:if="${cart.applyQtySectionYn == 'N' or cart.applyAmtSectionYn == 'N'}">
+                                    <div class="od_moresale notApplyTmtb" th:if="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'N') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'N')}">
                                         <a href="" class="btn_moresale">
                                             <i class="ico ico_saletag"></i><span>다다익선 상품보기</span>
                                         </a>
-                                        <div class="li_moresale">
+                                        <div class="li_moresale notApplyTmtbNm">
                                             <ul>
-                                                <li th:if="${cart.applyQtySectionYn == 'N'}" th:text="${cart.qtyTmtbNm}"><a href="">대상 상품 보기</a></li>
-                                                <li th:if="${cart.applyAmtSectionYn == 'N'}" th:text="${cart.amtTmtbNm}"><a href="">대상 상품 보기</a></li>
+                                                <li th:if="${cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'N'}" th:text="${cart.qtyTmtbNm}"><a href="">대상 상품 보기</a></li>
+                                                <li th:if="${cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'N'}" th:text="${cart.amtTmtbNm}"><a href="">대상 상품 보기</a></li>
                                             </ul>
                                         </div>
                                     </div>
@@ -247,11 +259,11 @@
                                     <!-- //주문불가시 안내추가 -->
                                 </div>
                                 <div class="info_calc">
-                                    <p class="price" th:if="${cart.tmtbDcAmt > 0}">
+                                    <p class="price" th:if="${cart.tmtbDcAmt < cart.currPrice}">
                                         <span class="selling_price" th:text="|${#numbers.formatInteger(cart.tmtbDcAmt, 1, 'COMMA')} 원|"></span>
                                         <del th:text="|${#numbers.formatInteger(cart.currPrice, 1, 'COMMA')} 원|"></del>
                                     </p>
-                                    <p class="price" th:if="${cart.tmtbDcAmt == 0}">
+                                    <p class="price" th:if="${cart.tmtbDcAmt == cart.currPrice}">
                                         <span class="selling_price" th:text="|${#numbers.formatInteger(cart.currPrice, 1, 'COMMA')} 원|"></span>
                                     </p>
                                     <p class="point"><span th:text="${#numbers.formatInteger(cart.savePntAmt, 1, 'COMMA')}"></span>p 적립예정</p>
@@ -264,13 +276,13 @@
                                             <button type="button" class="btn_favorite"><span><i class="ico ico_like2"></i><em class="sr-only">관심상품 추가</em></span></button>
                                         </span>
                                         <span>
-                                            <button type="button" class="btn_delete"><span><i class="ico ico_trash"></i><em class="sr-only">상품삭제</em></span></button>
+                                            <button type="button" class="btn_delete" th:onclick="|deleteCart(${cart.cartSq})|"><span><i class="ico ico_trash"></i><em class="sr-only">상품삭제</em></span></button>
                                         </span>
                                     </p>
                                 </div>
                             </div>
                         </td>
-                        <td class="merge_row" th:if="${cart.firstCompYn == 'Y'}" th:rowspan="${cart.compCnt}"> <!-- 같은 데이터 노출시 동일 영역끼리 병합 : 클래스명 merge_row 추가 -->
+                        <td class="merge_row delvFeeArea" th:classappend="|delv_${cart.delvFeeCd}|" th:if="${cart.firstCompYn == 'Y'}" th:rowspan="${cart.compCnt}"> <!-- 같은 데이터 노출시 동일 영역끼리 병합 : 클래스명 merge_row 추가 -->
                             <div class="info_dlvr">
                                 <span class="dlvr_fee" th:if="${cart.delvFee == 0}">배송비 무료</span>
                                 <span class="dlvr_fee" th:if="${cart.delvFee > 0}" th:text="|배송비 ${#numbers.formatInteger(cart.delvFee, 1, 'COMMA')} 원|"></span>
@@ -284,8 +296,8 @@
                 </table>
             </div>
             <div class="btn_area">
-                <button type="button" class="btn btn_default"><span>선택 삭제</span></button>
-                <button type="button" class="btn btn_default"><span>전체 삭제</span></button>
+                <button type="button" class="btn btn_default" onclick="deleteCart('DELV_SELECT')"><span>선택 삭제</span></button>
+                <button type="button" class="btn btn_default" onclick="deleteCart('DELV_ALL')"><span>전체 삭제</span></button>
             </div>
         </div>
         <!-- //업체직배송 -->
@@ -303,22 +315,22 @@
             <dl>
                 <div>
                     <dt>상품금액</dt>
-                    <dd><em th:text="${#numbers.formatInteger(order.sumOrdAmt, 1, 'COMMA')}"></em>원</dd>
+                    <dd><em class="sumCurrPrice" th:text="${#numbers.formatInteger(order.sumOrdAmt, 1, 'COMMA')}"></em> 원</dd>
                 </div>
                 <div>
                     <dt>배송비</dt>
-                    <dd><em th:text="${#numbers.formatInteger(order.totDelvFee, 1, 'COMMA')}"></em>원</dd>
+                    <dd><em class="totDelvFee" th:text="${#numbers.formatInteger(order.totDelvFee, 1, 'COMMA')}"></em> 원</dd>
                 </div>
                 <div>
                     <dt>할인금액</dt>
-                    <dd><span class="disc_amount"><em id="totDcAmt" th:text="${#numbers.formatInteger(order.totDcAmt, 1, 'COMMA')}"></em>원</span></dd>
+                    <dd><span class="disc_amount"><em class="totDcAmt" id="totDcAmt" th:text="${#numbers.formatInteger(order.totDcAmt, 1, 'COMMA')}"></em> 원</span></dd>
                 </div>
             </dl>
         </div>
         <div class="totalprice_box">
             <dl>
                 <dt>총 결제 예정 금액</dt>
-                <dd data-weight="price" data-font="lato"><span id="sumRealPayAmt" th:text="${#numbers.formatInteger(order.sumRealPayAmt, 1, 'COMMA')}"></span>원</dd>
+                <dd data-weight="price" data-font="lato"><span class="sumRealPayAmt" id="sumRealPayAmt" th:text="${#numbers.formatInteger(order.sumRealPayAmt + order.totDelvFee, 1, 'COMMA')}"></span> 원</dd>
             </dl>
         </div>
         <div class="btn_box">
@@ -374,7 +386,7 @@
 </form>
 
 <script th:inline="javascript">
-    let sumRealPayAmt = [[${order.sumRealPayAmt}]];
+    let sumRealPayAmt = [[${order.sumRealPayAmt + order.totDelvFee}]];
     let totDcAmt = [[${order.totDcAmt}]];
 
     function NotApplyTmtbCartList() {
@@ -389,15 +401,45 @@
     }
 
     $(document).ready(function() {
-        $(".area_salecoupon .coupon_box").hide();
+        let compsList = [];
+
+        let temp = new Object;
+        temp.goodsCd = "STYS000000016";
+        temp.itemCd = '14373757';
+        temp.optCd = "핑크120";
+        temp.goodsQty = 1;
+        temp.goodsType = "G056_S";
+        temp.cartGb = "C";
+        temp.afLinkCd = "afLinkCd";
+        temp.ithrCd = "G027_ZZZ";
+        temp.contentsLoc = "G028_YYY";
+        temp.planDtlSq = "123";
+        compsList.push(temp);
+
+        let temp2 = new Object;
+        temp2.goodsCd = "STYS000000016";
+        temp2.itemCd = '14373758';
+        temp2.optCd = "블랙100";
+        temp2.goodsQty = 1;
+        temp2.goodsType = "G056_S";
+        temp2.cartGb = "C";
+        temp2.afLinkCd = "afLinkCd";
+        temp2.ithrCd = "G027_ZZZ";
+        temp2.contentsLoc = "G028_YYY";
+        temp2.planDtlSq = "123";
+        compsList.push(temp2);
+
+        // cfnAddCart(compsList)
+
+        $("#cartListForm .area_salecoupon .coupon_box").hide();
         /* TODO 로그인 안했으면 .area_salecoupon (할인코드 입력 부 및 쿠폰정보영역) hide 시킬것 */
+        let loginInfo = [[${loginInfo}]];
+        if(!loginInfo || loginInfo.custNo == null || loginInfo.custNo == 0) {
+            $("#cartListForm .area_salecoupon").hide();
+        }
 
         // 다다익선 할인 대상(미적용) 리스트
         notApplyTmtbAreaList();
-
-        /*$("#sumRealPayAmt").text(Number(sumRealPayAmt).toLocaleString());
-        $("#totDcAmt").text(Number(totDcAmt).toLocaleString());*/
-
     });
 
     function notApplyTmtbAreaList() {
@@ -406,7 +448,7 @@
 
         // 수량 다다익선 조회
         $("#cartListForm input[name=qtyTmtbSq]").each(function (index) {
-            if($(this).val() != "0" && $(this).parent().find("input[name=applyQtySectionYn]").val() != "Y") {
+            if($(this).val() != "0" && $(this).parent().find("input[name=applyQtySectionYn]").val() == "N") {
                 let obj = new Object();
                 obj.tmtbSq = $(this).val();
                 obj.tmtbNm = $(this).parent().find("input[name=qtyTmtbNm]").val();
@@ -439,8 +481,13 @@
             }
         }
 
+        fnCreateNotApplyTmtbAreaList(notApplyQtyTmtbList, notApplyAmtTmtbList);
+    }
+
+    function fnCreateNotApplyTmtbAreaList(notApplyQtyTmtbList, notApplyAmtTmtbList) {
         // 정렬 후 같은 다다익선 상품은 한 배열로 묶음
         let tmtbQtyList = new Array();
+
         for (let i = 0; i < notApplyQtyTmtbList.length; i++) {
             let goods = notApplyQtyTmtbList[i];
             let tmtbInfo = new Object();
@@ -474,7 +521,7 @@
         }
 
         // 수량 다다익선 HTML 작성
-        let tmtbHtml = "<h4>다다익선 할인 대상이 있습니다.</h4>";
+        let tmtbHtml = "";
         for(let i = 0 ; i < tmtbQtyList.length ; i++) {
             let tmtb = tmtbQtyList[i];
             tmtbHtml += '<div class="more_sale qtyNotApplyTmtbList">';
@@ -520,39 +567,47 @@
 
         // 금액 다다익선 정보 HTML 작성
         for(let i = 0 ; i < notApplyAmtTmtbList.length ; i++) {
-            let tmtb = notApplyAmtTmtbList[i];
-            tmtbHtml += '<div class="more_sale amtNotApplyTmtbList">\n' +
-                    '            <div class="txt">\n' +
-                    '                <a href="">\n' +
-                    '                    <i class="ico ico_saletag"></i>\n' +
-                    '                    <input type="hidden" name="tmtbSq" value="' + tmtb.tmtbSq + '" />' +
-                    '                    <span>';
-            tmtbHtml += tmtb.tmtbNm;
-            tmtbHtml += '</span>\n' +
-                    '                </a>\n' +
-                    '            </div>\n' +
-                    '        </div>';
+            if (notApplyAmtTmtbList[i].tmtbSq != 0) {
+                let tmtb = notApplyAmtTmtbList[i];
+                tmtbHtml += '<div class="more_sale amtNotApplyTmtbList">\n' +
+                        '            <div class="txt">\n' +
+                        '                <a href="">\n' +
+                        '                    <i class="ico ico_saletag"></i>\n' +
+                        '                    <input type="hidden" name="tmtbSq" value="' + tmtb.tmtbSq + '" />' +
+                        '                    <span>';
+                tmtbHtml += tmtb.tmtbNm;
+                tmtbHtml += '</span>\n' +
+                        '                </a>\n' +
+                        '            </div>\n' +
+                        '        </div>';
+            }
         }
 
-        $(".area_saleitem").html(tmtbHtml);
+        if(tmtbHtml != "") {
+            tmtbHtml = "<h4>다다익선 할인 대상이 있습니다.</h4>" + tmtbHtml;
+        }
 
+        $(".area_saleitem").html(tmtbHtml);
     }
 
     function cancelCartCpn() {
-        $("#sumRealPayAmt").text(Number(sumRealPayAmt).toLocaleString());
-        $("#totDcAmt").text(Number(totDcAmt).toLocaleString());
-        $(".area_salecoupon .coupon_box").hide();
+        $("#cartListForm #sumRealPayAmt").text(Number(sumRealPayAmt).toLocaleString());
+        $("#cartListForm #totDcAmt").text(Number(totDcAmt).toLocaleString());
+        $("#cartListForm .area_salecoupon .coupon_box").hide();
     }
 
     function serialCpnApply() {
-        let testArr = [];
-        $("#cartListForm input[name=cartSqArr]").each(function(index, item) {
-            testArr.push($(this).val());
+        let cartArr = [];
+        let currPrices = [];
+        $("#cartListForm input[name=cartSqArr]:checked").each(function(index, item) {
+            cartArr.push($(this).val());
+            currPrices.push($(this).parents(".cartInfo").find("input[name=tmtbDcAmt]").val());
         });
 
         let data = {
-            rdCpnNm : $("#serialCpnNm").val(),
-            cartSqArr : testArr
+            rdCpnNm : $("#cartListForm #serialCpnNm").val(),
+            cartSqArr : cartArr,
+            currPrices : currPrices
         }
 
         let jsonData = JSON.stringify(data);
@@ -564,21 +619,21 @@
             dataType : 'json',
             data : jsonData,
             success : function(result) {
-                $(".area_salecoupon .coupon_box").show();
+                $("#cartListForm .area_salecoupon .coupon_box").show();
 
                 // 합계 금액
-                $("#sumRealPayAmt").text(Number(sumRealPayAmt - result.serialCpnInfo.dcAmt).toLocaleString());
-                $("#totDcAmt").text(Number(totDcAmt - result.serialCpnInfo.dcAmt).toLocaleString());
+                $("#cartListForm #sumRealPayAmt").text(Number(sumRealPayAmt - result.serialCpnInfo.dcAmt).toLocaleString());
+                $("#cartListForm #totDcAmt").text(Number(totDcAmt - result.serialCpnInfo.dcAmt).toLocaleString());
 
                 // 쿠폰 정보
-                $(".area_salecoupon .cp_name").text(result.serialCpnInfo.cpnNm);
-                $(".area_salecoupon .cp_condition").html(result.serialCpnInfo.cpnDesc + "<span><em class='tag'>1장 보유</em></span>");
-                $(".area_salecoupon .availStdt").text(result.serialCpnInfo.availStdt);
-                $(".area_salecoupon .availEddt").text(result.serialCpnInfo.availEddt);
+                $("#cartListForm .area_salecoupon .cp_name").text(result.serialCpnInfo.cpnNm);
+                $("#cartListForm .area_salecoupon .cp_condition").html(result.serialCpnInfo.cpnDesc + "<span><em class='tag'>1장 보유</em></span>");
+                $("#cartListForm .area_salecoupon .availStdt").text(result.serialCpnInfo.availStdt);
+                $("#cartListForm .area_salecoupon .availEddt").text(result.serialCpnInfo.availEddt);
                 if(result.serialCpnInfo.dcWay == "G240_10") {
-                    $(".area_salecoupon .cp_dc_val").html( "<em>" + Number(result.serialCpnInfo.dcVal).toLocaleString() + "</em> 원");
+                    $("#cartListForm .area_salecoupon .cp_dc_val").html( "<em>" + Number(result.serialCpnInfo.dcVal).toLocaleString() + "</em> 원");
                 } else if (result.serialCpnInfo.dcWay == "G240_11") {
-                    $(".area_salecoupon .cp_dc_val").html( "<em>" + result.serialCpnInfo.dcVal + "%</em>");
+                    $("#cartListForm .area_salecoupon .cp_dc_val").html( "<em>" + result.serialCpnInfo.dcVal + "%</em>");
                 }
             }
         });
@@ -597,12 +652,261 @@
         return false;
     });
 
+    function deleteCart(gbn) {
+        let cartArr = [];
+        if(gbn == "WMS_SELECT") {
+            $("#cartListForm .wmsList input[name=cartSqArr]:checked").each(function () {
+                cartArr.push($(this).val());
+            });
+
+            if(!confirm("총 " + cartArr.length + "개의 상품을 삭제합니다.")) {
+                return false;
+            }
+        } else if(gbn == "DELV_SELECT") {
+            $("#cartListForm .delvList input[name=cartSqArr]:checked").each(function () {
+                cartArr.push($(this).val());
+            });
+
+            if(!confirm("총 " + cartArr.length + "개의 상품을 삭제합니다.")) {
+                return false;
+            }
+        } else if(gbn == "WMS_ALL") {
+            $("#cartListForm .wmsList input[name=cartSqArr]").each(function() {
+                cartArr.push($(this).val());
+            });
+
+            if(!confirm("총알배송상품을 전부 삭제하시겠습니까?")) {
+                return false;
+            }
+        } else if(gbn == "DELV_ALL") {
+            $("#cartListForm .delvList input[name=cartSqArr]").each(function() {
+                cartArr.push($(this).val());
+            });
+
+            if(!confirm("업체직배송 상품을 전부 삭제하시겠습니까?")) {
+                return false;
+            }
+        } else {
+            cartArr.push(gbn);
+        }
+
+        if(cartArr.length < 1) {
+            alert("삭제하실 상품을 선택해 주세요.");
+            return false;
+        }
+
+        let data = {
+            cartSqArr : cartArr
+        }
+
+        let jsonData = JSON.stringify(data);
+
+        $.ajax( {
+            type: "POST",
+            url : '/cart/deleteCart',
+            contentType: 'application/json',
+            dataType : 'json',
+            data : jsonData,
+            success : function(result) {
+                alert("삭제 되었습니다.");
+                getCartList();
+            }
+        });
+    }
+
     //쿠폰사용안내 팝업열기
     $(document).on('click','#btn_cpinfo_pop',function(e){
         $("#cpinfoPop").modal("show");
         return false;
     });
 
+    $("input[name=cartSqArr]").on("change", function(e) {
+        let cartArr = [];
+
+        // 선택된 장바구니 번호
+        $("#cartListForm input[name=cartSqArr]:checked").each(function () {
+            cartArr.push($(this).val());
+        });
+
+        // 선택된 장바구니 정보 가공
+        let data = {    cartSqArr : cartArr }
+        let jsonData = JSON.stringify(data);
+
+        $.ajax( {
+            type: "POST",
+            url : '/cart/change/goods/list',
+            contentType: 'application/json',
+            dataType : 'json',
+            data : jsonData,
+            success : function(result) {
+                fnChangeCartListInfo(result);
+            }
+        });
+    });
+
+    function fnChangeCartListInfo(order) {
+        let wmsList = order.wmsCartList;
+        let delvList = order.delvCartList;
+        let cartList = new Array();
+
+        // 다다익선 정보 숨김
+        $("#cartListForm .applyTmtb").hide();
+        $("#cartListForm .notApplyTmtb").hide();
+
+        // 장바구니 각 상품 가격 정보 할인 전으로 변경
+        $("#cartListForm .cartInfo input[name=cartSq]").each(function() {
+            if($(this).parent().find(".info_calc .price > del").text() != "") {
+                $(this).parent().find(".info_calc .selling_price").text($(this).parent().find(".info_calc .price > del").text());
+                $(this).parent().find(".info_calc .price > del").remove();
+            }
+        });
+        $("#cartListForm").find(".delvFeeArea").html("<div class='info_dlvr'><span class='dlvr_fee'>배송비 무료</span></div>");
+
+        for(let i = 0 ; i < wmsList.length ; i++) {
+            cartList.push(wmsList[i]);
+            $("#cartListForm .wmsCartInfo input[name=cartSq]").each(function() {
+                if(wmsList[i].cartSq == $(this).val()) {
+                    let wms = wmsList[i];
+                    // $(this).parent().find(".thumb_box img").attr("src", result.imgPath1 + "/" + wms.sysImgNm);
+                    $(this).parent().find(".od_moresale .applyTmtbNm > ul").html("");
+                    $(this).parent().find(".od_moresale .notApplyTmtbNm > ul").html("");
+
+                    // 다다익선 적용 정보 생성성
+                    if(wms.qtyTmtbSq > 0 && wms.applyQtySectionYn == "Y") {
+                        $(this).parent().find(".applyTmtb .applyTmtbNm > ul").append("<li>" + wms.qtyTmtbNm + "</li>");
+                        $(this).parent().find(".applyTmtb").show();
+                    }
+                    if(wms.amtTmtbSq > 0 && wms.applyAmtSectionYn == "Y") {
+                        $(this).parent().find(".applyTmtb .applyTmtbNm > ul").append("<li>" + wms.amtTmtbNm + "</li>");
+                        $(this).parent().find(".applyTmtb").show();
+                    }
+                    if(wms.qtyTmtbSq > 0 && wms.applyQtySectionYn == "N") {
+                        $(this).parent().find(".notApplyTmtb .notApplyTmtbNm > ul").append("<li>" + wms.qtyTmtbNm + "<a href=''>대상 상품 보기</a></li>");
+                        $(this).parent().find(".notApplyTmtb").show();
+                    }
+                    if(wms.amtTmtbSq > 0 && wms.applyAmtSectionYn == "N") {
+                        $(this).parent().find(".notApplyTmtb .notApplyTmtbNm > ul").append("<li>" + wms.amtTmtbNm + "<a href=''>대상 상품 보기</a></li>");
+                        $(this).parent().find(".notApplyTmtb").show();
+                    }
+
+                    // 다다익선 할인가 적용
+                    if(wms.tmtbDcAmt < wms.currPrice) {
+                        $(this).parent().find(".info_calc .selling_price").text(Number(wms.tmtbDcAmt).toLocaleString() + " 원");
+                        $(this).parent().find(".info_calc .price").append("<del>" + Number(wms.currPrice).toLocaleString() + " 원</del>");
+                    }
+
+                    if(wms.delvFee == 0) {
+                        $(".wmsList").find(".delv_" + wms.delvFeeCd).html("<div class='info_dlvr'><span class='dlvr_fee'>배송비 무료</span></div>");
+                    } else {
+                        let html = "<div class='info_dlvr'><span class='dlvr_fee'>" + Number(wms.delvFee).toLocaleString() + " 원</span><a href='#' target='_black'>배송비 SAVE 상품 보기</a></div>";
+                        $(".wmsList").find(".delv_" + wms.delvFeeCd).html(html);
+                        // $(".wmsList").find(".delv_" + wms.delvFeeCd).append("<span class='dlvr_shop'>" + wms.supplyCompNm + " 업체직배송</span>");
+
+                    }
+                }
+            });
+        }
+
+        for(let i = 0 ; i < delvList.length ; i++) {
+            cartList.push(delvList[i]);
+            $("#cartListForm .delvCartInfo input[name=cartSq]").each(function() {
+                if(delvList[i].cartSq == $(this).val()) {
+                    let delv = delvList[i];
+                    // $(this).parent().find(".thumb_box img").attr("src", result.imgPath1 + "/" + wms.sysImgNm);
+                    $(this).parent().find(".od_moresale .applyTmtbNm > ul").html("");
+                    $(this).parent().find(".od_moresale .notApplyTmtbNm > ul").html("");
+
+                    // 다다익선 적용 정보 생성성
+                    if(delv.qtyTmtbSq > 0 && delv.applyQtySectionYn == "Y") {
+                        $(this).parent().find(".applyTmtb .applyTmtbNm > ul").append("<li>" + delv.qtyTmtbNm + "</li>");
+                        $(this).parent().find(".applyTmtb").show();
+                    }
+                    if(delv.amtTmtbSq > 0 && delv.applyAmtSectionYn == "Y") {
+                        $(this).parent().find(".applyTmtb .applyTmtbNm > ul").append("<li>" + delv.amtTmtbNm + "</li>");
+                        $(this).parent().find(".applyTmtb").show();
+                    }
+                    if(delv.qtyTmtbSq > 0 && delv.applyQtySectionYn == "N") {
+                        $(this).parent().find(".notApplyTmtb .notApplyTmtbNm > ul").append("<li>" + delv.qtyTmtbNm + "<a href=''>대상 상품 보기</a></li>");
+                        $(this).parent().find(".notApplyTmtb").show();
+                    }
+                    if(delv.amtTmtbSq > 0 && delv.applyAmtSectionYn == "N") {
+                        $(this).parent().find(".notApplyTmtb .notApplyTmtbNm > ul").append("<li>" + delv.amtTmtbNm + "<a href=''>대상 상품 보기</a></li>");
+                        $(this).parent().find(".notApplyTmtb").show();
+                    }
+
+                    // 다다익선 할인가 적용
+                    if(delv.tmtbDcAmt < delv.currPrice) {
+                        $(this).parent().find(".info_calc .selling_price").text(Number(delv.tmtbDcAmt).toLocaleString() + " 원");
+                        $(this).parent().find(".info_calc .price").append("<del>" + Number(delv.currPrice).toLocaleString() + " 원</del>");
+                    }
+
+                    if(delv.delvFee == 0) {
+                        $(".delvList").find(".delv_" + delv.delvFeeCd).html("<div class='info_dlvr'><span class='dlvr_fee'>배송비 무료</span></div>");
+                    } else {
+                        let html = "<div class='info_dlvr'><span class='dlvr_fee'>" + Number(delv.delvFee).toLocaleString() + " 원</span><span class='dlvr_shop'>" + delv.supplyCompNm + " 업체직배송</span><a href='#' target='_black'>배송비 SAVE 상품 보기</a></div>";
+                        $(".delvList").find(".delv_" + delv.delvFeeCd).html(html);
+                    }
+                }
+            });
+        }
+
+        // 결제 총액 영역 수정
+        $("#cartListForm .sumCurrPrice").text(Number(order.sumOrdAmt).toLocaleString());
+        $("#cartListForm .totDelvFee").text(Number(order.totDelvFee).toLocaleString());
+        sumRealPayAmt = order.sumRealPayAmt + order.totDelvFee;
+        totDcAmt = order.totDcAmt;
+
+        // 할인코드 쿠폰 금액 재확인
+        if($("#cartListForm #serialCpnNm").val()) {
+            alert(1);
+            serialCpnApply();
+        } else {
+            $("#cartListForm .totDcAmt").text(Number(order.totDcAmt).toLocaleString());
+            $("#cartListForm .sumRealPayAmt").text(Number(order.sumRealPayAmt + order.totDelvFee).toLocaleString());
+            cancelCartCpn();
+        }
+
+        let notApplyQtyTmtbList = new Array();
+        let notApplyAmtTmtbList = new Array();
+        for(let i = 0 ; i < cartList.length ; i++) {
+            let cart = cartList[i];
+            if(cart.applyQtySectionYn == "N") {
+                let obj = new Object();
+                obj.tmtbSq = cart.qtyTmtbSq;
+                obj.tmtbNm = cart.qtyTmtbNm;
+                obj.currPrice = cart.currPrice;
+                obj.goodsNm = cart.goodsNm;
+                obj.brandNm = cart.brandNm;
+                obj.imgPath = order.imgPath1 + "/" + cart.sysImgNm;
+
+                notApplyQtyTmtbList.push(obj);
+            }
+
+            if(cart.applyAmtSectionYn == "N") {
+                let obj = new Object();
+                obj.tmtbSq = cart.amtTmtbSq;
+                obj.tmtbNm = cart.amtTmtbNm;
+
+                notApplyAmtTmtbList.push(obj);
+            }
+        }
+
+        // 수량 다다익선 정렬
+        var t = new Object();
+        for (let i = 0; i < notApplyQtyTmtbList.length; i++) {
+            for (let j = 0; j < notApplyQtyTmtbList.length - i - 1; j++) {
+                if (notApplyQtyTmtbList[j].tmtbSq > notApplyQtyTmtbList[j + 1].tmtbSq) {
+                    t = notApplyQtyTmtbList[j];
+                    notApplyQtyTmtbList[j] = notApplyQtyTmtbList[j + 1];
+                    notApplyQtyTmtbList[j + 1] = t;
+                }
+            }
+        }
+
+        // 다다익선 적용 대상 상품 노출
+        fnCreateNotApplyTmtbAreaList(notApplyQtyTmtbList, notApplyAmtTmtbList);
+    }
+
     //옵션변경 팝업열기
     $(document).on('click','.btn_opt_pop',function(e){
         $("#optModifyPop").modal("show");

+ 68 - 9
src/main/webapp/ux/style24_link.js

@@ -58,7 +58,7 @@ const _PAGE_NOTICE = _frontUrl + "/callcenter/notice/form";								// 고객센
  * @access : public
  * @desc   : page 이동
  * <pre>
- *     cfnGoToPage(PAGE_LOGIN);
+ *		 cfnGoToPage(PAGE_LOGIN);
  * </pre>
  * @param  : page - page
  * @return : None
@@ -76,10 +76,10 @@ var cfnGoToPage = function(page, ithrCd) {
  * @access : public
  * @desc   : 나이스 휴대폰 인증
  * <pre>
- *     cfnOpenCellphoneCertify();
- *     호출된 페이지에서
- *     PC : fnNiceCallBack(encData) 콜백 함수 생성 후 encData 가지고 호출 처리
- *     MO : redirectUrl 호출하는 페이지에서 넣어줘야됨
+ *		 cfnOpenCellphoneCertify();
+ *		 호출된 페이지에서
+ *		 PC : fnNiceCallBack(encData) 콜백 함수 생성 후 encData 가지고 호출 처리
+ *		 MO : redirectUrl 호출하는 페이지에서 넣어줘야됨
  * </pre>
  * @param  redirectUrl - 모바일에서 사용 페이지이동으로 하기 때문에
  * @param  custparams - 회원정보수정 화면에서 사용함
@@ -110,10 +110,10 @@ var cfnOpenCellphoneCertify = function (redirectUrl, custparams) {
  * @access : public
  * @desc   : 나이스 아이핀 인증
  * <pre>
- *     cfnOpenIpinCertify();
- *     호출된 페이지에서
- *     PC : fnNiceCallBack(encData) 콜백 함수 생성 후 encData 가지고 호출 처리
- *     MO :
+ *		 cfnOpenIpinCertify();
+ *		 호출된 페이지에서
+ *		 PC : fnNiceCallBack(encData) 콜백 함수 생성 후 encData 가지고 호출 처리
+ *		 MO :
  * </pre>
  * @since  : 2021/02/09
  * @author : jsshin
@@ -132,3 +132,62 @@ var cfnOpenIpinCertify = function (redirectUrl) {
 		}
 	}
 };
+
+/**
+ * @type   : function
+ * @access : public
+ * @desc   : 장바구니 등록
+ * <pre>
+ *		cfnOpenIpinCertify(cartList);
+ *		cartList는 Array로 등록해주셔야합니다.
+ *		ex) 일반 & deal 상품 장바구니 등록 (일반&딜 상품도 배열에 담아서 전송해주세요.)
+ *			let compsList = [];
+ *			let temp = new Object;
+ *			temp.goodsCd = "14373703";
+ *			temp.optCd = "블랙140";
+ *			temp.goodsQty = 1;
+ *			temp.goodsType = "G056_D";
+ *			temp.dealGoodsCd = "STY"
+ *			temp.cartGb = "C";
+ *			temp.afLinkCd = "afLinkCd";
+ *			temp.ithrCd = "G027_ZZZ";
+ *			temp.contentsLoc = "G028_YYY";
+ *			temp.planDtlSq = "123";
+ *			compsList.push(temp);
+ *			cfnAddCart(compsList);
+ *
+ *		ex) 세트상품 장바구니 등록
+ *			let compsList = [];
+ *			for(let j = 0 ; j < length ; j++) {		// 구성품 수량 만큼 for
+ *				let temp = new Object;
+ *				temp.goodsCd = "STYS000000016";
+ *				temp.itemCd = '14373757';
+ *				temp.optCd = "핑크120";
+ *				temp.goodsQty = 1;
+ *				temp.goodsType = "G056_S";
+ *				temp.cartGb = "C";
+ *				temp.afLinkCd = "afLinkCd";
+ *				temp.ithrCd = "G027_ZZZ";
+ *				temp.contentsLoc = "G028_YYY";
+ *				temp.planDtlSq = "123";
+ *				compsList.push(temp);
+ *			}
+ *			cfnAddCart(compsList);
+ * </pre>
+ * @since  : 2021/02/24
+ * @author : xodud1202
+ */
+function cfnAddCart(cartList) {
+	let jsonData = JSON.stringify(cartList);
+	
+	$.ajax( {
+		type: "POST",
+		url : '/cart/save',
+		data : jsonData,
+		contentType: 'application/json',
+		dataType : 'text',
+		success : function(result) {
+			alert(result);
+		}
+	});
+}