Преглед изворни кода

Merge branch 'order' into develop

# Conflicts:
#	src/main/webapp/ux/pc/css/layout.css
#	src/main/webapp/ux/pc/css/main.css
card007 пре 5 година
родитељ
комит
ab77e51f36

+ 84 - 3
src/main/java/com/style24/front/biz/dao/TsfCartDao.java

@@ -5,6 +5,7 @@ import java.util.List;
 
 import com.style24.core.support.annotation.ShopDs;
 import com.style24.persistence.domain.Cart;
+import com.style24.persistence.domain.GoodsImg;
 import com.style24.persistence.domain.Order;
 
 /**
@@ -32,7 +33,7 @@ public interface TsfCartDao {
 	 * @author xodud1202
 	 * @since 2021. 02. 01
 	 */
-	Collection<Integer> selectHasSetItemCartList(Cart param);
+	Collection<Cart> selectHasSetItemCartList(Cart param);
 
 	/**
 	 * 장바구니 등록 상품 확인
@@ -62,7 +63,7 @@ public interface TsfCartDao {
 	void insertCartDetailInfo(Cart param);
 
 	/**
-	 * 장바구니 상세 신규 등록
+	 * 장바구니 수정
 	 * @param Cart
 	 * @return void
 	 * @author xodud1202
@@ -70,9 +71,27 @@ public interface TsfCartDao {
 	 */
 	void updateCartInfo(Cart param);
 
+	/**
+	 * 장바구니 수정
+	 * @param param
+	 * @return void
+	 * @author xodud1202
+	 * @since 2021. 03. 01
+	 */
+	void updateCart(Cart param);
+
+	/**
+	 * 장바구니 상세 수정
+	 * @param param
+	 * @return void
+	 * @author xodud1202
+	 * @since 2021. 03. 01
+	 */
+	void updateCartDetail(Cart param);
+
 	/**
 	 * 장바구니 이력 정보 저장
-	 * @param Cart
+	 * @param param
 	 * @return void
 	 * @author xodud1202
 	 * @since 2021. 02. 02
@@ -190,4 +209,66 @@ public interface TsfCartDao {
 	 * @date 2021. 2. 24
 	 */
 	void deleteCart(Cart param);
+
+	/**
+	 * 장바구니 삭제
+	 * @param param - 장바구니 정보
+	 * @author xodud1202
+	 * @date 2021. 03. 01
+	 */
+	void deleteCartDetail(Cart param);
+
+	/**
+	 * 장바구니 상품 마스터 정보 조회
+	 * @param param
+	 * @return
+	 * @author xodud1202
+	 * @date 2021. 2. 25
+	 */
+	Cart selectCartGoodsInfo(Cart param);
+
+	/**
+	 * 장바구니 세트 구성 상품 정보 조회
+	 * @param param
+	 * @return
+	 * @author xodud1202
+	 * @date 2021. 2. 25
+	 */
+	Collection<Cart> selectCartSetGoodsInfo(Cart param);
+
+	/**
+	 * 장바구니 상품 컬러 옵션 정보 조회
+	 * @param param
+	 * @return
+	 * @author xodud1202
+	 * @date 2021. 2. 26
+	 */
+	Collection<Cart> selectCartGoodsColorList(Cart param);
+
+	/**
+	 * 장바구니 상품 사이즈 옵션 정보 조회
+	 * @param param
+	 * @return
+	 * @author xodud1202
+	 * @date 2021. 2. 26
+	 */
+	Collection<Cart> selectCartGoodsSizeList(Cart param);
+
+	/**
+	 * 장바구니 자사 상품 이미지 리스트 조회
+	 * @param param
+	 * @return
+	 * @author xodud1202
+	 * @date 2021. 2. 25
+	 */
+	Collection<GoodsImg> selectCartSelfGoodsOptionImgList(Cart param);
+
+	/**
+	 * 장바구니 입점업체 상품 이미지 리스트 조회
+	 * @param param
+	 * @return
+	 * @author xodud1202
+	 * @date 2021. 2. 25
+	 */
+	Collection<GoodsImg> selectCartDelvGoodsOptionImgList(Cart param);
 }

+ 27 - 0
src/main/java/com/style24/front/biz/dao/TsfOrderChangeDao.java

@@ -0,0 +1,27 @@
+package com.style24.front.biz.dao;
+
+import java.util.Collection;
+
+import com.style24.core.support.annotation.ShopDs;
+import com.style24.persistence.domain.Order;
+
+/**
+ * 주문 변경 Dao
+ * 
+ * @author card007
+ * @since 2021. 02. 26
+ */
+@ShopDs
+public interface TsfOrderChangeDao {
+
+	/**
+	 * 마이페이지 취소/반품 목록 조회
+	 *
+	 * @param Order
+	 * @return Collection<Order>
+	 * @author card007
+	 * @since 2021. 02. 26
+	 */
+	Collection<Order> getCancelListForMypage(Order order);
+
+}

+ 184 - 9
src/main/java/com/style24/front/biz/service/TsfCartService.java

@@ -8,6 +8,7 @@ import java.util.HashMap;
 import java.util.List;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -15,6 +16,7 @@ import com.style24.core.biz.service.TscOrderService;
 import com.style24.core.support.env.TscConstants;
 import com.style24.core.support.session.TscSession;
 import com.style24.front.biz.dao.TsfCartDao;
+import com.style24.front.support.env.TsfConstants;
 import com.style24.front.support.security.session.TsfSession;
 import com.style24.persistence.domain.Cart;
 import com.style24.persistence.domain.Goods;
@@ -45,11 +47,14 @@ public class TsfCartService {
 	@Autowired
 	private TscOrderService coreOrderService;
 
+	@Autowired
+	private Environment env;
+
 	/**
 	 * 장바구니 저장
 	 * 단품 : goodsCd, optCd, optCd1, optCd2
 	 * 세트 : goodsCd,
-	 * @param cart
+	 * @param params
 	 */
 	public void saveCartInfo(Collection<Cart> params) {
 		Cart cart = new Cart();
@@ -72,7 +77,10 @@ public class TsfCartService {
 			// 상품 마스터 정보 확인
 			Goods goods = new Goods();
 			goods.setGoodsCd(param.getGoodsCd());
+			goods.setFrontGb(TsfSession.getFrontGb());
+
 			goods = goodsService.getGoodsInfo(goods);
+
 			if (goods == null) {
 				throw new IllegalArgumentException("상품 정보가 존재하지 않습니다.");
 			}
@@ -94,6 +102,8 @@ public class TsfCartService {
 			}
 
 			cart.setGoodsCd(param.getGoodsCd());
+
+			// 장바구니에 있는 같은 상품(옵션이 상이해도 같은 상품이므로 상품 전체 조회)
 			int goodsCartCnt = cartDao.getHasGoodsCartCnt(param);
 			if (param.getGoodsQty() + goodsCartCnt > goods.getDayMaxOrdQty()) {
 				throw new IllegalArgumentException("1일 구매한도 수량이 초과되었습니다.");
@@ -171,13 +181,13 @@ public class TsfCartService {
 		}
 
 		// 같은 장바구니 상품 확인
-		Collection<Integer> cartSqList = cartDao.selectHasSetItemCartList(cart);
+		Collection<Cart> cartSqList = cartDao.selectHasSetItemCartList(cart);
 
 		if (cartSqList != null && cartSqList.size() > 0) {		// 장바구니 기존재
-			if (cartSqList.size() > 1) {							// 장바구니 조회 결과 이상시 insert or select 수정 필요
+			if (cartSqList.size() > 1) {						// 장바구니 조회 결과 이상시 insert or select 수정 필요
 				throw new IllegalArgumentException("장바구니 조회에 실패하였습니다. 관리자에게 문의해주세요.");
 			} else {
-				cart.setCartSq(cartSqList.iterator().next());
+				cart.setCartSq(cartSqList.iterator().next().getCartSq());
 				cartDao.updateCartInfo(cart);               // 장바구니 정보 수정
 				cartDao.insertCartHst(cart);                // 장바구니 수정 이력 저장
 			}
@@ -310,7 +320,7 @@ public class TsfCartService {
 
 	/**
 	 * 다다익선 할인 금액 조회
-	 * @param Order
+	 * @param param
 	 * param.cartSqArr[] : 필수
 	 * @return String
 	 * @author xodud1202
@@ -326,8 +336,6 @@ public class TsfCartService {
 
 		// 장바구니 등록 다다익선 일련번호 지정
 		List<Integer> applySq 		= new ArrayList<Integer>();
-		List<Integer> qtyApplySq	= new ArrayList<Integer>();
-		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())) {
@@ -503,7 +511,7 @@ public class TsfCartService {
 	/**
 	 * 장바구니 배송단위별 상품 정보 조회
 	 *
-	 * @param Order
+	 * @param cartGoodsList
 	 * @author jsh77b
 	 * @since 2021. 02. 02
 	 */
@@ -563,7 +571,7 @@ public class TsfCartService {
 				if (param.getDelvFeeCd().equals(delv.getDelvFeeCd())) {
 					compCnt++;
 					if("N".equals(param.getSoldoutYn())) {
-						delv.setCompSumPrice(delv.getCompSumPrice() + param.getCurrPrice());
+						delv.setCompSumPrice(delv.getCompSumPrice() + param.getTmtbDcAmt());
 					}
 
 					if (compCnt == 1) {
@@ -645,6 +653,7 @@ public class TsfCartService {
 	public void deleteCart(Cart param) {
 		cartDao.deleteCart(param);
 	}
+
 	/**
 	 * 로그인 후 장바구니 Update
 	 * 		회원 로그인 후 호출됨으로 세션 정보 있음
@@ -688,4 +697,170 @@ public class TsfCartService {
 		}
 	}
 
+	public Cart getCartGoodsInfo(Cart param) {
+		// Collection<Cart> result = new ArrayList<Cart>();
+		/* cart.add(cartDao.selectCartGoodsInfo(param)); */
+
+		// 장바구니 상품 마스터 정보 조회
+		Cart cart = cartDao.selectCartGoodsInfo(param);
+
+		// 세트 상품일 경우
+		if(TscConstants.GoodsType.SET.value().equals(cart.getGoodsType())) {
+			cart.setCartCompsList(cartDao.selectCartSetGoodsInfo(cart));
+			for(Cart comp : cart.getCartCompsList()) {
+				comp.setCartSq(cart.getCartSq());
+				comp.setCartColorList(cartDao.selectCartGoodsColorList(comp));
+				for(Cart color : comp.getCartColorList()) {
+					color.setCartSq(comp.getCartSq());
+					color.setCartSizeList(cartDao.selectCartGoodsSizeList(color));
+				}
+			}
+			cart.setCartImgList(cartDao.selectCartDelvGoodsOptionImgList(cart));		// TB_GOODS.MAIN_COLOR_CD의 이미지를 가져옴.
+		} else {	// 일반, DEAL 상품일 경우
+			cart.setCartCompsList(new ArrayList<Cart>());
+			cart.getCartCompsList().add(new Cart());
+
+			for(Cart comp : cart.getCartCompsList()) {
+				if("Y".equals(cart.getSelfGoodsYn())) {
+					comp.setCartColorList(cartDao.selectCartGoodsColorList(cart));
+
+					if("Y".equals(cart.getSelfGoodsYn())) {		// 자사 상품은 TB_GOODS_IMG.COLOR_CD = TB_OPTION.OPT_CD1
+						for(Cart color : comp.getCartColorList()) {
+							color.setCartSq(cart.getCartSq());
+							color.setCartImgList(cartDao.selectCartSelfGoodsOptionImgList(color));
+							color.setCartSizeList(cartDao.selectCartGoodsSizeList(color));
+						}
+					}
+				} else {
+					comp.setCartColorList(cartDao.selectCartGoodsSizeList(cart));
+				}
+			}
+
+			if(!"Y".equals(cart.getSelfGoodsYn())) {			// 입점 상품은 TB_GOODS_IMG.COLOR_CD = TB_GOODS.MAIN_COLOR_CD
+				cart.setCartImgList(cartDao.selectCartDelvGoodsOptionImgList(cart));
+			}
+		}
+
+		cart.setImgPath(env.getProperty("upload.goods.view"));
+
+		return cart;
+	}
+
+	@Transactional("shopTxnManager")
+	public void updateCartOption(Cart param) {
+		param.setJsessionId(TsfSession.getSessionId());
+		param.setFrontGb(TsfSession.getFrontGb());
+
+		if(TsfSession.isLogin()) {
+			param.setCustNo(TsfSession.getInfo().getCustNo());
+			param.setRegNo(param.getCustNo());
+			param.setUpdNo(param.getCustNo());
+		} else {
+			param.setCustNo(0);
+			param.setRegNo(0);
+			param.setUpdNo(0);
+		}
+
+		// 재고 체크
+		Goods goods = new Goods();
+		goods.setGoodsCd(param.getGoodsCd());
+		goods.setFrontGb(TsfSession.getFrontGb());
+
+		goods = goodsService.getGoodsInfo(goods);
+
+		if (goods == null) {
+			throw new IllegalArgumentException("상품 정보가 존재하지 않습니다.");
+		}
+		if (TscConstants.GoodsStat.SOLDOUT.value().equals(goods.getGoodsStat())) {
+			throw new IllegalArgumentException("품절입니다.");
+		}
+		
+		// 현재 장바구니 수량
+		int goodsCartCnt = cartDao.getHasGoodsCartCnt(param);
+
+		if (param.getGoodsQty() + goodsCartCnt > goods.getDayMaxOrdQty()) {
+			throw new IllegalArgumentException("1일 구매한도 수량이 초과되었습니다.");
+		}
+
+		// 구성 상품 재고 확인
+		for(int i = 0 ; i < param.getCartDtlSqArr().length ; i++) {
+			// 상품 재고 확인
+			GoodsStock checkParam = new GoodsStock();
+			checkParam.setGoodsCd(param.getGoodsCd());
+			checkParam.setItemCd(param.getItemCds()[i]);
+			checkParam.setOptCd(param.getOptCds()[i]);
+			checkParam.setGoodsQty(param.getGoodsQty());
+			checkParam.setGoodsType(param.getGoodsType());
+			String stockResult = goodsService.getCheckStock(checkParam);
+
+			if (!"SUCCESS".equals(stockResult)) {
+				throw new IllegalArgumentException(stockResult);
+			}
+		}
+
+		StringBuilder sb = new StringBuilder();
+		if(TscConstants.GoodsType.SET.value().equals(param.getGoodsType())) {
+			// 장바구니 보유 CART_SQ 쿼리
+			for(int i = 0 ; i < param.getCartDtlSqArr().length ; i++) {
+				sb.append("SELECT CD.CART_SQ \n FROM TB_CART C \n INNER JOIN TB_CART_DETAIL CD \n ON C.CART_SQ = CD.CART_SQ \n WHERE C.CUST_NO = ");
+				// TODO 로그인 정보 확인
+				if (param.getCustNo() == 0) {
+					sb.append(param.getCustNo()).append("\n AND JSESSION_ID = '").append(param.getJsessionId()).append("'");
+				} else {
+					sb.append(param.getCustNo());
+				}
+				sb.append("\n AND CD.ITEM_CD = '").append(param.getItemCds()[i]).append("' \n AND CD.OPT_CD = '").append(param.getOptCds()[i]).append("'");
+				if (i < param.getCartDtlSqArr().length - 1) {
+					sb.append("\n UNION ALL \n");
+				}
+			}
+
+			param.setItemCdSql(sb.toString());
+			param.setCartGb(TscConstants.CartGb.CART.value());
+
+			// 장바구니내 같은 상품 확인
+			param.setNotCartSq(param.getCartSq());				// 수정 장바구니 번호 제외
+			Collection<Cart> cartList = cartDao.selectHasSetItemCartList(param);
+
+			// 동일 상품 존재시
+			if (cartList != null && cartList.size() > 0) {		// 장바구니 기존재
+				if (cartList.size() > 1) {						// 장바구니 조회 결과 이상시 insert or select 수정 필요
+					throw new IllegalArgumentException("장바구니 조회에 실패하였습니다. 관리자에게 문의해주세요.");
+				} else {
+					// 기존 존재 장바구니 UPDATE
+					Cart cart = new Cart();
+					cart.setCartSq(cartList.iterator().next().getCartSq());
+					cart.setGoodsQty(param.getGoodsQty());
+					cart.setAfLinkCd(param.getAfLinkCd());
+					cart.setIthrCd(param.getIthrCd());
+					cart.setContentsLoc(param.getContentsLoc());
+					cart.setPlanDtlSq(param.getPlanDtlSq());
+					cart.setUpdNo(param.getUpdNo());
+					cart.setGoodsCd(param.getGoodsCd());
+					cart.setCustNo(param.getCustNo());
+					cart.setRegNo(param.getRegNo());
+
+					cartDao.updateCartInfo(cart);               // 장바구니 정보 수정
+					cartDao.insertCartHst(cart);                // 장바구니 수정 이력 저장
+
+					// 장바구니 삭제
+					int[] cartSqArr = {param.getCartSq()};
+					param.setCartSqArr(cartSqArr);
+					cartDao.deleteCart(param);
+					cartDao.deleteCartDetail(param);
+				}
+			} else {		// 동일 상품 없을 시 UPDATE
+				cartDao.updateCart(param);						// 장바구니 마스터 정보 저장
+				cartDao.insertCartHst(param);                   // 장바구니 이력 정보 저장
+				for(int i = 0 ; i < param.getCartDtlSqArr().length ; i++) {
+					param.setItemCd(param.getItemCds()[i]);
+					param.setCartDtlSq(param.getCartDtlSqArr()[i]);
+					param.setOptCd(param.getOptCds()[i]);
+
+					cartDao.updateCartDetail(param);		// 장바구니 상세 저장
+					cartDao.insertCartDetailHst(param);         // 장바구니 상세 이력 저장
+				}
+			}
+		}
+	}
 }

+ 3 - 3
src/main/java/com/style24/front/biz/service/TsfGoodsService.java

@@ -221,7 +221,7 @@ public class TsfGoodsService {
 
 	/**
 	 * 상품 재고 체크
-	 * @param goodsStock
+	 * @param param
 	 * goodsCd   (원상품코드) 필수
 	 * goodsType (상품타입) 필수
 	 * optCd     (옵션코드) 필수
@@ -242,7 +242,7 @@ public class TsfGoodsService {
 		}
 
 		if(param.getGoodsType().equals(TscConstants.GoodsType.SET.value())) {		// 세트상품이면 구성 상품코드로 조회
-			GoodsStock stockCheck = new GoodsStock();		// 재고 조회 결과
+			GoodsStock stockCheck = new GoodsStock();								// 재고 조회 결과
 			stockCheck.setGoodsCd(param.getItemCd());
 			stockCheck.setOptCd(param.getOptCd());
 
@@ -260,7 +260,7 @@ public class TsfGoodsService {
 				return param.getItemCd() + "의 재고가 충분하지 않습니다.";
 			}
 		} else {
-			GoodsStock stockCheck = new GoodsStock();		// 재고 조회 결과
+			GoodsStock stockCheck = new GoodsStock();								// 재고 조회 결과
 			stockCheck.setGoodsCd(param.getGoodsCd());
 			stockCheck.setOptCd(param.getOptCd());
 

+ 75 - 0
src/main/java/com/style24/front/biz/service/TsfOrderChangeService.java

@@ -0,0 +1,75 @@
+package com.style24.front.biz.service;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.gagaframework.web.parameter.GagaMap;
+import com.style24.core.support.env.TscConstants;
+import com.style24.front.biz.dao.TsfOrderChangeDao;
+import com.style24.front.biz.dao.TsfOrderDao;
+import com.style24.persistence.domain.Order;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 주문 변경 Service
+ *
+ * @author card007
+ * @since 2021. 02. 26
+ */
+@Service
+@Slf4j
+public class TsfOrderChangeService {
+
+	@Autowired
+	private TsfOrderChangeDao orderChangeDao;
+
+	/**
+	 * 마이페이지 취소/반품 목록 조회
+	 *
+	 * @param Order
+	 * @return Collection<Order>
+	 * @author card007
+	 * @since 2021. 02. 26
+	 */
+	public GagaMap getCancelListForMypage(Order order) {
+		GagaMap map = new GagaMap();
+		Boolean shotDelv = false;
+		Boolean selfMall = false;
+		Boolean supplyMall = false;
+		
+		Collection<Order> result = orderChangeDao.getCancelListForMypage(order);
+		for (Order tmpOrder : result) {
+			// 총알배송 아이콘 설정
+			if (!shotDelv && "Y".equals(tmpOrder.getShotDelvYn())) {
+				shotDelv = true;
+			}
+
+			// STYLE24 일반배송 아이콘 설정
+			if (!selfMall && "Y".equals(tmpOrder.getSelfGoodsYn())) {
+				selfMall = true;
+			}
+
+			// 업체직배송 아이콘 설정
+			if (!supplyMall && "N".equals(tmpOrder.getSelfGoodsYn())) {
+				supplyMall = true;
+			}
+		}
+		
+		map.set("shotDelv", shotDelv);
+		map.set("selfMall", selfMall);
+		map.set("supplyMall", supplyMall);
+		map.set("oneData", result.iterator().next());
+		map.set("returnList", result);
+		return map;
+	}
+
+}

+ 34 - 2
src/main/java/com/style24/front/biz/web/TsfCartController.java

@@ -4,6 +4,7 @@ import java.text.SimpleDateFormat;
 import java.util.Collection;
 import java.util.Date;
 
+import com.gagaframework.web.rest.server.GagaResponse;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Controller;
@@ -17,6 +18,7 @@ import org.springframework.web.servlet.ModelAndView;
 
 import com.gagaframework.web.parameter.GagaMap;
 import com.style24.core.biz.service.TscOrderService;
+import com.style24.core.support.env.TscConstants;
 import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.front.biz.service.TsfCartService;
 import com.style24.front.biz.service.TsfCouponService;
@@ -161,8 +163,6 @@ public class TsfCartController extends TsfBaseController {
 	/**
 	 * 장바구니 삭제
 	 * @param param
-	 * rdCpnNm : 시리얼쿠폰명
-	 * cartSqArr[] : 장바구니 번호 배열
 	 * @return GagaMap
 	 * @author xodud1202
 	 * @since 2021. 02. 23
@@ -173,4 +173,36 @@ public class TsfCartController extends TsfBaseController {
 		cartService.deleteCart(param);
 		return new GagaMap();
 	}
+
+	/**
+	 * 장바구니 삭제
+	 * @param param
+	 * @return String
+	 * @author xodud1202
+	 * @since 2021. 02. 23
+	 */
+	// @ResponseBody
+	@PostMapping("/goods/info")
+	public String getCartGoodsInfo(Cart param, Model model) {
+		Cart cart = cartService.getCartGoodsInfo(param);
+
+		model.addAttribute("cart", cart);
+		model.addAttribute("setType", TscConstants.GoodsType.SET.value());
+		return super.getDeviceViewName("cart/cartChangeOptionPopup");
+	}
+
+	/**
+	 * 장바구니 옵션 변경
+	 * @param param
+	 * @return GagaMap
+	 * @author xodud1202
+	 * @since 2021. 02. 23
+	 */
+	@ResponseBody
+	@PostMapping("/change/option")
+	public GagaResponse updateCartOption(@RequestBody Cart param) {
+		log.info("CHECK INFO >> {} / {} / {} / {}", param.getCartSq(), param.getCartDtlSqArr().toString(), param.getOptCds().toString(), param.getGoodsQty());
+		cartService.updateCartOption(param);
+		return super.ok(message.getMessage("SUCC_0001"));
+	}
 }

+ 42 - 14
src/main/java/com/style24/front/biz/web/TsfMypageController.java

@@ -20,12 +20,15 @@ import org.springframework.web.servlet.ModelAndView;
 import com.gagaframework.web.parameter.GagaMap;
 import com.gagaframework.web.rest.server.GagaResponseStatus;
 import com.style24.core.biz.service.TscCustomerService;
+import com.style24.core.biz.service.TscOrderChangeService;
+import com.style24.core.biz.service.TscOrderRefundService;
 import com.style24.core.biz.service.TscOrderService;
 import com.style24.core.support.env.TscConstants;
 import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.front.biz.service.TsfCouponService;
 import com.style24.front.biz.service.TsfCustomerService;
 import com.style24.front.biz.service.TsfGiftcardService;
+import com.style24.front.biz.service.TsfOrderChangeService;
 import com.style24.front.biz.service.TsfOrderService;
 import com.style24.front.biz.service.TsfPointService;
 import com.style24.front.biz.service.TsfRendererService;
@@ -57,15 +60,24 @@ public class TsfMypageController extends TsfBaseController {
 
 	@Autowired
 	private TsfCustomerService customerService;
-	
+
 	@Autowired
 	private TscCustomerService coreCustomerService;
 
 	@Autowired
 	private TsfOrderService orderService;
-	
+
 	@Autowired
 	private TscOrderService coreOrderService;
+	
+	@Autowired
+	private TsfOrderChangeService orderChangeService;
+
+	@Autowired
+	private TscOrderChangeService coreOrderChangeService;
+
+	@Autowired
+	private TscOrderRefundService coreOrderRefundService;
 
 	@Autowired
 	private TsfReviewService reviewService;
@@ -81,7 +93,7 @@ public class TsfMypageController extends TsfBaseController {
 
 	@Autowired
 	private TsfCouponService couponService;
-	
+
 	@Autowired
 	private TsfRendererService rendererService;
 
@@ -451,15 +463,17 @@ public class TsfMypageController extends TsfBaseController {
 		mav.addObject("customerInfo", customer);
 
 
-		// 주문목록 조회
-		Collection<GagaMap> orderList = orderService.getOrderListForMypage(order);
-
-		if (orderList.size() == 0) {
-			mav.setViewName("redirect:/mypage/order/list/form");
-			return mav;
-		}
-
-		mav.addObject("orderList", orderList);
+		// // 주문목록 조회
+		// Collection<GagaMap> orderList = orderService.getOrderListForMypage(order);
+		//
+		// if (orderList.size() == 0) {
+		// 	mav.setViewName("redirect:/mypage/order/list/form");
+		// 	return mav;
+		// }
+		//
+		// mav.addObject("orderList", orderList);
+		
+		mav.addObject("returnList", orderChangeService.getCancelListForMypage(order));
 
 		// 주문 결제정보 조회
 		mav.addObject("paymentInfo", orderService.getPaymentInfoForMypage(order));
@@ -467,8 +481,8 @@ public class TsfMypageController extends TsfBaseController {
 		// 주문 배송지 정보 조회
 		mav.addObject("deliveryAddrInfo", orderService.getOrderDeliveryAddrInfo(order));
 
-		// 교환 사유 목록 조회
-		mav.addObject("exchangeReason", rendererService.getCommonCodeList("G688", "Y"));
+		// 반품 사유 목록 조회
+		mav.addObject("returnReason", rendererService.getCommonCodeList("G688", "Y"));
 
 		mav.setViewName(super.getDeviceViewName("/mypage/MypageReturnForm"));
 
@@ -546,4 +560,18 @@ public class TsfMypageController extends TsfBaseController {
 		return result;
 	}
 
+	/**
+	 * 마이페이지 반품신청 환불금액 계산
+	 *
+	 * @param Order
+	 * @return GagaMap
+	 * @author card007
+	 * @since 2021. 02. 26
+	 */
+	@PostMapping("/cancel/refund/amt/calculate")
+	@ResponseBody
+	public GagaMap calculateRefundAmt(@RequestBody List<Order> orderList) {
+		return coreOrderRefundService.cnclRtnRefundAmt(orderList);
+	}
+
 }

+ 29 - 5
src/main/java/com/style24/persistence/domain/Cart.java

@@ -1,5 +1,7 @@
 package com.style24.persistence.domain;
 
+import java.util.Collection;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.style24.persistence.TscBaseDomain;
 
@@ -15,7 +17,10 @@ import lombok.Data;
 @Data
 public class Cart extends TscBaseDomain {
 	// 장바구니 정보
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private int[] cartSqArr;		// 장바구니 일련번호 배열 (일시품절제외 조회)
 	private int cartSq;				// 장바구니 번호
+	private int notCartSq;			// 제외 장바구니 번호
 	private int cartDtlSq;			// 장바구니 상세 번호
 	private int custNo;				// 고객번호
 	private int planDtlSq;			// 기획전상세번호
@@ -30,8 +35,17 @@ public class Cart extends TscBaseDomain {
 	private String ithrCd;			// 유입경로(공통코드 G027)
 	private String contentsLoc;		// 컨텐츠위치(공통코드G028)
 	private String dealGoodsCd;		// 딜상품코드
+	private String cartOptCd1;		// 장바구니 컬러 옵션
+	private String cartOptCd;		// 장바구니 옵션
+	private String cartColorNm;		// 장바구니 컬러명
 
 	// 장바구니 상세 정보
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private int[] cartDtlSqArr;		// 장바구니 일련번호 배열 (일시품절제외 조회)
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] optCds;		// 옵션코드
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] itemCds;		// 장바구니 단품코드
 	private String itemCd;			// 단품코드(상품). 일반상품과 딜상품은 상품코드와 동일
 	private String optCd;			// 옵션코드
 	private String optCd1;			// 옵션코드1
@@ -45,14 +59,24 @@ public class Cart extends TscBaseDomain {
 	private String goodsType;		// 상품 타입
 	private String compsGoodsCd;	// 세트 구성상품 코드
 	private String itemCdSql;		// 상품 조회 쿼리문
+	private String selfGoodsYn;		// 자사상품여부
+	private String mainColorCd;		// 상품 메인 컬러
+	private String brandEnm;		// 브랜드 영문명
+	private String brandKnm;		// 브랜드 국문명
+	private String goodsNm;			// 상품명
+	private String sysImgNm;		// 이미지명
+	private String colorNm;			// 컬러명
+	private String imgPath;			// 상품 이미지 경로
+	private String soldoutYn;		// 옵션
+	private String frontGb;			// 접속 디바이스 정보
 
-	// 다다익선 정보
-
-	// 즉시할인쿠폰 정보
+	// 장바구니 상품 정보 리스트
+	Collection<Cart> cartCompsList;		// 장바구니 상품 구성 상품리스트
+	Collection<Cart> cartColorList;		// 장바구니 상품 컬러리스트
+	Collection<Cart> cartSizeList;		// 장바구니 상품 사이즈리스트
+	Collection<GoodsImg> cartImgList;	// 장바구니 상품 이미지 리스트
 
 	// 시리얼쿠폰 정보
-	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
-	private int[] cartSqArr;		// 장바구니 일련번호 배열 (일시품절제외 조회)
 	private String cpnNm;
 	private String rdCpnNm;
 	private String usedDt;

+ 5 - 5
src/main/java/com/style24/persistence/domain/GoodsStock.java

@@ -14,22 +14,22 @@ import lombok.Data;
 @Data
 public class GoodsStock extends TscBaseDomain {
 	// 재고 정보
+	private Integer productNo;		// ProductNo(WMS)
 	private String goodsCd;			// 상품번호
 	private String optCd;			// 옵션코드
 	private String optCd1;			// 옵션코드1(자사 : 컬러, 입점 : 옵션명1)
 	private String optCd2;			// 옵션코드1(자사 : 사이즈, 입점 : 옵션명2)
-	private Integer skuModelNo;		// SKUModelNo(WMS)
-	private Integer productNo;		// ProductNo(WMS)
-	private Integer productCode;	// ProductCode(WMS)
+	private String skuModelNo;		// SKUModelNo(WMS)
+	private String productCode;		// ProductCode(WMS)
+	private String soldoutYn;		// 품절여부
 	private int currStockQty;		// 가용재고
 	private int addPrice;			// 추가금액
-	private String soldoutYn;		// 품절여부
 	private int dispOrd;			// 표시순서
 
 	private String itemCd;			// 구성상품코드
 	private String goodsType;		// 상품구분
+	private String sysImgNm;		// 상품이미지 명
 	private int goodsQty;			// 안전재고
-	private String sysImgNm;		// 상품이미지
 	private int stockQty;			// 상품 재고
 
 }

+ 464 - 269
src/main/java/com/style24/persistence/mybatis/shop/TsfCart.xml

@@ -10,7 +10,7 @@
 
 	<!-- 페이징을 위한 select절 하단 -->
 	<sql id="selectForPagingFooter">
-		       ) ORIGINAL
+			   ) ORIGINAL
 		WHERE  NUMB BETWEEN #{pageable.startRow} AND #{pageable.endRow}
 	</sql>
 	
@@ -31,28 +31,35 @@
 		   AND C.CUST_NO = #{custNo}
 			</otherwise>
 		</choose>
+		<if test="cartSq != null and cartSq != 0">
+			AND C.CART_SQ <![CDATA[ <> ]]> #{cartSq}
+		</if>
 	</select>
 
 	<!-- 장바구니 등록 세트 상품 확인 -->
-	<select id="selectHasSetItemCartList" parameterType="Cart" resultType="int">
+	<select id="selectHasSetItemCartList" parameterType="Cart" resultType="Cart">
 		/* TsfCart.selectHasSetItemCartList : 장바구니 등록 세트 상품 확인 */
 		SELECT CART_SQ
-		  FROM (SELECT COUNT(1) AS CNT
+		FROM   (SELECT COUNT(1) AS CNT
 					 , CART_SQ
 					 , #{goodsCd} AS GOODS_CD
-				  FROM (
-					  ${itemCdSql}
-				       ) A
-				 WHERE 1=1
-				 GROUP BY CART_SQ ) AS A
-		  INNER JOIN (SELECT GC.GOODS_CD
+				FROM   (
+						${itemCdSql}
+					   ) A
+				WHERE  1=1
+				GROUP  BY CART_SQ ) AS A
+		INNER  JOIN ( SELECT GC.GOODS_CD
 						   , COUNT(1) AS CNT
-						FROM TB_GOODS_COMPOSE GC
-					   WHERE GC.GOODS_CD = #{goodsCd}
-						 AND GC.USE_YN = 'Y'
-					   GROUP BY GC.GOODS_CD ) B
-			 ON A.GOODS_CD = B.GOODS_CD
-			AND A.CNT = B.CNT
+					  FROM   TB_GOODS_COMPOSE GC
+					  WHERE  GC.GOODS_CD = #{goodsCd}
+					  AND    GC.USE_YN = 'Y'
+					  GROUP  BY GC.GOODS_CD ) B
+		ON     A.GOODS_CD = B.GOODS_CD
+		AND    A.CNT = B.CNT
+		WHERE  1=1
+		<if test="notCartSq != null and notCartSq > 0">
+		AND    A.CART_SQ <![CDATA[ <> ]]> #{notCartSq}
+		</if>
 	</select>
 
 	<!-- 장바구니 등록 일반 or 딜 상품 확인 -->
@@ -70,24 +77,24 @@
 	<insert id="insertCartInfo" parameterType="Cart" keyProperty="cartSq">
 		/* TsfCart.insertCartInfo : 장바구니 신규 등록 */
 		INSERT INTO TB_CART (
-		          CART_GB
-		        , GOODS_CD
-		        , GOODS_QTY
-		        , DEAL_GOODS_CD
-		        , JSESSION_ID
-		        , CUST_NO
-		        , AF_LINK_CD
-		        , ITHR_CD
-		        , CONTENTS_LOC
-		        , PLAN_DTL_SQ
-		        , REG_NO
-		        , REG_DT
-		        , UPD_NO
-		        , UPD_DT)
+				  CART_GB
+				, GOODS_CD
+				, GOODS_QTY
+				, DEAL_GOODS_CD
+				, JSESSION_ID
+				, CUST_NO
+				, AF_LINK_CD
+				, ITHR_CD
+				, CONTENTS_LOC
+				, PLAN_DTL_SQ
+				, REG_NO
+				, REG_DT
+				, UPD_NO
+				, UPD_DT)
 		SELECT #{cartGb}
 			 , GOODS_CD
-		     , #{goodsQty}
-		     , #{dealGoodsCd}
+			 , #{goodsQty}
+			 , #{dealGoodsCd}
 			 , #{jsessionId}
 			 , #{custNo}
 			 , #{afLinkCd}
@@ -95,7 +102,7 @@
 			 , #{contentsLoc}
 			 , #{planDtlSq}
 			 , #{regNo}
-		     , CURRENT_TIMESTAMP
+			 , CURRENT_TIMESTAMP
 			 , #{updNo}
 			 , CURRENT_TIMESTAMP
 		  FROM TB_GOODS
@@ -106,30 +113,30 @@
 	<insert id="insertCartDetailInfo" parameterType="Cart" keyProperty="cartDtlSq">
 		/* TsfCart.insertCartDetailInfo : 장바구니 상세 신규 등록 */
 		INSERT INTO TB_CART_DETAIL (
-		          CART_SQ
-		        , ITEM_CD
-		        , OPT_CD
-		        , OPT_CD1
-		        , OPT_CD2
-		        , SKU_MODEL_NO
-		        , PRODUCT_NO
-		        , PRODUCT_CODE
-		        , ITEM_QTY
-		        , DISP_ORD
-		        , REG_NO
-		        , REG_DT
-		        , UPD_NO
-		        , UPD_DT
+				  CART_SQ
+				, ITEM_CD
+				, OPT_CD
+				, OPT_CD1
+				, OPT_CD2
+				, SKU_MODEL_NO
+				, PRODUCT_NO
+				, PRODUCT_CODE
+				, ITEM_QTY
+				, DISP_ORD
+				, REG_NO
+				, REG_DT
+				, UPD_NO
+				, UPD_DT
 		)
 		SELECT #{cartSq}
 			 , IFNULL(GC.COMPS_GOODS_CD, G.GOODS_CD)		 <!-- 세트 상품이 아니면 원상품코드 -->
-		     , O.OPT_CD
-		     , O.OPT_CD1
-		     , O.OPT_CD2
-		     , O.SKU_MODEL_NO
-		     , O.PRODUCT_NO
-		     , O.PRODUCT_CODE
-		     , IFNULL(GC.QTY, 1)
+			 , O.OPT_CD
+			 , O.OPT_CD1
+			 , O.OPT_CD2
+			 , O.SKU_MODEL_NO
+			 , O.PRODUCT_NO
+			 , O.PRODUCT_CODE
+			 , IFNULL(GC.QTY, 1)
 			 , IFNULL(GC.DISP_ORD, 1)						<!-- TB_GOODS_COMPOSE DISP_ORD 따라 CART_DETAIL도 동일하게 진행 -->
 			 , #{regNo}
 			 , CURRENT_TIMESTAMP
@@ -137,9 +144,9 @@
 			 , CURRENT_TIMESTAMP
 		  FROM TB_GOODS G
 		 INNER JOIN TB_OPTION O
-		    ON G.GOODS_CD = O.GOODS_CD
+			ON G.GOODS_CD = O.GOODS_CD
 		  LEFT OUTER JOIN TB_GOODS_COMPOSE GC		<!-- 일반 상품 제외 확인 필요하여 join -->
-		    ON GC.COMPS_GOODS_CD = G.GOODS_CD
+			ON GC.COMPS_GOODS_CD = G.GOODS_CD
 		   AND GC.GOODS_CD = #{goodsCd}
 		   AND GC.COMPS_GOODS_CD = #{itemCd}
 		   AND GC.GOODS_TYPE = 'G056_S'				<!-- 세트 상품만 구성 상품 코드로 올림. deal 상품은 원상품코드로 올려야함 -->
@@ -156,21 +163,54 @@
 		 ORDER BY GC.DISP_ORD
 	</insert>
 
-	<!-- 장바구니 상세 UPDATE -->
+	<!-- 장바구니 UPDATE -->
 	<update id="updateCartInfo" parameterType="Cart">
-		/* TsfCart.updateCartInfo : 장바구니 상세 UPDATE */
+		/* TsfCart.updateCartInfo : 장바구니 UPDATE */
 		UPDATE TB_CART SET
 			  GOODS_QTY = GOODS_QTY + #{goodsQty}
-		    , DEAL_GOODS_CD = #{dealGoodsCd}
-		    , AF_LINK_CD = #{afLinkCd}
-		    , ITHR_CD = #{ithrCd}
-		    , CONTENTS_LOC = #{contentsLoc}
-		    , PLAN_DTL_SQ = #{planDtlSq}
+			, DEAL_GOODS_CD = #{dealGoodsCd}
+			, AF_LINK_CD = #{afLinkCd}
+			, ITHR_CD = #{ithrCd}
+			, CONTENTS_LOC = #{contentsLoc}
+			, PLAN_DTL_SQ = #{planDtlSq}
 			, UPD_NO = #{updNo}
 			, UPD_DT = CURRENT_TIMESTAMP
 		WHERE CART_SQ = #{cartSq}
-		  AND GOODS_CD = #{goodsCd}
-		  AND CUST_NO = #{custNo}
+		AND   GOODS_CD = #{goodsCd}
+		AND   CUST_NO = #{custNo}
+	</update>
+
+	<!-- 장바구니 UPDATE -->
+	<update id="updateCart" parameterType="Cart">
+		/* TsfCart.updateCart : 장바구니 UPDATE */
+		UPDATE TB_CART SET
+			  GOODS_QTY = #{goodsQty}
+			, DEAL_GOODS_CD = #{dealGoodsCd}
+			, AF_LINK_CD = #{afLinkCd}
+			, ITHR_CD = #{ithrCd}
+			, CONTENTS_LOC = #{contentsLoc}
+			, PLAN_DTL_SQ = #{planDtlSq}
+			, UPD_NO = #{updNo}
+			, UPD_DT = CURRENT_TIMESTAMP
+		WHERE CART_SQ = #{cartSq}
+		AND   GOODS_CD = #{goodsCd}
+		AND   CUST_NO = #{custNo}
+	</update>
+
+	<!-- 장바구니 상세 UPDATE -->
+	<update id="updateCartDetail" parameterType="Cart">
+		/* TsfCart.updateCartDetail : 장바구니 상세 UPDATE */
+		UPDATE TB_CART_DETAIL A, (SELECT GOODS_CD, OPT_CD1, OPT_CD2, SKU_MODEL_NO, PRODUCT_NO, PRODUCT_CODE FROM TB_OPTION WHERE GOODS_CD = #{itemCd} AND OPT_CD = #{optCd}) B SET
+			  A.OPT_CD = #{optCd}
+			, A.OPT_CD1 = B.OPT_CD1
+			, A.OPT_CD2 = B.OPT_CD2
+			, A.SKU_MODEL_NO = B.SKU_MODEL_NO
+			, A.PRODUCT_NO = B.PRODUCT_NO
+			, A.PRODUCT_CODE = B.PRODUCT_CODE
+			, A.UPD_NO = #{updNo}
+			, A.UPD_DT = CURRENT_TIMESTAMP
+		WHERE A.CART_DTL_SQ = #{cartDtlSq}
+		  AND A.ITEM_CD = B.GOODS_CD
 	</update>
 
 	<!-- 장바구니 이력 정보 저장 -->
@@ -193,7 +233,7 @@
 		SELECT C.CART_SQ
 			 , C.CART_GB
 			 , C.GOODS_CD
-		     , C.GOODS_QTY
+			 , C.GOODS_QTY
 			 , C.DEAL_GOODS_CD
 			 , IFNULL(#{ordNo}, 0) AS ORD_NO
 			 , C.CUST_NO
@@ -283,82 +323,82 @@
 								  , COUNT(1) AS TMTB_CNT
 							 FROM   TB_TMTB_APPLY_GOODS TAG
 							 INNER  JOIN TB_CART C
-							 ON     TAG.GOODS_CD = C.GOODS_CD
+							 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
+							 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
+				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
+				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
+							 ON	 TAG.GOODS_CD = C.GOODS_CD
 							 INNER  JOIN TB_GOODS G
-							 ON     C.GOODS_CD = G.GOODS_CD
+							 ON	 C.GOODS_CD = G.GOODS_CD
 							 INNER  JOIN TB_TMTB T
-							 ON     TAG.TMTB_SQ = T.TMTB_SQ
+							 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'   /* 제외상품 */
+							 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
+							 					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
+												 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
+							 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'
+							 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
+							 	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
+				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
+				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'
+				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'
+				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
+				AND	C.CART_SQ IN
 					<foreach collection="cartSqArr" item="item" index="index"  open="(" close=")" separator=",">
 						#{item}
 					</foreach>
@@ -381,41 +421,41 @@
 			 , 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
+		ON	 TAG.GOODS_CD = C.GOODS_CD
 		INNER  JOIN TB_GOODS G
-		ON     C.GOODS_CD = G.GOODS_CD
+		ON	 C.GOODS_CD = G.GOODS_CD
 		INNER  JOIN TB_TMTB T
-		ON     TAG.TMTB_SQ = T.TMTB_SQ
+		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'   /* 제외상품 */
+		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
+						   FROM   TB_CART C
 						   INNER  JOIN TB_CART_DETAIL CD
-		                   ON     C.CART_SQ = CD.CART_SQ
+						   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
+						   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'
+		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="tmtbSqs != null and tmtbSqs.length > 0">
-		AND    TAG.TMTB_SQ IN
+		AND	TAG.TMTB_SQ IN
 			<foreach collection="tmtbSqs" item="item" index="index"  open="(" close=")" separator=",">
 				#{item}
 			</foreach>
 		</if>
 		<if test="cartSqArr != null and cartSqArr.length > 0">
-		AND    C.CART_SQ IN
+		AND	C.CART_SQ IN
 			<foreach collection="cartSqArr" item="item" index="index"  open="(" close=")" separator=",">
 				#{item}
 			</foreach>
@@ -433,12 +473,12 @@
 			 , TV.DC_VAL
 		FROM   TB_TMTB_SECTION TC
 		INNER  JOIN TB_TMTB_VAL TV
-		ON     TC.TMTB_SECTION_SQ = TV.TMTB_SECTION_SQ
+		ON	 TC.TMTB_SECTION_SQ = TV.TMTB_SECTION_SQ
 		WHERE  1=1
-		AND    TC.DEL_YN = 'N'
-		AND    TV.DEL_YN = 'N'
+		AND	TC.DEL_YN = 'N'
+		AND	TV.DEL_YN = 'N'
 		<if test="list != null and list.size() > 0">
-		AND    TC.TMTB_SQ IN
+		AND	TC.TMTB_SQ IN
 			<foreach collection="list" item="item" index="index"  open="(" close=")" separator=",">
 				#{item}
 			</foreach>
@@ -459,140 +499,143 @@
 			 , Z.CART_SQ
 			 , Z.GOODS_CD
 			 , Z.GOODS_NM
-		     , Z.BRAND_NM
-		     , Z.SUPPLY_COMP_NM
+			 , Z.BRAND_ENM
+		     , Z.BRAND_KNM
+			 , Z.SUPPLY_COMP_NM
 			 , Z.GOODS_QTY
 			 , Z.GOODS_TYPE
 			 , Z.SUPPLY_COMP_CD
 			 , Z.DELV_FEE_CD
-		     , (Z.CURR_PRICE + Z.OPT_ADD_PRICE) * Z.GOODS_QTY AS CURR_PRICE
-		     , Z.SOLDOUT_YN
+			 , (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
+			 , SYS_IMG_NM
 		FROM   (SELECT C.CART_SQ
 					 , C.GOODS_CD
 					 , C.GOODS_QTY
 					 , CD.ITEM_CD
 					 , CD.OPT_CD
-		             , CD.ITEM_QTY
-		             , CD.CART_DTL_SQ
-		             , O.OPT_CD1
-		             , O.OPT_CD2
+					 , CD.ITEM_QTY
+					 , CD.CART_DTL_SQ
+					 , O.OPT_CD1
+					 , O.OPT_CD2
 					 , G.GOODS_TYPE
 					 , G.SUPPLY_COMP_CD
-		             , G.GOODS_NM
-		             , G.BRAND_CD
-		             , G.PNT_PRATE
+					 , G.GOODS_NM
+					 , 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
+					 , STOCK.SOLDOUT_YN
+					 , FN_GET_APPLY_CPN1_PRICE(C.GOODS_CD, #{frontGb}) AS CURR_PRICE
+					 , IFNULL(O.ADD_PRICE, 0) AS OPT_ADD_PRICE
+					 , BR.BRAND_ENM
+		             , BR.BRAND_KNM
+					 , (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
 					 , CASE WHEN G.SELF_GOODS_YN = 'Y' THEN 'WMS'
 							ELSE DFP.DELV_FEE_CD END AS DELV_FEE_CD
+					 , CASE WHEN G.GOODS_TYPE != 'G056_S' AND G.SELF_GOODS_YN = 'Y' THEN (SELECT SYS_IMG_NM FROM TB_GOODS_IMG WHERE GOODS_CD = G.GOODS_CD AND COLOR_CD = CD.OPT_CD1 AND DEFAULT_IMG_YN = 'Y' LIMIT 1)
+							ELSE (SELECT SYS_IMG_NM FROM TB_GOODS_IMG WHERE GOODS_CD = G.GOODS_CD AND COLOR_CD = G.MAIN_COLOR_CD AND DEFAULT_IMG_YN = 'Y' LIMIT 1) END AS SYS_IMG_NM
 				FROM   TB_CART C
 				INNER  JOIN TB_CART_DETAIL CD
-				ON     C.CART_SQ = CD.CART_SQ
+				ON	 C.CART_SQ = CD.CART_SQ
 				INNER  JOIN TB_GOODS G
-				ON     C.GOODS_CD = G.GOODS_CD
+				ON	 C.GOODS_CD = G.GOODS_CD
+				INNER  JOIN TB_BRAND BR 
+				ON	 G.BRAND_CD = BR.BRAND_CD
 				INNER  JOIN TB_DELV_FEE_POLICY DFP
-				ON     G.DELV_FEE_CD = DFP.DELV_FEE_CD
+				ON	 G.DELV_FEE_CD = DFP.DELV_FEE_CD
 				INNER  JOIN TB_OPTION O
-				ON     CD.ITEM_CD = O.GOODS_CD
-				AND    CD.OPT_CD = O.OPT_CD
+				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'
+											 , 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
+										ON	 C.CART_SQ = CD.CART_SQ
 										INNER  JOIN TB_GOODS G
-										ON     C.GOODS_CD = G.GOODS_CD
+										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
+										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
+										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'
+										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}
+											AND	C.CUST_NO = 0
+											AND	C.JSESSION_ID = #{jsessionId}
 										</if>
 										<if test="custNo != 0">
-											AND    C.CUST_NO = #{custNo}
+											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'
+											 , 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
+										ON	 C.CART_SQ = CD.CART_SQ
 										INNER  JOIN TB_GOODS G
-										ON     C.GOODS_CD = G.GOODS_CD
+										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
+										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'
+										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}
+											AND	C.CUST_NO = 0
+											AND	C.JSESSION_ID = #{jsessionId}
 										</if>
 										<if test="custNo != 0">
-											AND    C.CUST_NO = #{custNo}
+											AND	C.CUST_NO = #{custNo}
 										</if>
-								       ) A
+									   ) A
 								GROUP  BY  A.CART_SQ
 					   ) STOCK
-				ON     C.CART_SQ = STOCK.CART_SQ
+				ON	 C.CART_SQ = STOCK.CART_SQ
 				WHERE  G.SELF_MALL_YN = 'Y'
-				AND    G.GOODS_STAT = 'G008_90'
+				AND	G.GOODS_STAT = 'G008_90'
 				<if test="custNo == 0">
-				AND    C.CUST_NO = 0
-				AND    C.JSESSION_ID = #{jsessionId}
+				AND	C.CUST_NO = 0
+				AND	C.JSESSION_ID = #{jsessionId}
 				</if>
 				<if test="custNo != 0">
-				AND    C.CUST_NO = #{custNo}
+				AND	C.CUST_NO = #{custNo}
 				</if>
 				<if test="cartSqArr != null and cartSqArr.length > 0">
-				AND    C.CART_SQ IN
+				AND	C.CART_SQ IN
 					<foreach collection="cartSqArr" item="item" index="index"  open="(" close=")" separator=",">
 						#{item}
 					</foreach>
 				</if>
 				ORDER BY G.SUPPLY_COMP_CD ) Z
-		LEFT   OUTER JOIN TB_GOODS_IMG GI
-		ON	   Z.GOODS_CD = GI.GOODS_CD
-		AND	   Z.OPT_CD1 = GI.COLOR_CD
-		AND    GI.DEFAULT_IMG_YN = 'Y'
 		GROUP  BY Z.CART_SQ
 			 , Z.GOODS_CD
 			 , Z.GOODS_QTY
 			 , Z.GOODS_TYPE
 			 , Z.SUPPLY_COMP_CD
 			 , Z.GOODS_NM
-		     , Z.BRAND_NM
+			 , Z.BRAND_ENM
+			 , Z.BRAND_KNM
 			 , Z.SUPPLY_COMP_NM
 			 , Z.DELV_FEE_CD
-		     , Z.CURR_PRICE
-		     , Z.PNT_PRATE
+			 , Z.CURR_PRICE
+			 , Z.PNT_PRATE
 			 , Z.PNT_MRATE
-		     , Z.OPT_ADD_PRICE
-			 , GI.SYS_IMG_NM
+			 , Z.OPT_ADD_PRICE
+			 , SYS_IMG_NM
 		ORDER  BY Z.DELV_FEE_CD
-			 , Z.CART_SQ
+			 , Z.CART_SQ DESC
 	</select>
 
 	<!-- 장바구니 업체별 배송비 -->
@@ -601,17 +644,17 @@
 		SELECT DFP.MIN_ORD_AMT
 			 , DFP.DELV_FEE
 			 , DFP.DELV_FEE_CRITE
-		     , DFP.DELV_FEE_CD
+			 , DFP.DELV_FEE_CD
 			 , COUNT(G.SUPPLY_COMP_CD) AS COMP_CNT
 		FROM   TB_CART C
 		INNER  JOIN TB_GOODS G
-		ON     C.GOODS_CD = G.GOODS_CD
+		ON	 C.GOODS_CD = G.GOODS_CD
 		INNER  JOIN TB_DELV_FEE_POLICY DFP
-		ON     G.DELV_FEE_CD = DFP.DELV_FEE_CD
-		AND    DFP.USE_YN = 'Y'
+		ON	 G.DELV_FEE_CD = DFP.DELV_FEE_CD
+		AND	DFP.USE_YN = 'Y'
 		WHERE  1=1
-		AND    G.SELF_MALL_YN = 'Y'
-		AND    C.CART_SQ IN
+		AND	G.SELF_MALL_YN = 'Y'
+		AND	C.CART_SQ IN
 		<foreach collection="cartSqArr" item="item" index="index"  open="(" close=")" separator=",">
 			#{item}
 		</foreach>
@@ -630,14 +673,24 @@
 			#{item}
 		</foreach>
 	</delete>
+
+	<!-- 장바구니 삭제 -->
+	<delete id="deleteCartDetail" parameterType="Cart">
+		<!-- TsfCart.deleteCartDetail : 장바구니 삭제 -->
+		DELETE FROM TB_CART_DETAIL
+		WHERE  CART_SQ IN
+		<foreach collection="cartSqArr" item="item" index="index"  open="(" close=")" separator=",">
+			#{item}
+		</foreach>
+	</delete>
 	
 	<!-- 장바구니담긴상품 고객번호 Update -->
 	<update id="updateCartOfCustNo" parameterType="Cart">
 		/* TsfCart.updateCartOfCustNo */
 		UPDATE TB_CART
-		SET    CUST_NO = #{custNo}
-		     , UPD_NO = #{updNo}
-		     , UPD_DT = NOW()
+		SET	CUST_NO = #{custNo}
+			 , UPD_NO = #{updNo}
+			 , UPD_DT = NOW()
 		WHERE  JSESSION_ID = #{jsessionId}
 	</update>
 	
@@ -645,57 +698,57 @@
 	<select id="getCartListAfterLogin" parameterType="Cart" resultType="Cart">
 		/* TsfCart.getCartListAfterLogin */
 		SELECT A.CART_GB
-		     , A.GOODS_CD
-		     , A.ITEM_OPTS
-		     , IFNULL(B.CART_SQ,A.CART_SQ) AS UPD_CART_SQ /*업데이트할 장바구니번호*/
-		     , CASE WHEN B.CART_SQ IS NOT NULL THEN
-		                A.CART_SQ
-		            ELSE
-		                0
-		       END                         AS DEL_CART_SQ /*삭제할 장바구니번호(0이면 삭제할 장바구니번호 없음)*/
+			 , A.GOODS_CD
+			 , A.ITEM_OPTS
+			 , IFNULL(B.CART_SQ,A.CART_SQ) AS UPD_CART_SQ /*업데이트할 장바구니번호*/
+			 , CASE WHEN B.CART_SQ IS NOT NULL THEN
+						A.CART_SQ
+					ELSE
+						0
+			   END						 AS DEL_CART_SQ /*삭제할 장바구니번호(0이면 삭제할 장바구니번호 없음)*/
 		FROM   (
-		        /*장바구니에 담을 상품 목록*/
-		        SELECT C.CART_SQ
-		             , C.CART_GB
-		             , C.GOODS_CD
-		             , GROUP_CONCAT(CONCAT(CD.ITEM_CD,':',CD.OPT_CD1,':',CD.OPT_CD2) ORDER BY CD.ITEM_CD, CD.OPT_CD1, CD.OPT_CD2 SEPARATOR ';') AS ITEM_OPTS
-		        FROM   TB_CART C
-		             , TB_CART_DETAIL CD
-		        WHERE  C.CART_SQ = CD.CART_SQ
-		        AND    C.CUST_NO = #{custNo}
-		        AND    C.JSESSION_ID = #{jsessionId}
-		        GROUP  BY C.CART_SQ, C.CART_GB, C.GOODS_CD
-		       ) A
+				/*장바구니에 담을 상품 목록*/
+				SELECT C.CART_SQ
+					 , C.CART_GB
+					 , C.GOODS_CD
+					 , GROUP_CONCAT(CONCAT(CD.ITEM_CD,':',CD.OPT_CD1,':',CD.OPT_CD2) ORDER BY CD.ITEM_CD, CD.OPT_CD1, CD.OPT_CD2 SEPARATOR ';') AS ITEM_OPTS
+				FROM   TB_CART C
+					 , TB_CART_DETAIL CD
+				WHERE  C.CART_SQ = CD.CART_SQ
+				AND	C.CUST_NO = #{custNo}
+				AND	C.JSESSION_ID = #{jsessionId}
+				GROUP  BY C.CART_SQ, C.CART_GB, C.GOODS_CD
+			   ) A
 		LEFT OUTER JOIN (
-		        /*장바구니에 담긴 기존 상품 목록*/
-		        SELECT C.CART_SQ
-		             , C.CART_GB
-		             , C.GOODS_CD
-		             , GROUP_CONCAT(CONCAT(CD.ITEM_CD,':',CD.OPT_CD1,':',CD.OPT_CD2) ORDER BY CD.ITEM_CD, CD.OPT_CD1, CD.OPT_CD2 SEPARATOR ';') AS ITEM_OPTS
-		        FROM   TB_CART C
-		             , TB_CART_DETAIL CD
-		        WHERE  C.CART_SQ = CD.CART_SQ
-		        AND    C.CUST_NO = #{custNo}
-		        AND    C.JSESSION_ID <![CDATA[<>]]> #{jsessionId}
-		        GROUP  BY C.CART_SQ, C.CART_GB, C.GOODS_CD
-		       ) B
-		ON     A.CART_GB = B.CART_GB
-		AND    A.GOODS_CD = B.GOODS_CD
-		AND    A.ITEM_OPTS = B.ITEM_OPTS
+				/*장바구니에 담긴 기존 상품 목록*/
+				SELECT C.CART_SQ
+					 , C.CART_GB
+					 , C.GOODS_CD
+					 , GROUP_CONCAT(CONCAT(CD.ITEM_CD,':',CD.OPT_CD1,':',CD.OPT_CD2) ORDER BY CD.ITEM_CD, CD.OPT_CD1, CD.OPT_CD2 SEPARATOR ';') AS ITEM_OPTS
+				FROM   TB_CART C
+					 , TB_CART_DETAIL CD
+				WHERE  C.CART_SQ = CD.CART_SQ
+				AND	C.CUST_NO = #{custNo}
+				AND	C.JSESSION_ID <![CDATA[<>]]> #{jsessionId}
+				GROUP  BY C.CART_SQ, C.CART_GB, C.GOODS_CD
+			   ) B
+		ON	 A.CART_GB = B.CART_GB
+		AND	A.GOODS_CD = B.GOODS_CD
+		AND	A.ITEM_OPTS = B.ITEM_OPTS
 	</select>
 
 	<!-- 로그인 후 장바구니 수정 -->
 	<update id="updateCartAfterLogin" parameterType="Cart">
 		/* TsfCart.updateCartAfterLogin */
 		UPDATE TB_CART
-		SET    GOODS_QTY = GOODS_QTY + IFNULL((SELECT A.GOODS_QTY
-		    									 FROM ( SELECT GOODS_QTY
+		SET	GOODS_QTY = GOODS_QTY + IFNULL((SELECT A.GOODS_QTY
+												 FROM ( SELECT GOODS_QTY
 														  FROM TB_CART
 														 WHERE CART_SQ = #{delCartSq}
 														   AND CUST_NO = #{custNo} ) A
-		                                        ),0)
+												),0)
 		WHERE  CART_SQ = #{updCartSq}
-		AND    CUST_NO = #{custNo}
+		AND	CUST_NO = #{custNo}
 	</update>
 
 	<!-- 로그인 후 장바구니단품 삭제 -->
@@ -703,10 +756,10 @@
 		/* TsfCart.deleteCartItemAfterLogin */
 		DELETE FROM TB_CART_DETAIL
 		WHERE  CART_SQ IN (SELECT CART_SQ
-		                   FROM   TB_CART
-		                   WHERE  CART_SQ = #{delCartSq}
-		                   AND    CUST_NO = #{custNo}
-		                  )
+						   FROM   TB_CART
+						   WHERE  CART_SQ = #{delCartSq}
+						   AND	CUST_NO = #{custNo}
+						  )
 	</delete>
 
 	<!-- 로그인 후 장바구니 삭제 -->
@@ -714,42 +767,184 @@
 		/* TsfCart.deleteCartAfterLogin */
 		DELETE FROM TB_CART
 		WHERE  CART_SQ = #{delCartSq}
-		AND    CUST_NO = #{custNo}
+		AND	CUST_NO = #{custNo}
 	</delete>
 	
 	<!-- 로그인 후 장바구니이력 생성 -->
 	<update id="createCartHistoryAfterLogin" parameterType="Cart">
 		/* TsfCart.createCartHistoryAfterLogin */
 		INSERT INTO TB_CART_HST (
-		       CART_SQ
-		     , CART_GB
-		     , GOODS_CD
-		     , GOODS_QTY
-		     , DEAL_GOODS_CD
-		     , ORD_NO
-		     , CUST_NO
-		     , AF_LINK_CD
-		     , ITHR_CD
-		     , CONTENTS_LOC
-		     , PLAN_DTL_SQ
-		     , REG_NO
-		     , REG_DT
+			   CART_SQ
+			 , CART_GB
+			 , GOODS_CD
+			 , GOODS_QTY
+			 , DEAL_GOODS_CD
+			 , ORD_NO
+			 , CUST_NO
+			 , AF_LINK_CD
+			 , ITHR_CD
+			 , CONTENTS_LOC
+			 , PLAN_DTL_SQ
+			 , REG_NO
+			 , REG_DT
 		)
 		SELECT CART_SQ
-		     , CART_GB
-		     , GOODS_CD
-		     , GOODS_QTY
-		     , DEAL_GOODS_CD
-		     , 0
-		     , CUST_NO
-		     , AF_LINK_CD
-		     , ITHR_CD
-		     , CONTENTS_LOC
-		     , PLAN_DTL_SQ
-		     , #{regNo}
-		     , NOW()
+			 , CART_GB
+			 , GOODS_CD
+			 , GOODS_QTY
+			 , DEAL_GOODS_CD
+			 , 0
+			 , CUST_NO
+			 , AF_LINK_CD
+			 , ITHR_CD
+			 , CONTENTS_LOC
+			 , PLAN_DTL_SQ
+			 , #{regNo}
+			 , NOW()
 		FROM   TB_CART C
 		WHERE  CART_SQ = #{updCartSq}
 	</update>
-	
+
+	<!-- 장바구니 상품 정보 조회 -->
+	<select id="selectCartGoodsInfo" parameterType="Cart" resultType="Cart">
+		/* TsfCart.selectCartGoodsInfo : 장바구니 상품 마스터 정보 조회 */
+		SELECT G.GOODS_CD
+			 , G.GOODS_TYPE
+		     , G.GOODS_NM
+			 , BR.BRAND_ENM
+			 , BR.BRAND_KNM
+			 , CA.CART_SQ
+			 , CA.GOODS_QTY
+			 , G.SELF_GOODS_YN
+		FROM   TB_CART CA
+		INNER  JOIN TB_GOODS G
+		ON     CA.GOODS_CD = G.GOODS_CD
+		INNER  JOIN TB_BRAND BR
+		ON     G.BRAND_CD = BR.BRAND_CD
+		WHERE  CA.CART_SQ = #{cartSq}
+		AND    G.SELF_MALL_YN = 'Y'
+		AND    G.GOODS_STAT = 'G008_90'
+	</select>
+
+	<!-- 장바구니 세트 구성 상품 정보 조회 -->
+	<select id="selectCartSetGoodsInfo" parameterType="Cart" resultType="Cart">
+		/* TsfCart.selectCartSetGoodsInfo : 장바구니 세트 구성 상품 정보 조회 */
+		SELECT GC.COMPS_GOODS_CD AS GOODS_CD
+			 , GC.DISP_ORD
+			 , GC.QTY
+			 , CD.CART_DTL_SQ
+			 , CD.ITEM_CD
+			 , CD.OPT_CD
+			 , CD.OPT_CD1
+			 , CD.OPT_CD2
+			 , G.SELF_GOODS_YN
+			 , G.GOODS_NM
+		FROM   TB_CART CA
+		INNER  JOIN TB_CART_DETAIL CD
+		ON     CA.CART_SQ = CD.CART_SQ
+		INNER  JOIN TB_GOODS_COMPOSE GC
+		ON     CA.GOODS_CD = GC.GOODS_CD
+		AND    CD.ITEM_CD = GC.COMPS_GOODS_CD
+		INNER  JOIN TB_GOODS G
+		ON     GC.COMPS_GOODS_CD = G.GOODS_CD
+		WHERE  1=1
+		AND    G.SELF_MALL_YN = 'Y'
+		AND    G.GOODS_STAT = 'G008_90'
+		AND    GC.USE_YN = 'Y'
+		AND    GC.GOODS_CD = #{goodsCd}
+		AND    CA.CART_SQ = #{cartSq}
+		ORDER  BY CA.GOODS_CD, GC.COMPS_GOODS_CD, GC.DISP_ORD
+	</select>
+
+	<!-- 장바구니 상품 컬러 정보 조회 -->
+	<select id="selectCartGoodsColorList" parameterType="Cart" resultType="Cart">
+		/* TsfCart.selectCartGoodsColorList : 장바구니 상품 컬러 정보 조회 */
+		SELECT ST.GOODS_CD
+			 , CASE WHEN SELF_GOODS_YN = 'Y' THEN (SELECT COLOR_KNM FROM TB_COLOR WHERE COLOR_CD = ST.OPT_CD1)
+					ELSE ST.OPT_CD1 END AS COLOR_NM
+			 , CASE WHEN SELF_GOODS_YN = 'Y' AND GOODS_TYPE != 'G056_S' THEN (SELECT SYS_IMG_NM FROM TB_GOODS_IMG WHERE GOODS_CD = ST.GOODS_CD AND COLOR_CD = ST.OPT_CD1 AND DEFAULT_IMG_YN = 'Y' LIMIT 1)
+					ELSE (SELECT SYS_IMG_NM FROM TB_GOODS_IMG WHERE GOODS_CD = G.GOODS_CD AND COLOR_CD = G.MAIN_COLOR_CD AND DEFAULT_IMG_YN = 'Y' LIMIT 1) END AS SYS_IMG_NM
+			 , ST.OPT_CD1
+			 , G.MAIN_COLOR_CD
+			 , MAX(CD.CART_DTL_SQ) AS CART_DTL_SQ
+			 , MAX(ST.DISP_ORD) AS DISP_ORD
+			 , MAX(CD.OPT_CD1) AS CART_OPT_CD1
+			 , IFNULL(MAX( CASE WHEN SELF_GOODS_YN = 'Y' THEN (SELECT COLOR_KNM FROM TB_COLOR WHERE COLOR_CD = CD.OPT_CD1)
+								ELSE CD.OPT_CD1 END), MAX(CD.OPT_CD1)) AS CART_COLOR_NM
+		FROM   TB_GOODS G
+		INNER  JOIN VW_STOCK ST
+		ON     G.GOODS_CD = ST.GOODS_CD
+		LEFT   OUTER JOIN TB_CART_DETAIL CD
+		ON     G.GOODS_CD = CD.ITEM_CD
+		AND    ST.OPT_CD = CD.OPT_CD
+		AND    CD.CART_SQ = #{cartSq}
+		WHERE  ST.DISP_YN = 'Y'
+		AND    G.SELF_MALL_YN = 'Y'
+		AND    G.GOODS_STAT = 'G008_90'
+		AND    G.GOODS_CD = #{goodsCd}
+		GROUP  BY ST.GOODS_CD
+			 , ST.OPT_CD1
+			 , G.MAIN_COLOR_CD
+		ORDER  BY DISP_ORD
+	</select>
+
+	<!-- 장바구니 상품 사이즈 정보 조회 -->
+	<select id="selectCartGoodsSizeList" parameterType="Cart" resultType="Cart">
+		/* TsfCart.selectCartGoodsSizeList : 장바구니 상품 사이즈 정보 조회 */
+		SELECT ST.GOODS_CD
+			 , ST.OPT_CD
+		     , ST.OPT_CD1
+			 , ST.OPT_CD2
+			 , ST.CURR_STOCK_QTY
+			 , ST.SOLDOUT_YN
+			 , CD.OPT_CD AS CART_OPT_CD
+		FROM   TB_GOODS G
+		INNER  JOIN VW_STOCK ST
+		ON     G.GOODS_CD = ST.GOODS_CD
+		LEFT   OUTER JOIN TB_CART_DETAIL CD
+		ON     G.GOODS_CD = CD.ITEM_CD
+		AND    ST.OPT_CD = CD.OPT_CD
+		AND    CD.CART_SQ = #{cartSq}
+		WHERE  1=1
+		AND    G.GOODS_CD = #{goodsCd}
+		<if test="optCd1 != null and optCd1 != ''">
+		AND    ST.OPT_CD1 = #{optCd1}
+		</if>
+		AND    ST.DISP_YN = 'Y'
+		AND    G.SELF_MALL_YN = 'Y'
+		AND    G.GOODS_STAT = 'G008_90'
+		ORDER  BY ST.DISP_ORD
+	</select>
+
+	<!-- 장바구니 자사 일반 및 딜 상품 이미지 리스트 조회 -->
+	<select id="selectCartSelfGoodsOptionImgList" parameterType="Cart" resultType="GoodsImg">
+		/* TsfCart.selectCartSelfGoodsOptionImgList : 장바구니 자사 상품 이미지 리스트 조회 */
+		SELECT GI.GOODS_CD
+			 , GI.COLOR_CD
+			 , GI.SYS_IMG_NM
+		FROM   TB_GOODS G
+		INNER  JOIN TB_GOODS_IMG GI
+		ON     G.GOODS_CD = GI.GOODS_CD
+		WHERE  G.SELF_MALL_YN = 'Y'
+		AND    G.GOODS_STAT = 'G008_90'
+		AND    GI.GOODS_CD = #{goodsCd}
+		AND    GI.COLOR_CD = #{optCd1}
+		ORDER  BY GI.DISP_ORD
+	</select>
+
+	<!-- 장바구니 세트 & 입점업체 상품 이미지 리스트 조회 -->
+	<select id="selectCartDelvGoodsOptionImgList" parameterType="Cart" resultType="GoodsImg">
+		/* TsfCart.selectCartDelvGoodsOptionImgList : 장바구니 입점업체 상품 이미지 리스트 조회 */
+		SELECT GI.GOODS_CD
+			 , GI.COLOR_CD
+			 , GI.SYS_IMG_NM
+		FROM   TB_GOODS G
+		INNER  JOIN TB_GOODS_IMG GI
+		ON     G.GOODS_CD = GI.GOODS_CD
+		AND    G.MAIN_COLOR_CD = GI.COLOR_CD
+		WHERE  G.SELF_MALL_YN = 'Y'
+		AND    G.GOODS_STAT = 'G008_90'
+		AND    GI.GOODS_CD = #{goodsCd}
+		ORDER  BY GI.DISP_ORD
+	</select>
 </mapper>

+ 170 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsfOrderChange.xml

@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.style24.front.biz.dao.TsfOrderChangeDao">
+
+	<!-- 페이징을 위한 select절 상단 -->
+	<sql id="selectForPagingHeader">
+		SELECT *
+		FROM   (
+	</sql>
+
+	<!-- 페이징을 위한 select절 하단 -->
+	<sql id="selectForPagingFooter">
+		       ) ORIGINAL
+		WHERE  NUMB BETWEEN #{pageable.startRow} AND #{pageable.endRow}
+	</sql>
+	<!--// Paging -->
+
+	<!-- 마이페이지 취소/반품 목록 조회 -->
+	<select id="getCancelListForMypage" parameterType="Order" resultType="Order">
+		/* TscOrder.getCancelListForMypage */
+		SELECT O.ORD_NO
+		     , DATE_FORMAT(O.ORD_DT, '%Y.%m.%d')				AS ORD_DT
+		     , OD.ORD_DTL_NO
+		     , OD.ORD_DTL_STAT
+		     , FN_GET_CODE_NM('G013', OD.ORD_DTL_STAT)			AS ORD_DTL_STAT_NM
+		     , OD.ORD_EXCH_GB
+		     , CASE WHEN OD.ORD_DTL_STAT IN ('G013_20', 'G013_30', 'G013_40') THEN 'Y'
+					ELSE 'N'
+				END												AS ALL_CAN_YN
+		     , OD.GOODS_CD
+		     , G1.GOODS_NM
+		     , G1.GOODS_TYPE
+		     , FN_GET_CODE_NM('G056', G1.GOODS_TYPE)			AS GOODS_TYPE_NM
+		     , G2.GOODS_CD										AS ITEM_CD
+		     , G2.GOODS_NM										AS ITEM_NM
+		     , ODI.ORD_DTL_ITEM_SQ
+		     , ODI.OPT_CD
+		     , ODI.OPT_CD1
+		     , ODI.OPT_CD2
+		     , ODI.ITEM_QTY
+		     , ODI.ITEM_PRICE
+		     , ODI.OPT_ADD_PRICE
+		     , ODI.ORD_AMT
+		     , ODI.CNCL_RTN_AMT
+		     , ODI.CPN1_DC_AMT
+		     , ODI.TMTB1_DC_AMT
+		     , ODI.TMTB2_DC_AMT
+		     , ODI.GOODS_CPN_DC_AMT
+		     , ODI.CART_CPN_DC_AMT
+		     , ODI.PNT_DC_AMT
+		     , ODI.PRE_PNT_DC_AMT
+		     , ODI.GFCD_USE_AMT
+		     , ODI.REAL_ORD_AMT
+		     , GI.SYS_IMG_NM
+		     , OD.ORD_QTY
+		     , OD.CNCL_RTN_QTY
+		     , CASE WHEN OCD.ORD_REQ_CHG_QTY IS NULL THEN 0
+					ELSE OCD.ORD_REQ_CHG_QTY * ODI.ITEM_QTY
+				END												AS ORD_REQ_CHG_QTY
+		     , OD.SAVE_PNT_AMT
+		     , OD.SHIP_COMP_CD
+		     , OD.GIFT_PACK_YN
+		     , FN_GET_SUPPLY_COMP_NM(OD.SUPPLY_COMP_CD)			AS SUPPLY_COMP_NM
+		     , OD.INVOICE_NO
+		     , OD.SUPPLY_COMP_CD
+		     , OD.DELV_FEE_CD
+		     , OD.SHOT_DELV_YN
+		     , G1.SELF_GOODS_YN
+		     , CONCAT(B.BRAND_ENM, ' ', B.BRAND_KNM)			AS BRAND_NM
+		     , DF.DELV_FEE
+		     , DF.DELV_FEE_CD
+		     , DFP.MIN_ORD_AMT
+		     , DFP.DELV_FEE										AS ORG_DELV_FEE
+		     , DFP.RTN_DELV_FEE
+		     , DFP.DELV_FEE + DFP.RTN_DELV_FEE					AS EXC_DELV_FEE
+		     , DL.RTN_LOC_NM
+		     , DL.RTN_LOC_ZIPCODE
+		     , DL.RTN_LOC_BASE_ADDR
+		     , DL.RTN_LOC_DTL_ADDR
+		     , DL.RTN_LOC_TELNO
+		     , DA.RECIP_NM
+		     , DA.RECIP_TELNO
+		     , DA.RECIP_PHNNO
+		     , DA.RECIP_ZIPCODE
+		     , DA.RECIP_BASE_ADDR
+		     , DA.RECIP_DTL_ADDR
+		  FROM TB_ORDER O
+		 INNER JOIN TB_ORDER_DETAIL OD
+		    ON O.ORD_NO = OD.ORD_NO
+		   AND OD.ORD_DTL_STAT NOT IN ('G013_11', 'G013_25', 'G013_97')
+		 INNER JOIN TB_ORDER_DETAIL_ITEM ODI
+		    ON OD.ORD_NO = ODI.ORD_NO
+		   AND OD.ORD_DTL_NO = ODI.ORD_DTL_NO
+		   AND ODI.ORD_DTL_STAT NOT IN ('G013_11', 'G013_25', 'G013_97')
+		 INNER JOIN TB_GOODS G1
+		    ON OD.GOODS_CD = G1.GOODS_CD
+		 INNER JOIN TB_GOODS G2
+		    ON ODI.ITEM_CD = G2.GOODS_CD
+		 INNER JOIN TB_BRAND B
+		    ON B.BRAND_CD = G1.BRAND_CD
+		  LEFT OUTER JOIN (SELECT OD.ORD_DTL_NO
+								, SUM(OCD.CHG_QTY) AS ORD_REQ_CHG_QTY
+							 FROM TB_ORDER_CHANGE_DETAIL OCD
+							INNER JOIN TB_ORDER_DETAIL OD
+							   ON OCD.ORD_DTL_NO = OD.ORD_DTL_NO
+							WHERE OD.ORD_NO = #{ordNo}
+							  AND OCD.DEL_YN = 'N'
+							  AND OCD.CHG_STAT IN ('G685_20', 'G685_30', 'G685_33', 'G685_40')
+							GROUP BY OCD.ORD_DTL_NO
+						  ) OCD
+		    ON OD.ORD_DTL_NO = OCD.ORD_DTL_NO
+		  LEFT OUTER JOIN TB_DELIVERY_ADDR DA
+		    ON DA.DELV_ADDR_SQ = OD.DELV_ADDR_SQ
+		  LEFT OUTER JOIN TB_GOODS_IMG GI
+		    ON OD.GOODS_CD = GI.GOODS_CD
+		   AND ODI.OPT_CD1 = GI.COLOR_CD
+		   AND GI.DEFAULT_IMG_YN = 'Y'
+		  LEFT OUTER JOIN (SELECT X.DELV_FEE_CD
+							  , SUM(X.DELV_FEE) AS DELV_FEE
+						   FROM TB_DELIVERY_FEE X
+						  WHERE X.ORD_NO = #{ordNo}
+							AND X.DELV_FEE_GB = 'G018_10'
+						  GROUP BY X.DELV_FEE_CD
+						) DF
+		    ON OD.DELV_FEE_CD = DF.DELV_FEE_CD
+		  LEFT OUTER JOIN TB_DELV_FEE_POLICY DFP
+		    ON DF.DELV_FEE_CD = DFP.DELV_FEE_CD
+		   AND DFP.USE_YN = 'Y'
+		  LEFT OUTER JOIN (SELECT TDL.DELV_LOC_CD
+								, TDL.RTN_LOC_NM
+								, TDL.RTN_LOC_TELNO
+								, TDL.RTN_LOC_ZIPCODE
+								, TDL.RTN_LOC_BASE_ADDR
+								, TDL.RTN_LOC_DTL_ADDR
+							 FROM TB_DELIVERY_LOC TDL
+							INNER JOIN TB_SUPPLY_COMPANY TSC
+							   ON TDL.SUPPLY_COMP_CD = TSC.SUPPLY_COMP_CD
+						  ) DL
+		    ON OD.DELV_LOC_CD = DL.DELV_LOC_CD
+		<where>
+			<choose>
+				<when test='custNo != null and custNo != ""'>
+		   AND O.CUST_NO = #{custNo}
+				</when>
+				<otherwise>
+		   AND O.ORD_NO = #{ordNo}
+		   AND O.ORD_NM = #{orderNm}
+				</otherwise>
+			</choose>
+			<if test="ordNo != null and ordNo != ''">
+		   AND O.ORD_NO = #{ordNo}
+			</if>
+			<if test="ordNoList != null">
+		   AND O.ORD_NO IN
+				<foreach collection="ordNoList" item="item" index="index"  open="(" close=")" separator=",">
+					#{item}
+				</foreach>
+			</if>
+			<if test="ordDtlNoArr != null">
+		   AND OD.ORD_DTL_NO IN
+				<foreach collection="ordDtlNoArr" item="item" index="index"  open="(" close=")" separator=",">
+					#{item}
+				</foreach>
+			</if>
+		   AND O.DISP_YN = 'Y'
+		</where>
+		 ORDER BY OD.ORD_DTL_NO
+	</select>
+
+</mapper>

+ 246 - 0
src/main/webapp/WEB-INF/views/web/cart/cartChangeOptionPopupWeb.html

@@ -0,0 +1,246 @@
+<html lang="ko"
+	  xmlns:th="http://www.thymeleaf.org">
+<!-- 옵션변경 팝업 -->
+<div class="modal-dialog cartOptionModal" role="document">
+	<div class="modal-content">
+		<div class="modal-header">
+			<h5 class="modal-title" id="optModifyLabel">옵션변경</h5>
+			<div class="prod_title">
+				<span class="brand" th:text="|${cart.brandEnm + ' ' + cart.brandKnm}|"></span>
+				<span class="name" th:text="${cart.goodsNm}"></span>
+			</div>
+		</div>
+
+		<div class="modal-body">
+			<div class="pop_cont">
+				<div class="prod_info">
+					<div class="prod_preview">
+						<div class="area_pic">
+							<ul class="pic_list">
+								<th:block th:if="${setType.equals(cart.goodsType) or cart.selfGoodsYn.equals('N')}">
+									<li th:each="img, index : ${cart.cartImgList}">
+										<span class="thumb"><img th:src="${cart.imgPath + '/' + img.sysImgNm}" src="#" alt="" /></span>
+									</li>
+								</th:block>
+								<th:block th:if="${!setType.equals(cart.goodsType) and cart.selfGoodsYn.equals('Y')}">
+									<th:block th:each="comp, status : ${cart.cartCompsList}">
+										<th:block th:each="color, index : ${comp.cartColorList}">
+											<th:block th:if="${color.cartOptCd1 != null and color.cartOptCd1.equals(color.optCd1)}">
+												<li th:each="img, index : ${color.cartImgList}">
+													<span class="thumb"><img th:src="${cart.imgPath + '/' + img.sysImgNm}" src="#" alt="" /></span>
+												</li>
+											</th:block>
+										</th:block>
+									</th:block>
+								</th:block>
+							</ul>
+						</div>
+						<div class="area_order">
+							<th:block th:each="comp, status : ${cart.cartCompsList}">
+								<!-- 세트상품 옵션 -->
+								<th:block th:if="${setType.equals(cart.goodsType)}">
+									<div class="opt_select setOption">
+										<div class="opt_header">
+											<span class="title" th:text="${comp.goodsNm}"></span>
+										</div>
+
+										<!-- 컬러 변경시 만들어줄 size option -->
+										<th:block th:each="color, index : ${comp.cartColorList}">
+											<span style="display:none;">
+												<select th:classappend="|color_${color.goodsCd}_${color.optCd1}|">
+													<th:block th:each="size, i : ${color.cartSizeList}">
+														<th:block th:if="${color.optCd1.equals(size.optCd1)}">
+															<option th:value="${size.optCd}" th:text="${size.optCd2}"></option>
+														</th:block>
+													</th:block>
+												</select>
+											</span>
+										</th:block>
+
+										<div class="form_field">
+											<select class="setColorSelect">
+												<option th:data="${comp.goodsCd}" value="aa">TEST</option>
+												<th:block th:each="color, index : ${comp.cartColorList}">
+													<option th:data="${comp.goodsCd}" th:value="${color.optCd1}" rel="icon-temperature" th:text="${color.colorNm}" th:selected="${color.cartColorNm != null}"></option>
+												</th:block>
+											</select>
+										</div>
+										<div class="form_field">
+											<th:block th:each="color, index : ${comp.cartColorList}">
+											<select th:data="${color.goodsCd}" th:class="|size_${comp.goodsCd} setSizeSelect|">
+												<th:block th:each="size, i : ${color.cartSizeList}">
+													<th:block th:if="${color.optCd1.equals(size.optCd1)}">
+														<option th:data="${comp.cartDtlSq}" th:value="${size.optCd}" th:text="${size.optCd2}" th:selected="${size.cartOptCd != null}"></option>
+													</th:block>
+												</th:block>
+											</select>
+											</th:block>
+										</div>
+									</div>
+								</th:block>
+
+								<!-- 자사 일반 상품 옵션 -->
+								<th:block th:if="${!setType.equals(cart.goodsType) and 'Y'.equals(cart.selfGoodsYn)}">
+									<div class="opt_color">
+										<div class="opt_header">
+											<span class="title">컬러</span>
+											<th:block th:each="color, index : ${comp.cartColorList}">
+												<th:block th:if="${color.cartColorNm != null}">
+													<span class="color" th:text="${color.cartColorNm}"></span>
+												</th:block>
+											</th:block>
+										</div>
+										<ul>
+											<li th:each="color, index : ${comp.cartColorList}" class="selfGoodsColor">
+												<a href="" th:classappend="${color.cartColorNm != null} ? 'on'" class="selfGoodsColorSelect" th:data="${color.optCd1}">
+													<img th:src="${cart.imgPath + '/' + color.sysImgNm}" src="#" th:alt="${color.colorNm}" alt="" />
+												</a>
+											</li>
+										</ul>
+									</div>
+
+									<div class="opt_size">
+										<div class="opt_header">
+											<span class="title">사이즈</span>
+										</div>
+										<div class="form_field selfGoodsSize">
+											<th:block th:each="color, index : ${comp.cartColorList}">
+												<th:block th:if="${color.cartColorNm != null}">
+													<th:block th:each="size, index : ${color.cartSizeList}">
+														<div>
+															<input type="radio" name="rdi-optsize" th:id="|${'rdi-optsize' + size.goodsCd + '-' + size.optCd}|" th:value="${size.optCd}" th:checked="${size.cartOptCd != null}" th:disabled="${size.soldoutYn == 'Y' or cart.goodsQty < size.currStockQty}">
+															<label th:for="|${'rdi-optsize' + size.goodsCd + '-' + size.optCd}|"><span th:text="${size.optCd2}"></span></label>
+														</div>
+													</th:block>
+												</th:block>
+											</th:block>
+										</div>
+									</div>
+								</th:block>
+
+								<!-- 입점업체 상품 옵션 -->
+								<th:block th:if="${!setType.equals(cart.goodsType) and !'Y'.equals(cart.selfGoodsYn)}">
+									<div class="opt_select">
+										<div class="opt_header">
+											<span class="title">옵션선택</span>
+										</div>
+										<div class="form_field">
+											<select id="">
+												<th:block th:each="color, index : ${comp.cartColorList}">
+												<option th:value="${color.optCd}" th:text="${color.optCd1 + '/' + color.optCd2}" th:selected="${color.cartOptCd != null}"></option>
+												</th:block>
+											</select>
+										</div>
+									</div>
+								</th:block>
+							</th:block>
+							<div class="opt_count">
+								<div class="opt_header">
+									<span class="title">수량</span>
+								</div>
+								<div class="number_count">
+									<span class="minus"><span class="sr-only">감소</span></span>
+									<input type="text" name="goodsQty" maxlength="3" style='ime-mode:disabled' th:value="${cart.goodsQty}" />
+									<!-- <input type="text" name="goodsQty" maxlength="3" style='ime-mode:disabled' th:value="2" /> -->
+									<span class="plus"><span class="sr-only">추가</span></span>
+								</div>
+							</div>
+							<div class="btn_group_block">
+								<button class="btn btn_dark btn_block" th:onclick="|fnChangeCartOption(${cart.cartSq})|"><span>옵션변경</span></button>
+							</div>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+<!-- //옵션변경 팝업 -->
+
+
+<script th:inline="javascript">
+	$(document).ready(function() {
+
+	})
+
+	// 세트상품 컬러 변경시
+	$(".setColorSelect").on("change", function(e) {
+		let goodsCd = $(this).find("option:checked").attr("data");
+		$(".setOption .size_" + goodsCd).html("");
+		$(".setOption .size_" + goodsCd).html($(".color_" + goodsCd + "_" + $(this).val()).html());
+	});
+
+	// 자사 일반 상품 컬러 선택시
+	$(".selfGoodsColorSelect").on("click", function(e) {
+		let html = "";
+		let cart = [[${cart}]];
+		let color =  [[${cart.cartCompsList[0].cartColorList}]];
+		let optCd1 = $(this).attr("data");
+
+		for(let i = 0 ; i < color.length ; i++) {
+			let size = color[i].cartSizeList;
+			for(let j = 0 ; j < size.length ; j++) {
+				if(optCd1 == size[j].optCd1) {
+					html += "<div>";
+					html += "<input type='radio' name='rdi-optsize' id='" + size[j].goodsCd + "-" + size[j].optCd + "' value='" + size[j].optCd + "' ";
+					if(size[j].soldoutYn == "Y" || cart.goodsQty < size[j].currStockQty) {
+						html += "disabled = 'disabled'";
+					}
+					html += " />\n";
+					html += "<label for='" + size[j].goodsCd + "-" + size[j].optCd + "'><span>" + size[j].optCd2 + "</span></label>\n"
+					html += "</div>\n";
+				}
+			}
+		}
+
+		$(".selfGoodsSize").html(html);
+	});
+
+	function fnChangeCartOption(cartSq) {
+		let cart = [[${cart}]];
+		let cartDtlSqArr = [], itemCds = [], optCds = [];
+		let data;
+
+		if(cart.goodsType == "G056_S") {
+			$(".setSizeSelect").each(function() {
+				optCds.push($(this).val());
+				itemCds.push($(this).attr("data"));
+				cartDtlSqArr.push($(this).find("option:checked").attr("data"));
+			});
+
+			data = {
+				  cartSq : cart.cartSq
+				, goodsCd : cart.goodsCd
+				, goodsType : cart.goodsType
+				, cartDtlSqArr : cartDtlSqArr
+				, itemCds : itemCds
+				, optCds : optCds
+				, goodsQty : $("input[name=goodsQty]").val()
+			}
+		} else if(cart.goodsType != "G056_S" && cart.selfGoodsYn == "Y") {
+			alert("자사 일반");
+		} else {
+			alert("입점업체");
+		}
+
+		$.ajax( {
+			type: "POST",
+			url : '/cart/change/option',
+			contentType: 'application/json',
+			dataType : 'json',
+			data : JSON.stringify(data),
+			success : function(result) {
+				alert(result.message);
+				$(".closeCartOptionModal").trigger("click");
+				getCartList();
+			}
+		});
+	}
+
+	$(".closeCartOptionModal").on("click", function() {
+		$(".cartOptionModal").html("");
+	});
+</script>
+
+</div>
+<a href="#close-modal" rel="modal:close" class="close-modal closeCartOptionModal">Close</a>
+</html>

+ 64 - 34
src/main/webapp/WEB-INF/views/web/cart/cartListAjaxFormWeb.html

@@ -83,7 +83,7 @@
 										<div class="info_box">
 											<p class="od_name">
 												<a href="">
-													<span class="brand" th:text="${cart.brandNm}"></span>
+													<span class="brand" th:text="|${cart.brandEnm} ${cart.brandKnm}|"></span>
 													<span th:if="${!#strings.isEmpty(cart.delvResDt)}" class="reserv_date" th:text="|${cart.delvResDt} 배송예정|"></span>
 													<span class="name" th:text="${cart.goodsNm}"></span>
 												</a>
@@ -96,7 +96,7 @@
 											</p>
 
 											<p class="od_modify">
-												<button type="button" class="btn_opt_pop"><span>옵션/수량변경</span></button>
+												<button type="button" class="btn_opt_pop" th:onclick="|changeCartOptCd(${cart.cartSq})|"><span>옵션/수량변경</span></button>
 											</p>
 											<!-- 다다익선 적용 -->
 											<div class="od_moresale applyTmtb" th:if="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'Y') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'Y')}">
@@ -215,7 +215,7 @@
 										<div class="info_box">
 											<p class="od_name">
 												<a href="">
-													<span class="brand" th:text="${cart.brandNm}"></span>
+													<span class="brand" th:text="|${cart.brandEnm} ${cart.brandKnm}|"></span>
 													<span class="name" th:text="${cart.goodsNm}"></span>
 												</a>
 											</p>
@@ -226,7 +226,7 @@
 												<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>
+												<button type="button" class="btn_opt_pop" th:onclick="|changeCartOptCd(${cart.cartSq})|"><span>옵션/수량변경</span></button>
 											</p>
 											<!-- 다다익선 적용 -->
 											<div class="od_moresale applyTmtb" th:if="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'Y') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'Y')}">
@@ -385,6 +385,10 @@
 	<!-- // CONT-BODY -->
 </form>
 
+<!-- 옵션변경 팝업 -->
+<div class="modal fade od_pop opt_modify_pop" id="optModifyPop" tabindex="-1" role="dialog" aria-labelledby="optModifyLabel" aria-hidden="true"></div>
+<!-- //옵션변경 팝업 -->
+
 <script th:inline="javascript">
 	let sumRealPayAmt = [[${order.sumRealPayAmt + order.totDelvFee}]];
 	let totDcAmt = [[${order.totDcAmt}]];
@@ -410,6 +414,47 @@
 
 		// 다다익선 할인 대상(미적용) 리스트
 		notApplyTmtbAreaList();
+
+		/* 세트상품 장바구니 */
+		/* let compsList = [];
+		let temp = new Object;
+		temp.goodsCd = "STYS00000042";
+		temp.itemCd = "14373746";
+		temp.optCd = "베이지110";
+		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);
+
+		temp.goodsCd = "STYS00000042";
+		temp.itemCd = "14373769";
+		temp.optCd = "블루110";
+		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);
+
+		temp.goodsCd = "STYS00000042";
+		temp.itemCd = "14373770";
+		temp.optCd = "아이보리110";
+		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); */
 	});
 
 	function notApplyTmtbAreaList() {
@@ -607,7 +652,7 @@
 				}
 			}
 		});
-	};
+	}
 
 	//다다익선 적용내역 보기
 	$(document).on('click','.shopping_bag .part_deliver .btn_moresale',function(e){
@@ -850,7 +895,7 @@
 				obj.tmtbNm = cart.qtyTmtbNm;
 				obj.currPrice = cart.currPrice;
 				obj.goodsNm = cart.goodsNm;
-				obj.brandNm = cart.brandNm;
+				obj.brandNm = cart.brandEnm + " " + cart.brandKnm;
 				obj.imgPath = order.imgPath1 + "/" + cart.sysImgNm;
 
 				notApplyQtyTmtbList.push(obj);
@@ -882,33 +927,18 @@
 	}
 
 	//옵션변경 팝업열기
-	$(document).on('click','.btn_opt_pop',function(e){
-		$("#optModifyPop").modal("show");
-		return false;
-	});
-
-	//상품옵션변경 팝업 > 수량조절
-	$(document).on('click','.opt_modify_pop .number_count .minus',function(e){
-		var $input = $(this).parent().find('input');
-		var count = parseInt($input.val()) - 1;
-		count = count < 1 ? 1 : count;
-		$input.val(count);
-		$input.change();
-		return false;
-	}).on('click','.opt_modify_pop .number_count .plus',function(e){
-		var $input = $(this).parent().find('input');
-		$input.val(parseInt($input.val()) + 1);
-		$input.change();
-		return false;
-	});
-
-	//상품옵션변경 팝업 > 컬러선택 표기
-	$(document).on('click','.opt_modify_pop .opt_color ul li a',function(e){
-		$(this).parents('.opt_color').find('li a').removeClass('on');
-		$(this).addClass('on');
-		var optColor = $('.opt_modify_pop .opt_color ul li a.on img').attr('alt');
-		$('.opt_modify_pop .opt_color .opt_header .color').text(optColor);
-		return false;
-	});
+	function changeCartOptCd(cartSq) {
+		$.ajax( {
+			type: "POST",
+			url : '/cart/goods/info',
+			dataType : 'html',
+			data : {cartSq : cartSq},
+			success : function(result) {
+				//fnChangeCartListInfo(result);
+				$("#optModifyPop").html(result);
+				$("#optModifyPop").modal("show");
+			}
+		});
+	}
 </script>
 </html>

+ 22 - 143
src/main/webapp/WEB-INF/views/web/cart/cartListFormWeb.html

@@ -253,144 +253,6 @@
 </div>
 <!-- // container -->
 
-<!-- 옵션변경 팝업 -->
-<div class="modal fade od_pop opt_modify_pop" id="optModifyPop" tabindex="-1" role="dialog" aria-labelledby="optModifyLabel" aria-hidden="true">
-    <div class="modal-dialog" role="document">
-        <div class="modal-content">
-            <div class="modal-header">
-                <h5 class="modal-title" id="optModifyLabel">옵션변경</h5>
-                <div class="prod_title">
-                    <span class="brand">버카루 BUCKROO</span>
-                    <span class="name">남성 제기장 스웨이드 자켓</span>
-                </div>
-            </div>
-            <div class="modal-body">
-                <div class="pop_cont">
-                    <div class="prod_info">
-                        <div class="prod_preview">
-                            <div class="area_pic">
-                                <ul class="pic_list">
-                                    <li><span class="thumb"><img src="/images/pc/thumb/tmp_pdDetail1.jpg" alt=""></span></li>
-                                    <li><span class="thumb"><img src="/images/pc/thumb/tmp_pdDetail2.jpg" alt=""></span></li>
-                                    <li><span class="thumb"><img src="/images/pc/thumb/tmp_pdDetail3.jpg" alt=""></span></li>
-                                    <li><span class="thumb"><img src="/images/pc/thumb/tmp_pdDetail4.jpg" alt=""></span></li>
-                                    <li><span class="thumb"><img src="/images/pc/thumb/tmp_pdDetail5.jpg" alt=""></span></li>
-                                    <li><span class="thumb"><img src="/images/pc/thumb/tmp_pdDetail6.jpg" alt=""></span></li>
-                                </ul>
-                            </div>
-                            <div class="area_order">
-                                <div class="opt_color">
-                                    <div class="opt_header">
-                                        <span class="title">컬러</span>
-                                        <span class="color">그레이</span>
-                                    </div>
-                                    <ul>
-                                        <li>
-                                            <a href="" class="on">
-                                                <img src="/images/pc/thumb/tmp_cartColor1.jpg" alt="그레이">
-                                            </a>
-                                        </li>
-                                        <li>
-                                            <a href="">
-                                                <img src="/images/pc/thumb/tmp_cartColor1.jpg" alt="베이지">
-                                            </a>
-                                        </li>
-                                        <li>
-                                            <a href="">
-                                                <img src="/images/pc/thumb/tmp_cartColor1.jpg" alt="그린">
-                                            </a>
-                                        </li>
-                                        <li>
-                                            <a href="">
-                                                <img src="/images/pc/thumb/tmp_cartColor1.jpg" alt="핑크">
-                                            </a>
-                                        </li>
-                                        <li>
-                                            <a href="">
-                                                <img src="/images/pc/thumb/tmp_cartColor1.jpg" alt="민트">
-                                            </a>
-                                        </li>
-                                        <li>
-                                            <a href="">
-                                                <img src="/images/pc/thumb/tmp_cartColor1.jpg" alt="블랙">
-                                            </a>
-                                        </li>
-                                    </ul>
-                                </div>
-                                <div class="opt_size">
-                                    <div class="opt_header">
-                                        <span class="title">사이즈</span>
-                                    </div>
-                                    <div class="form_field">
-                                        <div>
-                                            <input type="radio" name="rdi-optsize" id="rdi-optsize1" value="" checked="">
-                                            <label for="rdi-optsize1"><span>90</span></label>
-                                        </div>
-                                        <div>
-                                            <input type="radio" name="rdi-optsize" id="rdi-optsize2" value="" disabled>
-                                            <label for="rdi-optsize2"><span>95</span></label>
-                                        </div>
-                                        <div>
-                                            <input type="radio" name="rdi-optsize" id="rdi-optsize3" value="">
-                                            <label for="rdi-optsize3"><span>100</span></label>
-                                        </div>
-                                        <div>
-                                            <input type="radio" name="rdi-optsize" id="rdi-optsize4" value="">
-                                            <label for="rdi-optsize4"><span>105</span></label>
-                                        </div>
-                                        <div>
-                                            <input type="radio" name="rdi-optsize" id="rdi-optsize5" value="">
-                                            <label for="rdi-optsize5"><span>110</span></label>
-                                        </div>
-                                        <div>
-                                            <input type="radio" name="rdi-optsize" id="rdi-optsize6" value="">
-                                            <label for="rdi-optsize6"><span>115</span></label>
-                                        </div>
-                                        <div>
-                                            <input type="radio" name="rdi-optsize" id="rdi-optsize7" value="">
-                                            <label for="rdi-optsize7"><span>free</span></label>
-                                        </div>
-                                    </div>
-                                </div>
-                                <div class="opt_select">
-                                    <div class="opt_header">
-                                        <span class="title">옵션선택</span>
-                                    </div>
-                                    <div class="form_field">
-                                        <select id="">
-                                            <option value="" rel="icon-temperature">카키/95</option>
-                                            <option value="">카키/100</option>
-                                            <option value="">카키/105</option>
-                                            <option value="">카키/110</option>
-                                            <option value="">옐로우/95</option>
-                                            <option value="">옐로우/100</option>
-                                            <option value="">옐로우/105</option>
-                                            <option value="">옐로우/110</option>
-                                        </select>
-                                    </div>
-                                </div>
-                                <div class="opt_count">
-                                    <div class="opt_header">
-                                        <span class="title">수량</span>
-                                    </div>
-                                    <div class="number_count">
-                                        <span class="minus"><span class="sr-only">감소</span></span>
-                                        <input type="text" name="" maxlength="3" style='ime-mode:disabled' value="1" />
-                                        <span class="plus"><span class="sr-only">추가</span></span>
-                                    </div>
-                                </div>
-                                <div class="btn_group_block">
-                                    <button class="btn btn_dark btn_block" id=""><span>옵션변경</span></button>
-                                </div>
-                            </div>
-                        </div>
-                    </div>
-                </div>
-            </div>
-        </div>
-    </div>
-</div>
-<!-- //옵션변경 팝업 -->
 <!-- 쿠폰사용안내 팝업 -->
 <div class="modal fade od_pop cpinfo_pop" id="cpinfoPop" tabindex="-1" role="dialog" aria-labelledby="cpinfoLabel" aria-hidden="true">
     <div class="modal-dialog" role="document">
@@ -413,8 +275,6 @@
 <link rel="stylesheet" type="text/css" href="/ux/pc/css/swiper.min.css" />
 
 <script type="text/javascript">
-    /* xodud1202 수정 */
-
     $(document).ready(function() {
         // 장바구니 상품 정보 select
         getCartList();
@@ -434,10 +294,29 @@
         });
     }
 
-    /* // xodud1202 수정 */
-
-
+    //상품옵션변경 팝업 > 수량조절
+    $(document).on('click','.opt_modify_pop .number_count .minus',function(e){
+        var $input = $(this).parent().find('input');
+        var count = parseInt($input.val()) - 1;
+        count = count < 1 ? 1 : count;
+        $input.val(count);
+        $input.change();
+        return false;
+    }).on('click','.opt_modify_pop .number_count .plus',function(e){
+        var $input = $(this).parent().find('input');
+        $input.val(parseInt($input.val()) + 1);
+        $input.change();
+        return false;
+    });
 
+    //상품옵션변경 팝업 > 컬러선택 표기
+    $(document).on('click','.opt_modify_pop .opt_color ul li a',function(e){
+        $(this).parents('.opt_color').find('li a').removeClass('on');
+        $(this).addClass('on');
+        var optColor = $(this).find("img").attr('alt');
+        $(this).parent().parent().parent().find(".color").text(optColor);
+        return false;
+    });
 
     $(function(){
         //추천상품 슬라이드

+ 141 - 78
src/main/webapp/WEB-INF/views/web/mypage/MypageReturnFormWeb.html

@@ -30,81 +30,86 @@
 			<form class="form_wrap" role="form">
 				<div class="order_list">
 					<section class="order_row">
-						<th:block th:if="${orderList}" th:each="oneData, status : ${orderList}">
-							<div class="part_deliver">
-								<div class="tbl_tit">
-									<!-- 주문일/선물일 설정 -->
-									<span class="start_t" th:unless="${oneData.giftPackYn == 'Y'}">주문일</span>
-									<span class="gift_t" th:if="${oneData.giftPackYn == 'Y'}">선물일</span>
-									<!-- //주문일/선물일 설정 -->
-	
-									<span class="order_date" th:text="${oneData.ordDt}"></span>
-	
-									<!-- 배송구분 설정 -->
-									<span class="order_label02" th:if="${oneData.shotDelv}">총알배송</span>
-									<span class="order_label01" th:if="${oneData.selfMall}">STYLE24 일반배송</span>
-									<span class="order_label01" th:if="${oneData.supplyMall}">업체직배송</span>
-									<!-- //배송구분 설정 -->
-									<a href="javascript:void(0)" class="detail_btn" th:attr="ordNo=${oneData.ordNo}" onclick="fnGoToOrderDetail(this)">주문상세보기</a>
-								</div>
-								<th:block th:if="${oneData.orderList}" th:each="order, status : ${oneData.orderList}">
-									<div class="tbl type2">
-										<table id="returnList">
-											<colgroup>
-												<col width="1020">
-												<col width="180">
-											</colgroup>
-											<tbody>
-											<th:block th:if="${order.ordDtlList}" th:each="ordDtl, status : ${order.ordDtlList}" th:with="imageUrl=${@environment.getProperty('upload.goods.view')}">
-												<input type="hidden" name="ordDtlNo" th:value="${ordDtl.ordDtlNo}"/>
-												<input type="hidden" name="ordDtlStat" th:value="${ordDtl.ordDtlStat}"/>
-												<input type="hidden" name="reviewSq" th:value="${ordDtl.reviewSq}"/>
-												<tr>
-													<td>
-														<div class="info_item">
-															<div class="thumb_box">
-																<a href="">
-																	<img th:src="${imageUrl + '/' + ordDtl.sysImgNm}" width="100%" alt="">
-																</a>
-															</div>
-															<div class="info_box">
-																<p class="od_name">
-																	<a href="">
-																		<span class="brand" th:text="${ordDtl.brandNm}"></span>
-																		<span class="name" th:text="${ordDtl.goodsNm}"></span>
-																	</a>
-																</p>
-																<p class="od_opt">
-																	<span class="option"><em th:text="${ordDtl.optCd1}"></em><em th:text="${ordDtl.optCd2}"></em></span>
-																	<span class="count">수량 <em th:text="${ordDtl.ordQty}"></em>개</span>
-																</p>
-															</div>
-															<div class="info_calc">
-																<p class="price">
-																	<span class="selling_price" th:text="|${#numbers.formatInteger(ordDtl.ordAmt, 1, 'COMMA')}원|"></span>
-																</p>
-																<p class="point"><span th:text="${#numbers.formatInteger(ordDtl.savePntAmt, 1, 'COMMA')}"></span>p</p>
-															</div>
+						<div class="part_deliver">
+							<div class="tbl_tit">
+								<!-- 주문일/선물일 설정 -->
+								<span class="start_t" th:unless="${returnList.oneData.giftPackYn == 'Y'}">주문일</span>
+								<span class="gift_t" th:if="${returnList.oneData.giftPackYn == 'Y'}">선물일</span>
+								<!-- //주문일/선물일 설정 -->
+
+								<span class="order_date" th:text="${returnList.oneData.ordDt}"></span>
+
+								<!-- 배송구분 설정 -->
+								<span class="order_label02" th:if="${returnList.shotDelv}">총알배송</span>
+								<span class="order_label01" th:if="${returnList.selfMall}">STYLE24 일반배송</span>
+								<span class="order_label01" th:if="${returnList.supplyMall}">업체직배송</span>
+								<!-- //배송구분 설정 -->
+								<a href="javascript:void(0)" class="detail_btn" th:attr="ordNo=${returnList.oneData.ordNo}" onclick="fnGoToOrderDetail(this)">주문상세보기</a>
+							</div>
+							<div class="tbl type2">
+								<table id="returnList">
+									<colgroup>
+										<col width="1020">
+										<col width="180">
+									</colgroup>
+									<tbody>
+									<th:block th:if="${returnList.returnList}" th:each="return, status : ${returnList.returnList}" th:with="imageUrl=${@environment.getProperty('upload.goods.view')}">
+										<tr>
+											<td>
+												<div class="info_item">
+													<div class="thumb_box">
+														<a href="">
+															<img th:src="${imageUrl + '/' + return.sysImgNm}" width="100%" alt="">
+														</a>
+													</div>
+													<div class="info_box">
+														<p class="od_name">
+															<a href="">
+																<span class="brand" th:text="${return.brandNm}"></span>
+																<span class="name" th:text="${return.goodsNm}"></span>
+															</a>
+														</p>
+														<p class="od_opt">
+															<span class="option"><em th:text="${return.optCd1}"></em><em th:text="${return.optCd2}"></em></span>
+															<span class="count">수량 <em th:text="${return.ordQty}"></em>개</span>
+														</p>
+													</div>
+													<div class="info_calc">
+														<p class="price">
+															<span class="selling_price" th:text="|${#numbers.formatInteger(return.ordAmt, 1, 'COMMA')}원|"></span>
+														</p>
+														<p class="point"><span th:text="${#numbers.formatInteger(return.savePntAmt, 1, 'COMMA')}"></span>p</p>
+													</div>
+												</div>
+											</td>
+											<td class="cnt_sel">
+												<span class="cnt_t">수량</span>
+												<div class="form_field">
+													<div class="select_custom type1">
+														<div class="combo">
+															<input type="hidden" name="chgQty" value="0" th:attr="ordDtlNo=${return.ordDtlNo}"/>
+															<div class="select">선택</div>
+															<ul class="list" style="width:100px; margin:0 auto">
+																<li class="selected" value="0">선택</li>
+																<li th:if="${return.ordQty > 0}" th:each="num : ${#numbers.sequence(1,return.ordQty)}" th:value="${num}" th:text="${num}" onclick="fnChangeQty(this);"></li>
+															</ul>
 														</div>
-													</td>
-													<td class="cnt_sel">
-														<span class="cnt_t">수량</span>
-														<select class="select_dress" name="chgQty" onchange="fnChangeQty();">
-															<option value="">선택</option>
-															<option th:if="${ordDtl.ordQty > 0}" th:each="num : ${#numbers.sequence(1,ordDtl.ordQty)}" th:value="${num}" th:text="${num}"></option>
-														</select>
-													</td>
-												</tr>
-											</th:block>
-											</tbody>
-										</table>
-									</div>
-								</th:block>
-								<div class="order_confirm">
-									<p class="cf_txt cf_desc c_primary">반품하실 상품의 수량을 선택하신 후 반품 신청을 하실 수 있습니다.</p>
-								</div>
+													</div>
+												</div>
+<!--												<select class="select_dress" name="chgQty" onchange="fnChangeQty();">-->
+<!--													<option value="">선택</option>-->
+<!--													<option th:if="${return.ordQty > 0}" th:each="num : ${#numbers.sequence(1,return.ordQty)}" th:value="${num}" th:text="${num}"></option>-->
+<!--												</select>-->
+											</td>
+										</tr>
+									</th:block>
+									</tbody>
+								</table>
 							</div>
-						</th:block>
+							<div class="order_confirm">
+								<p class="cf_txt cf_desc c_primary">반품하실 상품의 수량을 선택하신 후 반품 신청을 하실 수 있습니다.</p>
+							</div>
+						</div>
 					</section>
 					<section class="order_row">
 						<div class="tbl_tit">
@@ -118,10 +123,17 @@
 								<tbody>
 								<tr>
 									<td>
-										<select id="mounth" name="chgReason" onchange="fnChangeReason(this);">
-											<option value="">반품 사유를 선택하세요</option>
-											<option th:if="${returnReason}" th:each="oneData, status : ${returnReason}" th:value="${oneData.cd}" th:text="${oneData.cdNm}"></option>
-										</select>
+										<div class="form_field">
+											<div class="select_custom type1">
+												<div class="combo">
+													<div class="select" name="chgReason">반품 사유를 선택하세요</div>
+													<ul class="list" style="width:400px">
+														<li class="selected" value="">반품 사유를 선택하세요</li>
+														<li th:if="${returnReason}" th:each="oneData, status : ${returnReason}" th:value="${oneData.cd}" th:text="${oneData.cdNm}" onclick="fnChangeReason(this);"></li>
+													</ul>
+												</div>
+											</div>
+										</div>
 									</td>
 								</tr>
 								<tr>
@@ -303,12 +315,19 @@
 	</div>
 <script src="/ux/plugins/gaga/gaga.paging.js"></script>
 <script th:inline="javascript">
+	let returnList = [[${returnList.returnList}]];
+
 	$(document).ready(function() {
 		// 마이페이지 LNB 설정
 		fnSetMypageLnbList(2);
 		
 		// 마이페이지 location 설정
 		fnSetMypageLocation('취소/반품/환불내역', '_PAGE_MYPAGE_CRS_LIST', '반품 신청');
+		
+		// 셀렉트박스 활성화
+		$('.select_custom.type1').each(function(index) {
+			var selecter01 = new sCombo($(this));
+		});
 	});
 	
 	// 반품 처리
@@ -319,8 +338,52 @@
 	
 	// 반품 수량 변경 이벤트 처리
 	var fnChangeQty = function(param) {
+		let url = '/mypage/cancel/refund/amt/calculate';
+		$(param).parent().parent().find('input[name=chgQty]').val($(param).val());
+		
+		let chgReason = $('div[name=chgReason]').parent().find('li.selected').attr('value');
+		
+		if (!gagajf.isNull(chgReason)) {
+			let data = {};
+			let returnRequestList = [];
+
+			// 반품 수량 설정
+			let chgQtyArr = [];
+			let ordDtlNoArr = [];
+			$.each($('input[name=chgQty]'), function(idx, item) {
+				let chgQty = $(item).val();
+				let ordDtlNo = $(item).attr('ordDtlNo');
+
+				chgQtyArr.push(Number(chgQty));
+				ordDtlNoArr.push(Number(ordDtlNo));
+			});
+
+			$.each(returnList, function(idx, item) {
+				let index = ordDtlNoArr.indexOf(item.ordDtlNo);
+				item.ordCanChgQty = chgQtyArr[index];
+
+				returnRequestList.push(item);
+			})
+			
+			let jsonData = JSON.stringify(returnRequestList);
+			
+			gagajf.ajaxJsonSubmit(url, jsonData, function(result) {
+				$('#returnAmt').text(result.spanRefundAmt.addComma());			// 환불예정금액
+				$('#goodsCancelAmt').text(result.spanRealCnclRtnAmt.addComma());	// 상품취소금액
+				$('#deliveryFee').text(result.spanTotDeliveryFee.addComma());		// 배송비
+				$('#deductDcAmt').text((result.spanGoodsCpnDcAmt + result.spanCartCpnDcAmt + result.spanTmtbDcAmt).addComma());		// 할인금액 차감(쿠폰+다다익선)
+				$('#refundPayAmt').text(result.spanRealCnclRtnAmt);		// 결제금액 환불
+				$('#refundPoint').text(result.spanPntDcAmt);		// 포인트 환불
+				$('#refundGiftCard').text(result.spanGfcdUseAmt);	// 상품권 환불
+				console.log(result);
+			})
+		}
+	}
+	
+	// 반품 사유 변경 이벤트
+	var fnChangeReason = function(param) {
 		// TODO
-		// 반품 수량 변경 처리
+		// 반품 사유 변경 처리
 	}
 	
 	var fnChangeWdGb = function() {

+ 217 - 64
src/main/webapp/WEB-INF/views/web/order/OrderFormWeb.html

@@ -347,7 +347,7 @@
 														<div>
 															<dt>할인쿠폰</dt>
 															<dd>
-																<a href="" class="btn_coupon_toggle">할인쿠폰 <span>3장</span>적용</a>
+																<a href="javascript:void(0);" class="btn_coupon_toggle">할인쿠폰 <span id="cpnApplyCnt"></span>적용</a>
 																<div class="coupon_list">
 																	<ul>
 																		<!--  상품쿠폰 -->
@@ -376,6 +376,7 @@
 																						<div class="form_field">
 																							<div class="select_custom type1">
 																								<div class="combo">
+																									<input type="hidden" name="cpnType" value="goodsCpn"/>
 																									<input type="hidden" name="cpnCartSq" th:value="${goods.cartSq}"/>
 																									<input type="hidden" name="custCpnSq" value="0"/>
 																									<input type="hidden" name="cpnDcAmt" value="0"/>
@@ -407,6 +408,7 @@
 																					<div class="form_field">
 																						<div class="select_custom type1">
 																							<div class="combo">
+																								<input type="hidden" name="cpnType" value="cartCpn"/>
 																								<input type="hidden" name="custCpnSq" value="0"/>
 																								<input type="hidden" name="cpnDcAmt" value="0"/>
 																								
@@ -416,8 +418,10 @@
 																									<th:block th:each="cartCpn, k : ${cartCpnList}">
 																										<li th:value="${cartCpn.custCpnSq}" th:data="${cartCpn.cpnDcAmt}">
 																											<th:block th:text="${cartCpn.cpnNm}"></th:block>
+																											<input type="hidden" name="dcWay" th:value="${cartCpn.dcWay}"/>
+																											<input type="hidden" name="dcVal" th:value="${cartCpn.dcVal}"/>
 																											<th:block th:each="cartCpnCartSq, kokok : ${cartCpn.cartCpnCartSqArr}"> 
-																												<input type="text" name="cartCpnCartSq" th:value="${cartCpnCartSq}" />
+																												<input type="hidden" name="cartCpnCartSq" th:value="${cartCpnCartSq}" />
 																											</th:block>
 																										</li>
 																									</th:block>
@@ -441,6 +445,7 @@
 																					<div class="form_field">
 																						<div class="select_custom type1">
 																							<div class="combo">
+																								<input type="hidden" name="cpnType" value="delvCpn"/>
 																								<input type="hidden" name="custCpnSq" value="0"/>
 																								<input type="hidden" name="cpnDcAmt" value="0"/>
 																								
@@ -836,32 +841,34 @@
 												<div class="gd_list">
 													<th:block th:each="goods, i : ${delvAllCart}">
 														<div class="item_gd">
-															<input type="text" name="cartSq" 			th:value="${goods.cartSq}"/>
-															<input type="text" name="cpn1CpnSq" 		th:value="${goods.cpn1CpnSq}"/>
-															<input type="text" name="cpn1DcAmt" 		th:value="${goods.orgCurrPrice} - ${goods.currPrice}"/>
+															<input type="hidden" name="cartSq" 			th:value="${goods.cartSq}"/>
+															<input type="hidden" name="currPrice"		th:value="${goods.currPrice}"/>
+															
+															<input type="hidden" name="cpn1CpnSq" 		th:value="${goods.cpn1CpnSq}"/>
+															<input type="hidden" name="cpn1DcAmt" 		th:value="${goods.orgCurrPrice} - ${goods.currPrice}"/>
 															
 															<th:block th:if="${goods.applyQtySectionYn} == 'Y' and ${goods.qtyTmtbSq} > 0">
-																<input type="text" name="tmtb1Sq" 		th:value="${goods.qtyTmtbSq}"/>
-																<input type="text" name="tmtb1DcAmt" 	th:value="${goods.tmtb1DcAmt}"/>
+																<input type="hidden" name="tmtb1Sq" 	th:value="${goods.qtyTmtbSq}"/>
+																<input type="hidden" name="tmtb1DcAmt" 	th:value="${goods.tmtb1DcAmt}"/>
 															</th:block>
 															<th:block th:if="${goods.applyQtySectionYn} != 'Y'">
-																<input type="text" name="tmtb1Sq" 		value="0"/>
-																<input type="text" name="tmtb1DcAmt" 	value="0"/>
+																<input type="hidden" name="tmtb1Sq" 	value="0"/>
+																<input type="hidden" name="tmtb1DcAmt" 	value="0"/>
 															</th:block>
 															
 															<th:block th:if="${goods.applyAmtSectionYn} == 'Y' and ${goods.amtTmtbSq} > 0">
-																<input type="text" name="tmtb2Sq" 		th:value="${goods.amtTmtbSq}"/>
-																<input type="text" name="tmtb2DcAmt" 	th:value="${goods.tmtb2DcAmt}"/>
+																<input type="hidden" name="tmtb2Sq" 	th:value="${goods.amtTmtbSq}"/>
+																<input type="hidden" name="tmtb2DcAmt" 	th:value="${goods.tmtb2DcAmt}"/>
 															</th:block>
 															<th:block th:if="${goods.applyAmtSectionYn} != 'Y'">
-																<input type="text" name="tmtb2Sq" 		value="0"/>
-																<input type="text" name="tmtb2DcAmt" 	value="0"/>
+																<input type="hidden" name="tmtb2Sq" 	value="0"/>
+																<input type="hidden" name="tmtb2DcAmt" 	value="0"/>
 															</th:block>
 															
-															<input type="text" name="goodsCpnSq" 		value=""/>
-															<input type="text" name="goodsCpnDcAmt" 	value=""/>
-															<input type="text" name="cartCpnSq" 		value=""/>
-															<input type="text" name="cartCpnDcAmt" 		value=""/>
+															<input type="hidden" name="goodsCpnSq" 		value=""/>
+															<input type="hidden" name="goodsCpnDcAmt" 	value=""/>
+															<input type="hidden" name="cartCpnSq" 		value=""/>
+															<input type="hidden" name="cartCpnDcAmt" 	value=""/>
 															
 															<figure>
 																<span class="thumb"><img src="/images/pc/thumb/tmp_odSide1.jpg" alt=""></span>
@@ -1236,22 +1243,8 @@ $(document).ready( function() {
 				$(this).on("click", function(){
 					// 쿠폰 선택없음
 					if ($(this).prop("value") == 0) {
-						// select box 쿠폰 적용
-						var cpnCartSq = $(this).parent().parent().find("input[name='cpnCartSq']").val();
-						
-						// 장바구니시퀀스 체크
-						$("input[name='cartSq']").each(function(){
-							if (cpnCartSq == $(this).val()) {
-								$(this).parent().find("input[name='goodsCpnSq']").val("0");			// 상품쿠폰시퀀스
-								$(this).parent().find("input[name='goodsCpnDcAmt']").val("0");		// 상품쿠폰할인금액
-							}
-						});
-						
-						$(this).parent().parent().find("input[name='custCpnSq']").val("0");
-						$(this).parent().parent().find("input[name='cpnDcAmt']").val("0");
-						
-						$(this).parent().parent().find(".select").text("선택없음");
-						$(this).parent().parent().parent().parent().parent().find(".cp_discount").css("display", "none");
+						// 쿠폰 선택없음
+						cpnApplyDel($(this));
 					}
 					// 쿠폰선택
 					else {
@@ -1265,30 +1258,42 @@ $(document).ready( function() {
 							// 쿠폰적용불가
 							custCpnNotApply($(this));
 						}
+						
+						// 쿠폰할인금액 SUM
+						custCpnSumAmtCal();
+						
+						// 최대할인혜택적용 체크해제
+						if ($("#chk-maxdisc").is(":checked")) {
+							$("#chk-maxdisc").attr("checked", false);
+						}
 					}
-					
-					// 최대할인혜택적용 체크해제
-					if ($("#chk-maxdisc").is(":checked")) {
-						$("#chk-maxdisc").attr("checked", false);
-					}
-					
-					// 쿠폰할인금액 SUM
-					custCpnSumAmtCal();
 				});
 			});
 		});
 		
-		// 3. 쿠폰 최대할인금액 초기화 버튼 설정
-		$("#chk-maxdisc").on("click", function(){
-			if ($(this).is(":checked")) {
-				custCpnInit();
-			}
-		});
 		
-		// 3. 쿠폰적용초기화(할인율최고)
+		// 4 쿠폰적용초기화(할인율최고)
 		custCpnInit();
 	});
 	
+	// 쿠폰 최대할인금액 초기화 버튼 설정
+	$("#chk-maxdisc").on("click", function(){
+		if ($(this).is(":checked")) {
+			custCpnInit();
+		}
+	});
+	
+	// 쿠폰할인적용 삭제 버튼
+	$(".btn_del_coupon").on("click", function(){
+		//선택없음선택
+		$(this).parent().parent().find("ul li").each(function(i){
+			if (i == 0) {
+				// 쿠폰 선택없음
+				cpnApplyDel($(this));
+			}
+		});
+	});
+	
 	// 쿠폰 최대할인율 쿠폰적용
 	var custCpnInit = function() {
 		
@@ -1327,7 +1332,7 @@ $(document).ready( function() {
 						if (custCpnDuplicationCheck($(this).prop("value"), index)) {
 							// 쿠폰적용
 							custCpnApply($(this));
-							
+							// 쿠폰할인적용
 							cpnApplyTemp = true;
 						}
 					}
@@ -1366,25 +1371,118 @@ $(document).ready( function() {
 	
 	// 쿠폰중복체크 후 적용가능
 	var custCpnApply = function(obj) {
-		// 적용된 할인금액 text 설정 
-		var dcAmtStr = "- " + parseInt(obj.attr("data")).addComma() + " 원 할인적용";
-		obj.parent().parent().parent().parent().parent().find(".cp_amount").text(dcAmtStr);
-		
 		// select box 쿠폰 적용
-		var cpnCartSq = obj.parent().parent().find("input[name='cpnCartSq']").val();
+		var cpnType 	= obj.parent().parent().find("input[name='cpnType']").val();
 		
-		// 장바구니시퀀스 체크
-		$("input[name='cartSq']").each(function(){
-			if (cpnCartSq == $(this).val()) {
-				$(this).parent().find("input[name='goodsCpnSq']").val(obj.prop("value"));		// 상품쿠폰시퀀스
-				$(this).parent().find("input[name='goodsCpnDcAmt']").val(obj.attr("data"));		// 상품쿠폰할인금액
-			}
-		});
+		// 상품쿠폰적용
+		if (cpnType == "goodsCpn") {
+			// 적용된 할인금액 text 설정 
+			var dcAmtStr = "- " + parseInt(obj.attr("data")).addComma() + " 원 할인적용";
+			obj.parent().parent().parent().parent().parent().find(".cp_amount").text(dcAmtStr);
+			
+			var cpnCartSq 	= obj.parent().parent().find("input[name='cpnCartSq']").val();
+			
+			// 장바구니시퀀스 체크
+			$("input[name='cartSq']").each(function(){
+				if (cpnCartSq == $(this).val()) {
+					$(this).parent().find("input[name='goodsCpnSq']").val(obj.prop("value"));		// 상품쿠폰시퀀스
+					$(this).parent().find("input[name='goodsCpnDcAmt']").val(obj.attr("data"));		// 상품쿠폰할인금액
+				}
+			});
+			
+			obj.parent().parent().find("input[name='cpnDcAmt']").val(obj.attr("data"));
+		} 
+		// 장바구니쿠폰적용
+		else if (cpnType == "cartCpn") {
+			var dcWay 				= obj.parent().find("input[name='dcWay']").val();
+			var dcVal 				= obj.parent().find("input[name='dcVal']").val();
+			var cartCpnDcSumAmt		= 0;
+			var tempSumAmt			= 0;
+			var applyGoodsCnt		= 0;
+			var leftAmt				= 0;
+			var index				= 0;
+			
+			// 장바구니쿠폰 해당 장바구니상품들 할인가 적용
+			obj.find("input[name='cartCpnCartSq']").each(function(){
+				var cartCpnCartSq 		= $(this).val();
+				var cartCpnDcAmt		= 0;
+				
+				// 장바구니시퀀스 체크
+				$("input[name='cartSq']").each(function(){
+					if (cartCpnCartSq == $(this).val()) {
+						var currPrice 		= parseInt($(this).parent().find("input[name='currPrice']").val());
+						var tmtb1DcAmt 		= parseInt($(this).parent().find("input[name='tmtb1DcAmt']").val());
+						var tmtb2DcAmt 		= parseInt($(this).parent().find("input[name='tmtb2DcAmt']").val());
+						var goodsCpnDcAmt 	= parseInt($(this).parent().find("input[name='goodsCpnDcAmt']").val());
+						
+						var tempAmt 		= currPrice - tmtb1DcAmt - tmtb2DcAmt - goodsCpnDcAmt;
+						tempSumAmt			= tempSumAmt + tempAmt; 
+						
+						// 할인율일때 할인금액 
+						if (dcWay == "G240_20") {
+							cartCpnDcAmt = (tempAmt * dcVal) / 100;
+							cartCpnDcSumAmt = cartCpnDcSumAmt + cartCpnDcAmt;
+							
+							$(this).parent().find("input[name='cartCpnSq']").val(obj.prop("value"));
+							$(this).parent().find("input[name='cartCpnDcAmt']").val(cartCpnDcAmt);
+						}
+						
+						applyGoodsCnt++;
+					}
+				});
+			});
+			
+			// 금액일때 할인금액 적용
+			if (dcWay == "G240_10") {
+				cartCpnDcSumAmt = dcVal;
+				leftAmt			= dcVal;
+				index			= 0;
+				
+				// 장바구니쿠폰 해당 장바구니상품들 할인가 적용
+				obj.find("input[name='cartCpnCartSq']").each(function(){
+					var cartCpnCartSq 		= $(this).val();
+					var cartCpnDcAmt		= 0;
+										
+					// 장바구니시퀀스 체크
+					$("input[name='cartSq']").each(function(){
+						if (cartCpnCartSq == $(this).val()) {
+							index++;
+							
+							var currPrice 		= parseInt($(this).parent().find("input[name='currPrice']").val());
+							var tmtb1DcAmt 		= parseInt($(this).parent().find("input[name='tmtb1DcAmt']").val());
+							var tmtb2DcAmt 		= parseInt($(this).parent().find("input[name='tmtb2DcAmt']").val());
+							var goodsCpnDcAmt 	= parseInt($(this).parent().find("input[name='goodsCpnDcAmt']").val());
+							
+							var tempAmt 		= currPrice - tmtb1DcAmt - tmtb2DcAmt - goodsCpnDcAmt;
+							var tempDiv 		= parseInt((tempAmt / tempSumAmt) * 100);
+							var cartCpnDcAmt	= 0;
+					
+							if (index == applyGoodsCnt) {
+								cartCpnDcAmt 	= leftAmt;
+							} else {
+								cartCpnDcAmt	= parseInt((cartCpnDcSumAmt * tempDiv) / 100);
+								leftAmt 		= leftAmt - cartCpnDcAmt;
+							}
+							
+							$(this).parent().find("input[name='cartCpnSq']").val(obj.prop("value"));
+							$(this).parent().find("input[name='cartCpnDcAmt']").val(cartCpnDcAmt);
+						}
+					});
+				});
+			} 
+			
+			obj.parent().parent().find("input[name='cpnDcAmt']").val(cartCpnDcSumAmt);
+			
+			var dcAmtStr = "- " + cartCpnDcSumAmt.addComma() + " 원 할인적용";
+			obj.parent().parent().parent().parent().parent().find(".cp_amount").text(dcAmtStr);
+		}
+		// 배송비쿠폰적용
+		else if (cpnType == "delvCpn") {
+			
+		}
 		
-		// select box 쿠폰 적용
+		// select box 쿠폰 적용 (공통적용)
 		obj.parent().parent().find("input[name='custCpnSq']").val(obj.prop("value"));
-		obj.parent().parent().find("input[name='cpnDcAmt']").val(obj.attr("data"));
-		
 		obj.parent().parent().find(".select").text(obj.text());
 		
 		// 선택된 할인금액 노출
@@ -1413,12 +1511,67 @@ $(document).ready( function() {
 	// 쿠폰할인금액합계설정
 	var custCpnSumAmtCal = function() {
 		var cpnDcSumAmt = 0;
+		var cpnApplyCnt = 0;
+		
 		$("input[name='cpnDcAmt']").each(function(){
 			cpnDcSumAmt = cpnDcSumAmt + parseInt($(this).val());
+			
+			// 적용된 쿠폰 수량
+			if (parseInt($(this).val()) > 0) {
+				cpnApplyCnt++;
+			}
 		});
+		
 		$(".maxdisc_amount").text("(-" + cpnDcSumAmt.addComma() + "원)");
+		$("#cpnApplyCnt").text(cpnApplyCnt + "장");
 	};
 	
+	// 쿠폰 선택없음 기능 구현
+	var cpnApplyDel = function(obj) {
+		// 쿠폰타입(상품쿠폰, 장바구니쿠폰, 배송비쿠폰)
+		var cpnType = obj.parent().parent().find("input[name='cpnType']").val();
+		
+		// 상품쿠폰적용
+		if (cpnType == "goodsCpn") {
+			// select box 쿠폰 적용
+			var cpnCartSq = obj.parent().parent().find("input[name='cpnCartSq']").val();
+			
+			// 장바구니시퀀스 체크
+			$("input[name='cartSq']").each(function(){
+				if (cpnCartSq == $(this).val()) {
+					$(this).parent().find("input[name='goodsCpnSq']").val("0");			// 상품쿠폰시퀀스
+					$(this).parent().find("input[name='goodsCpnDcAmt']").val("0");		// 상품쿠폰할인금액
+				}
+			});
+		}
+		// 장바구니쿠폰적용
+		else if (cpnType == "cartCpn") {
+			// 장바구니쿠폰 시퀀스 0, 장바구니할인금액 0
+			$("input[name='cartSq']").each(function(){
+				$(this).parent().find("input[name='cartCpnSq']").val("0");
+				$(this).parent().find("input[name='cartCpnDcAmt']").val("0");
+			});
+		}
+		// 배송비쿠폰적용
+		else if (cpnType == "delvCpn") {
+			
+		}
+		
+		obj.parent().parent().find("input[name='custCpnSq']").val("0");
+		obj.parent().parent().find("input[name='cpnDcAmt']").val("0");
+
+		obj.parent().parent().find(".select").text("선택없음");
+		obj.parent().parent().parent().parent().parent().find(".cp_discount").css("display", "none");
+		
+		// 쿠폰할인금액 SUM
+		custCpnSumAmtCal();
+		
+		// 최대할인혜택적용 체크해제
+		if ($("#chk-maxdisc").is(":checked")) {
+			$("#chk-maxdisc").attr("checked", false);
+		}
+	}
+	
 	// 사은품선택 라디오 버튼 기능
 	$(".freegiftRdo").on("click", function() {
 		var total_gift 		= 0;

+ 3 - 1
src/main/webapp/ux/pc/css/layout.css

@@ -1929,6 +1929,7 @@ body {min-width:1460px; overflow-x:auto;}
 	.pd_detail .area_pic.onlyitem .thumb_nav_wrap {display:none;}
 	.pd_detail .area_pic.onlyitem .thumb_list_wrap ul li {float:none; display:block; margin:0 auto;}
 	.pd_detail .area_pic.onlyitem .thumb_list_wrap ul li.on::after {display:none;}
+	
 
 
 	.pd_detail .item_detail .area_desc {float:right; /*position:relative;*/ width:510px;}
@@ -2229,6 +2230,7 @@ body {min-width:1460px; overflow-x:auto;}
 
 	.container .wrap .content.wide.pd_clickother {margin-top:120px;}
 
+	
 	/* pd_popup */
 	.modal.pd_pop dl div,
 	.modal.pd_pop dl dt,
@@ -3658,4 +3660,4 @@ body {min-width:1460px; overflow-x:auto;}
 		#quick_menu .category .quick_cate_txt {border-top: 1px solid #ddd; padding:30px;}
 		#quick_menu .category .quick_cate_txt a {display: inline-block; position: relative; font-size: 14px; color: #888; margin-right: 20px;}
 		#quick_menu .category .quick_cate_txt a:after {content:''; position: absolute; top: 2px; right: -12px; width: 1px; height: 8px; background: #ddd;}
-		#quick_menu .category .quick_cate_txt a:last-child:after {display: none;}
+		#quick_menu .category .quick_cate_txt a:last-child:after {display: none;}