<html lang="ko"
	  xmlns:th="http://www.thymeleaf.org">
<!--
 *******************************************************************************
 * @source  : cartListAjaxFormWeb
 * @desc	: 장바구니
 *============================================================================
 * STYLE24
 * Copyright(C) 2020 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE		 AUTHOR	  DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2021.02.02   xodud1202   최초 작성
 *******************************************************************************
 -->
<div id="cartAjaxArea">
	<form id="cartListForm" method="post" action="/order/noMember" th:with="imgGoodsUrl=${@environment.getProperty('upload.goods.view')}, uxImgUrl=${@environment.getProperty('domain.uximage')}, imgUrl=${@environment.getProperty('upload.image.view')}">
		<!--<input type="hidden" name="cartCpnDcAmt" id="cartCpnDcAmt" th:value="${param.cartCpnDcAmt}" />-->
		<input type="hidden" id="checkAbleCpnNm" value="N" />
		<input type="hidden" id="ableCpnNm" value="" />

		<!-- CONT-BODY -->
		<div>
			<div class="sec_head shotDelvSelect">
				<div class="tbl type4">
					<table>
						<colgroup>
							<col width="170">
							<col width="*">
						</colgroup>
						<tbody>
						<tr>
							<th>
								배송방법 선택
							</th>
							<td>
								<div class="form_field">
									<div>
										<input type="radio" name="shotDelvUseYn" id="blt_ship1" value="Y" th:checked="${order.shotDelvUseYn != null and order.shotDelvUseYn.equals('Y') and order.shotCartList.size() > 0}">
										<label for="blt_ship1"><span><em class="tag primary_line">총알배송</em><span th:text="|${order.shotDelvDt}일 24:00 까지 도착|"></span></span></label>
										<div class="tip_wrap tip1">
											<div class="tip_tit">?</div>
											<div class="tip_contents">
												<p class="tip_txt"></p><ul><li>총알배송 가능 지역인 경우에만 적용됩니다.</li></ul><p></p>
											</div>
										</div>
									</div>
									<div>
										<input type="radio" name="shotDelvUseYn" id="blt_ship2" value="N" th:checked="${order.shotDelvUseYn == null or !order.shotDelvUseYn.equals('Y') or order.shotCartList.size() < 1}">
										<label for="blt_ship2"><span>총알 배송 안함</span></label>
									</div>
								</div>
							</td>
						</tr>
						</tbody>
					</table>
				</div>
			</div>
			<div class="sec_body">
				<div class="sec_select">
					<div>
						<div class="form_field">
							<input id="od_item_all" type="checkbox" checked="checked"><label for="od_item_all"><span>전체선택</span></label>
						</div>
						<button type="button" class="btn btn_default btn_sm" onclick="deleteCart('SELECT', 'cart')"><span>선택삭제</span></button>
					</div>
				</div>

				<!-- 데이터 없을 시 -->
				<div class="nodata" th:if="${order.shotCartList.size() < 1 and order.wmsCartList.size() < 1 and order.delvCartList.size() < 1}">
					<div class="txt_box">
						<p>
							쇼핑백에 담긴 상품이 없습니다.
						</p>
					</div>
				</div>
				<!-- //데이터 없을 시 -->

				<div class="sec_part" th:if="${order.shotCartList.size() > 0 or order.wmsCartList.size() > 0}">
					<h3 class="subH2">
						STYLE24 배송
					</h3>
					<div class="area_part shotList" th:if="${order.shotCartList != null and order.shotCartList.size() > 0}">
						<h4 class="subH2">
							총알배송
							<span class="tit_info">오늘 자정까지 도착</span>
						</h4>
						<div class="part_goods">
							<div class="goods_cont">
								<!-- 주문상품 -->
								<th:block th:each="cart, status : ${order.shotCartList}">
									<div class="cartInfo goods_info shotCartInfo">
										<input type="hidden" name="supplyCompNm" value="WMS" />
										<input type="hidden" name="applyQtySectionYn" th:value="${cart.applyQtySectionYn}" />
										<input type="hidden" name="applyAmtSectionYn" th:value="${cart.applyAmtSectionYn}" />
										<input type="hidden" name="qtyTmtbSq" th:value="${cart.qtyTmtbSq}" />
										<input type="hidden" name="qtyTmtbNm" th:value="${cart.qtyTmtbNm}" />
										<input type="hidden" name="amtTmtbSq" th:value="${cart.amtTmtbSq}" />
										<input type="hidden" name="amtTmtbNm" th:value="${cart.amtTmtbNm}" />
										<input type="hidden" name="currPrice" th:value="${cart.currPrice}" />
										<input type="hidden" name="tmtbDcAmt" th:value="${cart.tmtbDcAmt}" />
										<input type="hidden" name="soldoutYn" th:value="${cart.soldoutYn}" />
										<input type="hidden" name="ordCanYn" th:value="${cart.ordCanYn}" />
										<input type="hidden" name="newCustCanYn" th:value="${cart.newCustCanYn}" />
										<input type="hidden" name="cartSq" th:value="${cart.cartSq}" />
										<input type="hidden" name="goodsCd" th:value="${cart.goodsCd}" />
										<input type="hidden" name="orgSavePntAmt" th:value="${cart.orgSavePntAmt}" />

										<div class="order_desc">
											<div class="form_box">
												<div class="form_field">
													<input th:id="|od_item_${cart.cartSq}|" name="cartSqArr" type="checkbox" th:value="${cart.cartSq}"
														   th:checked=   "${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.getGoodsQty() >= cart.getMinOrdQty() and cart.getGoodsQty() <= cart.getMaxOrdQty()}"
														   th:disabled="${!(cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.getGoodsQty() >= cart.getMinOrdQty() and cart.getGoodsQty() <= cart.getMaxOrdQty())}"/>
													<label th:for="|od_item_${cart.cartSq}|">
														<span class="sr-only">상품선택</span>
													</label>
												</div>
											</div>
											<div class="goods_box">
												<div class="gd_item">
													<a th:href="|javascript:fnGoToGoodsDetail('${cart.goodsCd}', '${cart.ordCanYn}')|">
														<span class="thumb" th:with="imgGoodsUrl=${@environment.getProperty('upload.goods.view')}, uxImgUrl=${@environment.getProperty('domain.uximage')}">
															<img th:src="${IMG_PATH} + '/' + ${cart.sysImgNm} + '?RS=100'" src="/" width="100%" th:onerror="'this.src=\''+@{${uxImgUrl}+ '/images/pc/thumb/bg_item_none.png'}+'\';'"  th:alt="${cart.sysImgNm}" alt="">
														</span>
														<p>
															<span class="brand" th:text="${cart.brandGroupNm}"></span>
														</p>
														<p>
															<span class="name" th:text="${cart.goodsNm}"></span>
														</p>
													</a>
												</div>
												<div class="gd_opt">
													<div class="option_wrap">
														<span class="title sr-only">주문 옵션</span>
														<th:block th:each="opt, index : ${cart.itemNmArr}">
															<th:block th:if="${cart.goodsType.equals('G056_S')}">
																<span class="option" th:text="${cart.itemNmArr[index.index]} + ' / ' + ${cart.colorNmArr[index.index]} + ' / ' + ${cart.optCd2Arr[index.index]}"></span>
															</th:block>
															<th:block th:if="${!cart.goodsType.equals('G056_S')}">
																<span class="option" th:text="${cart.colorNmArr[index.index]} + ' / ' + ${cart.optCd2Arr[index.index]}"></span>
															</th:block>
														</th:block>
													</div>
												</div>
												<div class="gd_calc">
													<p>
														<span class="count">수량&nbsp;<em th:text="${cart.goodsQty}"></em>개</span>
													</p>
												</div>
												<div class="gd_exinfo">
													<p th:if="${!#strings.isEmpty(cart.delvResDt)}"><span class="tag primary_line">총알배송</span><span th:text="|${cart.delvResDt} 배송예정|"></span></p>
													<p th:style="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'Y') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'Y') ? 'display:block' : 'display:none'}" class="applyTmtb"><span class="tag primary">SALE</span>다다익선 할인 적용</p>
													<p th:style="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'N') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'N') ? 'display:block' : 'display:none'}" class="notApplyTmtb"><a href="javascript:void(0);" onclick="fnGetTmtbSalesGoods(this);" class="btn_moresale"><span class="tag primary">SALE</span>다다익선 상품보기</a></p>
													<p th:if="${cart.soldoutYn.equals('Y') and cart.ordCanYn.equals('Y')}">품절된 상품입니다.</p>
													<p th:if="${cart.ordCanYn.equals('N')}">해당 상품은 구매 불가능한 상품입니다.</p>
													<p th:if="${cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('N')}">해당 상품은 신규회원만 구매 가능한 상품입니다.</p>
													<p th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.goodsQty < cart.minOrdQty}" th:text="|해당 상품은 최소 ${cart.minOrdQty}개부터 구매 가능합니다.|"></p>
													<p th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.maxOrdQty >= cart.ordCanQty and cart.goodsQty > cart.ordCanQty}" th:text="|해당 상품은 최대 ${cart.ordCanQty}개까지 구매 가능합니다.|"></p>
													<p th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.maxOrdQty < cart.ordCanQty and cart.goodsQty > cart.maxOrdQty}" th:text="|해당 상품은 최대 ${cart.maxOrdQty}개까지 구매 가능합니다.|"></p>
												</div>
											</div>
											<div class="calc_box">
												<th:block  th:if="${cart.tmtbDcAmt < cart.currPrice}">
													<p><span class="price_org"><em th:text="${#numbers.formatInteger(cart.currPrice, 1, 'COMMA')}"></em>원</span></p>
													<p><span class="price_sale"><em th:text="${#numbers.formatInteger(cart.tmtbDcAmt, 1, 'COMMA')}"></em>원</span></p>
												</th:block>
												<th:block th:if="${cart.tmtbDcAmt == cart.currPrice}">
													<p><span class="price_sale"><em th:text="${#numbers.formatInteger(cart.currPrice, 1, 'COMMA')}"></em>원</span></p>
												</th:block>
												<p>
													<span class="point">
														<em th:class="|point${cart.cartSq}|" th:text="${#numbers.formatInteger(cart.savePntAmt, 1, 'COMMA')}"></em><stong>P</stong>&nbsp;적립예정
													</span>
												</p>
											</div>
											<div class="button_box">
												<p th:if="${cart.soldoutYn.equals('Y') or cart.ordCanYn.equals('N') or cart.newCustCanYn.equals('N')}"><button type="button" class="btn btn_dark btn_sm" disabled=""><span>구매 불가</span></button></p>
												<p th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y')}"><button type="button" class="btn btn_primary btn_sm" th:onclick="|fnSubmitNoMember(${cart.cartSq})|"><span>바로 구매</span></button></p>

												<p><button type="button" class="btn btn_default btn_sm" th:onclick="|fnChangeCartOptCd(${cart.cartSq})|" th:disabled="${cart.ordCanYn.equals('N') or cart.newCustCanYn.equals('N')}"><span>옵션 / 수량 변경</span></button></p>
												<div class="util">
													<span>
														<button type="button" class="btn_favorite" th:classappend="${cart.wishCnt > 0} ? active" onclick="cfnPutWishList(this)" th:goodsCd="${cart.goodsCd}" th:goodsNm="${cart.goodsNm}" th:ithrCd="${cart.ithrCd}" th:contentsLoc="${cart.contentsLoc}" th:disabled="${cart.ordCanYn.equals('N') or cart.newCustCanYn.equals('N')}">
															<span><i class="ico ico_like2"></i><em class="sr-only">관심상품 추가</em></span>
														</button>
													</span>
													<span>
														<button type="button" class="btn_delete" th:onclick="|deleteCart(${cart.cartSq}, 'cart')|">
															<span><i class="ico ico_trash"></i><em class="sr-only">상품삭제</em></span>
														</button>
													</span>
												</div>
											</div>
										</div>
									</div>
								</th:block>
								<!-- //주문상품 -->
							</div>
						</div>
					</div>
					<div class="area_part wmsList" th:if="${order.wmsCartList != null and order.wmsCartList.size() > 0}">
						<h4 class="subH2">
							일반배송
						</h4>
						<div class="part_goods">
							<div class="goods_cont">
								<!-- 주문상품 -->
								<th:block th:each="cart, status : ${order.wmsCartList}">
									<div class="cartInfo goods_info wmsCartInfo">
										<input type="hidden" name="supplyCompNm" value="WMS" />
										<input type="hidden" name="applyQtySectionYn" th:value="${cart.applyQtySectionYn}" />
										<input type="hidden" name="applyAmtSectionYn" th:value="${cart.applyAmtSectionYn}" />
										<input type="hidden" name="qtyTmtbSq" th:value="${cart.qtyTmtbSq}" />
										<input type="hidden" name="qtyTmtbNm" th:value="${cart.qtyTmtbNm}" />
										<input type="hidden" name="amtTmtbSq" th:value="${cart.amtTmtbSq}" />
										<input type="hidden" name="amtTmtbNm" th:value="${cart.amtTmtbNm}" />
										<input type="hidden" name="currPrice" th:value="${cart.currPrice}" />
										<input type="hidden" name="tmtbDcAmt" th:value="${cart.tmtbDcAmt}" />
										<input type="hidden" name="soldoutYn" th:value="${cart.soldoutYn}" />
										<input type="hidden" name="ordCanYn" th:value="${cart.ordCanYn}" />
										<input type="hidden" name="newCustCanYn" th:value="${cart.newCustCanYn}" />
										<input type="hidden" name="cartSq" th:value="${cart.cartSq}" />
										<input type="hidden" name="goodsCd" th:value="${cart.goodsCd}" />
										<input type="hidden" name="orgSavePntAmt" th:value="${cart.orgSavePntAmt}" />

										<div class="order_desc">
											<div class="form_box">
												<div class="form_field">
													<input th:id="|od_item_${cart.cartSq}|" name="cartSqArr" type="checkbox" th:value="${cart.cartSq}"
														   th:checked=   "${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.getGoodsQty() >= cart.getMinOrdQty() and cart.getGoodsQty() <= cart.getMaxOrdQty()}"
														   th:disabled="${!(cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.getGoodsQty() >= cart.getMinOrdQty() and cart.getGoodsQty() <= cart.getMaxOrdQty())}"/>
													<label th:for="|od_item_${cart.cartSq}|">
														<span class="sr-only">상품선택</span>
													</label>
												</div>
											</div>
											<div class="goods_box">
												<div class="gd_item">
													<a th:href="|javascript:fnGoToGoodsDetail('${cart.goodsCd}', '${cart.ordCanYn}')|">
														<span class="thumb"><img th:src="${IMG_PATH} + '/' + ${cart.sysImgNm} + '?RS=100'" th:onerror="'this.src=\''+@{${uxImgUrl}+ '/images/pc/thumb/bg_item_none.png'}+'\';'" src="/" width="100%"  th:alt="${cart.sysImgNm}" alt=""></span>
														<p><span class="brand" th:text="${cart.brandGroupNm}"></span></p>
														<p><span class="name" th:text="${cart.goodsNm}"></span></p>
													</a>
												</div>
												<div class="gd_opt">
													<div class="option_wrap">
														<span class="title sr-only">주문 옵션</span>
														<th:block th:each="opt, index : ${cart.itemNmArr}">
															<th:block th:if="${cart.goodsType.equals('G056_S')}">
																<span class="option" th:text="${cart.itemNmArr[index.index]} + ' / ' + ${cart.colorNmArr[index.index]} + ' / ' + ${cart.optCd2Arr[index.index]}"></span>
															</th:block>
															<th:block th:if="${!cart.goodsType.equals('G056_S')}">
																<span class="option" th:text="${cart.colorNmArr[index.index]} + ' / ' + ${cart.optCd2Arr[index.index]}"></span>
															</th:block>
														</th:block>
													</div>
												</div>
												<div class="gd_calc">
													<p><span class="count">수량&nbsp;<em th:text="${cart.goodsQty}"></em>개</span></p>
												</div>
												<div class="gd_exinfo">
													<div class="gd_exinfo">
														<p th:if="${!#strings.isEmpty(cart.delvResDt)}" th:text="|${cart.delvResDt} 배송예정|"></p>
														<p th:style="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'Y') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'Y') ? 'display:block' : 'display:none'}" class="applyTmtb"><span class="tag primary">SALE</span>다다익선 할인 적용</p>
														<p th:style="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'N') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'N') ? 'display:block' : 'display:none'}" class="notApplyTmtb"><a href="javascript:void(0);" onclick="fnGetTmtbSalesGoods(this);" class="btn_moresale"><span class="tag primary">SALE</span>다다익선 상품보기</a></p>
														<p th:if="${cart.soldoutYn.equals('Y') and cart.ordCanYn.equals('Y')}">품절된 상품입니다.</p>
														<p th:if="${cart.ordCanYn.equals('N')}">해당 상품은 구매 불가능한 상품입니다.</p>
														<p th:if="${cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('N')}">해당 상품은 신규회원만 구매 가능한 상품입니다.</p>
														<p th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.goodsQty < cart.minOrdQty}" th:text="|해당 상품은 최소 ${cart.minOrdQty}개부터 구매 가능합니다.|"></p>
														<p th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.maxOrdQty >= cart.ordCanQty and cart.goodsQty > cart.ordCanQty}" th:text="|해당 상품은 최대 ${cart.ordCanQty}개까지 구매 가능합니다.|"></p>
														<p th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.maxOrdQty < cart.ordCanQty and cart.goodsQty > cart.maxOrdQty}" th:text="|해당 상품은 최대 ${cart.maxOrdQty}개까지 구매 가능합니다.|"></p>
													</div>
												</div>
											</div>
											<div class="calc_box">
												<th:block  th:if="${cart.tmtbDcAmt < cart.currPrice}">
													<p><span class="price_org"><em th:text="${#numbers.formatInteger(cart.currPrice, 1, 'COMMA')}"></em>원</span></p>
													<p><span class="price_sale"><em th:text="${#numbers.formatInteger(cart.tmtbDcAmt, 1, 'COMMA')}"></em>원</span></p>
												</th:block>
												<th:block th:if="${cart.tmtbDcAmt == cart.currPrice}">
													<p><span class="price_sale"><em th:text="${#numbers.formatInteger(cart.currPrice, 1, 'COMMA')}"></em>원</span></p>
												</th:block>
												<p>
													<span class="point">
														<em th:class="|point${cart.cartSq}|" th:text="${#numbers.formatInteger(cart.savePntAmt, 1, 'COMMA')}"></em><stong>P</stong>&nbsp;적립예정
													</span>
												</p>
											</div>
											<div class="button_box">
												<p th:if="${cart.soldoutYn.equals('Y') or cart.ordCanYn.equals('N') or cart.newCustCanYn.equals('N')}"><button type="button" class="btn btn_dark btn_sm" disabled=""><span>구매 불가</span></button></p>
												<p th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y')}"><button type="button" class="btn btn_primary btn_sm" th:onclick="|fnSubmitNoMember(${cart.cartSq})|"><span>바로 구매</span></button></p>

												<p><button type="button" class="btn btn_default btn_sm" th:onclick="|fnChangeCartOptCd(${cart.cartSq})|" th:disabled="${cart.ordCanYn.equals('N') or cart.newCustCanYn.equals('N')}"><span>옵션 / 수량 변경</span></button></p>
												<div class="util">
													<span>
														<button type="button" class="btn_favorite" th:classappend="${cart.wishCnt > 0} ? active" onclick="cfnPutWishList(this)" th:goodsCd="${cart.goodsCd}" th:goodsNm="${cart.goodsNm}" th:ithrCd="${cart.ithrCd}" th:contentsLoc="${cart.contentsLoc}" th:disabled="${cart.ordCanYn.equals('N')}">
															<span><i class="ico ico_like2"></i><em class="sr-only">관심상품 추가</em></span>
														</button>
													</span>
													<span>
														<button type="button" class="btn_delete" th:onclick="|deleteCart(${cart.cartSq}, 'cart')|">
															<span><i class="ico ico_trash"></i><em class="sr-only">상품삭제</em></span>
														</button>
													</span>
												</div>
											</div>
										</div>
									</div>
								</th:block>
								<!-- //주문상품 -->
							</div>
						</div>
					</div>

					<!-- 자사 배송비 -->
					<div class="goods_foot" style="margin-top:40px;" th:style="${'Y'.equals(order.delvYn) ? 'display:block' : 'display:none'}">
						<div class="order_delivery selfGoodsDelv" th:classappend="|delv_${order.cartDelvFeeCd}|">
							<span class="dlvr_fee delvFeeArea" th:if="${order.wmsDelvFee == 0}">배송비 무료</span>
							<span class="dlvr_fee delvFeeArea" th:if="${order.wmsDelvFee > 0}">배송비&nbsp;<em th:text="${#numbers.formatInteger(order.wmsDelvFee, 1, 'COMMA')}"></em>원</span>
							<a th:href="|javascript:fnGetDelvFeeSaveGoods('WMS', '${order.minOrdAmt - order.compSumPrice}');|" class="btn_popup_save btn_dlvrSave_pop" th:if="${order.wmsDelvFee > 0}">배송비 SAVE 상품 보기</a>
						</div>
					</div>
				</div>

				<div class="sec_part delvList" th:if="${order.delvCartList != null and order.delvCartList.size() > 0}">
					<h3 class="subH2">업체직배송</h3>
					<div class="area_part">
						<th:block th:each="cart, status : ${order.delvCartList}">
							<div class="part_goods">
								<div class="goods_cont">
									<!-- 주문상품 -->
									<div class="cartInfo goods_info delvCartInfo">
										<input type="hidden" name="supplyCompNm" th:value="${cart.supplyCompNm}" />
										<input type="hidden" name="applyQtySectionYn" th:value="${cart.applyQtySectionYn}" />
										<input type="hidden" name="applyAmtSectionYn" th:value="${cart.applyAmtSectionYn}" />
										<input type="hidden" name="qtyTmtbSq" th:value="${cart.qtyTmtbSq}" />
										<input type="hidden" name="qtyTmtbNm" th:value="${cart.qtyTmtbNm}" />
										<input type="hidden" name="amtTmtbSq" th:value="${cart.amtTmtbSq}" />
										<input type="hidden" name="amtTmtbNm" th:value="${cart.amtTmtbNm}" />
										<input type="hidden" name="currPrice" th:value="${cart.currPrice}" />
										<input type="hidden" name="soldoutYn" th:value="${cart.soldoutYn}" />
										<input type="hidden" name="ordCanYn" th:value="${cart.ordCanYn}" />
										<input type="hidden" name="newCustCanYn" th:value="${cart.newCustCanYn}" />
										<input type="hidden" name="tmtbDcAmt" th:value="${cart.tmtbDcAmt}" />
										<input type="hidden" name="cartSq" th:value="${cart.cartSq}" />
										<input type="hidden" name="goodsCd" th:value="${cart.goodsCd}" />
										<input type="hidden" name="orgSavePntAmt" th:value="${cart.orgSavePntAmt}" />

										<div class="order_desc">
											<div class="form_box">
												<div class="form_field">
													<input th:id="|od_item_${cart.cartSq}|" name="cartSqArr" type="checkbox" th:value="${cart.cartSq}"
														   th:checked=   "${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.getGoodsQty() >= cart.getMinOrdQty() and cart.getGoodsQty() <= cart.getMaxOrdQty()}"
														   th:disabled="${!(cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.getGoodsQty() >= cart.getMinOrdQty() and cart.getGoodsQty() <= cart.getMaxOrdQty())}"/>
													<label th:for="|od_item_${cart.cartSq}|">
														<span class="sr-only">상품선택</span>
													</label>
												</div>
											</div>
											<div class="goods_box">
												<div class="gd_item">
													<a th:href="|javascript:fnGoToGoodsDetail('${cart.goodsCd}', '${cart.ordCanYn}')|">
														<span class="thumb"><img th:src="${IMG_PATH} + '/' + ${cart.sysImgNm} + '?RS=100'" th:onerror="'this.src=\''+@{${uxImgUrl}+ '/images/pc/thumb/bg_item_none.png'}+'\';'" src="/" width="100%"  th:alt="${cart.sysImgNm}" alt=""></span>
														<p><span class="brand" th:text="${cart.brandGroupNm}"></span></p>
														<p><span class="name" th:text="${cart.goodsNm}"></span></p>
													</a>
												</div>
												<div class="gd_opt">
													<div class="option_wrap">
														<span class="title sr-only">주문 옵션</span>
														<th:block th:each="opt, index : ${cart.itemNmArr}">
															<th:block th:if="${cart.goodsType.equals('G056_S')}">
																<span class="option" th:text="${cart.itemNmArr[index.index]} + ' / ' + ${cart.colorNmArr[index.index]} + ' / ' + ${cart.optCd2Arr[index.index]}"></span>
															</th:block>
															<th:block th:if="${!cart.goodsType.equals('G056_S')}">
																<span class="option" th:text="${cart.colorNmArr[index.index]} + ' / ' + ${cart.optCd2Arr[index.index]}"></span>
															</th:block>
														</th:block>
													</div>
												</div>
												<div class="gd_calc">
													<p><span class="count">수량&nbsp;<em th:text="${cart.goodsQty}"></em>개</span></p>
												</div>
												<div class="gd_exinfo">
													<p th:if="${!#strings.isEmpty(cart.delvResDt)}" th:text="|${cart.delvResDt} 배송예정|"></p>
													<p th:style="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'Y') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'Y') ? 'display:block' : 'display:none'}" class="applyTmtb"><span class="tag primary">SALE</span>다다익선 할인 적용</p>
													<p th:style="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'N') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'N') ? 'display:block' : 'display:none'}" class="notApplyTmtb"><a href="javascript:void(0);" onclick="fnGetTmtbSalesGoods(this);" class="btn_moresale"><span class="tag primary">SALE</span>다다익선 상품보기</a></p>
													<p th:if="${cart.soldoutYn.equals('Y') and cart.ordCanYn.equals('Y')}">품절된 상품입니다.</p>
													<p th:if="${cart.ordCanYn.equals('N')}">해당 상품은 구매 불가능한 상품입니다.</p>
													<p th:if="${cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('N')}">해당 상품은 신규회원만 구매 가능한 상품입니다.</p>
													<p th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.goodsQty < cart.minOrdQty}" th:text="|해당 상품은 최소 ${cart.minOrdQty}개부터 구매 가능합니다.|"></p>
													<p th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.maxOrdQty >= cart.ordCanQty and cart.goodsQty > cart.ordCanQty}" th:text="|해당 상품은 최대 ${cart.ordCanQty}개까지 구매 가능합니다.|"></p>
													<p th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.maxOrdQty < cart.ordCanQty and cart.goodsQty > cart.maxOrdQty}" th:text="|해당 상품은 최대 ${cart.maxOrdQty}개까지 구매 가능합니다.|"></p>
												</div>
											</div>
											<div class="calc_box">
												<th:block  th:if="${cart.tmtbDcAmt < cart.currPrice}">
													<p><span class="price_org"><em th:text="${#numbers.formatInteger(cart.currPrice, 1, 'COMMA')}"></em>원</span></p>
													<p><span class="price_sale"><em th:text="${#numbers.formatInteger(cart.tmtbDcAmt, 1, 'COMMA')}"></em>원</span></p>
												</th:block>
												<th:block th:if="${cart.tmtbDcAmt == cart.currPrice}">
													<p><span class="price_sale"><em th:text="${#numbers.formatInteger(cart.currPrice, 1, 'COMMA')}"></em>원</span></p>
												</th:block>
												<p>
													<span class="point">
														<em th:class="|point${cart.cartSq}|" th:text="${#numbers.formatInteger(cart.savePntAmt, 1, 'COMMA')}"></em><stong>P</stong>&nbsp;적립예정
													</span>
												</p>
											</div>
											<div class="button_box">
												<p th:if="${cart.soldoutYn.equals('Y') or cart.ordCanYn.equals('N') or cart.newCustCanYn.equals('N')}"><button type="button" class="btn btn_dark btn_sm" disabled=""><span>구매 불가</span></button></p>
												<p th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y')}"><button type="button" class="btn btn_primary btn_sm" th:onclick="|fnSubmitNoMember(${cart.cartSq})|"><span>바로 구매</span></button></p>

												<p><button type="button" class="btn btn_default btn_sm" th:onclick="|fnChangeCartOptCd(${cart.cartSq})|" th:disabled="${cart.ordCanYn.equals('N') or cart.newCustCanYn.equals('N')}"><span>옵션 / 수량 변경</span></button></p>
												<div class="util">
													<span>
														<button type="button" class="btn_favorite" th:classappend="${cart.wishCnt > 0} ? active" onclick="cfnPutWishList(this)" th:goodsCd="${cart.goodsCd}" th:goodsNm="${cart.goodsNm}" th:ithrCd="${cart.ithrCd}" th:contentsLoc="${cart.contentsLoc}" th:disabled="${cart.ordCanYn.equals('N')}">
															<span><i class="ico ico_like2"></i><em class="sr-only">관심상품 추가</em></span>
														</button>
													</span>
													<span>
														<button type="button" class="btn_delete" th:onclick="|deleteCart(${cart.cartSq}, 'cart')|">
															<span><i class="ico ico_trash"></i><em class="sr-only">상품삭제</em></span>
														</button>
													</span>
												</div>
											</div>
										</div>
									</div>
									<!-- //주문상품 -->
								</div>

								<!-- 입점업체 배송비 -->
								<div class="goods_foot" th:if="${'Y'.equals(cart.addDelvFeeYn)}" th:style="${'Y'.equals(cart.delvYn) ? 'display:block' : 'display:none'}">
								<!-- <div class="goods_foot" th:if="${cart.compCnt == status.index + 1}"> -->
									<div class="order_delivery" th:classappend="|delv_${cart.delvFeeCd}|">
										<span class="dlvr_fee delvFeeArea" th:if="${cart.delvFee == 0}">배송비 무료</span>
										<span class="dlvr_fee delvFeeArea" th:if="${cart.delvFee > 0}">배송비&nbsp;<em th:text="${#numbers.formatInteger(cart.delvFee, 1, 'COMMA')}"></em>원</span>
										<span class="dlvr_shop"><em th:text="${cart.supplyCompNm}"></em>&nbsp;업체직배송</span>
										<a th:href="|javascript:fnGetDelvFeeSaveGoods('${cart.delvFeeCd}', '${cart.minOrdAmt - cart.compSumPrice}');|" class="btn_popup_save btn_dlvrSave_pop" th:if="${cart.delvFee > 0 and cart.delvFeeCrite != 'G078_30'}">배송비 SAVE 상품 보기</a>
									</div>
								</div>
							</div>
						</th:block>
					</div>
				</div>
			</div>
		</div>
<!--		<div class="od_side">-->
<!--			<div class="area_order">-->
<!--				<div class="tit_box">-->
<!--					<h3>결제 정보</h3>-->
<!--					<span><em class="number checkSelectCartListCnt" th:text="${order.totCartCnt}"></em>개의 상품</span>-->
<!--				</div>-->
<!--				<div class="od_amount_box">-->
<!--					<dl>-->
<!--						<div>-->
<!--							<dt>상품금액</dt>-->
<!--							<dd><em class="sumListPrice" th:text="${#numbers.formatInteger(order.sumListPrice, 1, 'COMMA')}"></em>원</dd>-->
<!--						</div>-->
<!--						<div>-->
<!--							<dt>배송비</dt>-->
<!--							<dd><em class="totDelvFee" th:text="${#numbers.formatInteger(order.totDelvFee, 1, 'COMMA')}"></em> 원</dd>-->
<!--						</div>-->
<!--						<div>-->
<!--							<dt>할인금액</dt>-->
<!--							<dd><span class="disc_amount"><em class="totDcAmt" id="totDcAmt" th:text="${#numbers.formatInteger(order.totDcAmt, 1, 'COMMA')}"></em> 원</span></dd>-->
<!--						</div>-->
<!--					</dl>-->
<!--				</div>-->
<!--				<div class="totalprice_box">-->
<!--					<dl>-->
<!--						<dt>총 결제 예정 금액</dt>-->
<!--						<dd><span class="sumRealPayAmt" id="sumRealPayAmt" th:text="${#numbers.formatInteger(order.sumRealPayAmt + order.totDelvFee, 1, 'COMMA')}"></span> 원</dd>-->
<!--					</dl>-->
<!--				</div>-->
<!--				<div class="btn_box">-->
<!--					<button class="btn btn_primary btn_block btn_md" onclick="fnSubmitNoMember('all'); return false;"><span>구매하기</span></button>-->
<!--				</div>-->
<!--			</div>-->
<!--			<div class="area_salecoupon">-->
<!--				<h4>할인코드 입력</h4>-->
<!--				<div class="form_field">-->
<!--					<div class="input_wrap form_full">-->
<!--						<label class="input_label sr-only">할인코드입력</label>-->
<!--						<input type="text" id="serialCpnNm" class="form_control" placeholder="할인코드를 입력해주세요.">-->
<!--					</div>-->
<!--					<button type="button" class="btn btn_dark btn_sm" onclick="serialCpnApply()"><span>적용</span></button>-->
<!--				</div>-->
<!--				<div class="coupon_box">-->
<!--					<div class="coupon">-->
<!--						<div>-->
<!--							<p class="cp_name"></p>-->
<!--							<p class="cp_cont">-->
<!--								&lt;!&ndash;<span><em>12,399,900</em>원</span>-->
<!--								<span><em>40</em>%</span>&ndash;&gt;-->
<!--								<span class="cp_dc_val"></span>-->
<!--							</p>-->
<!--							<p class="cp_condition">-->
<!--								&lt;!&ndash;500,000원 이상 구매 시 최대 50,000원 할인-->
<!--								<span><em class="tag primary_line">99장 보유</em></span>&ndash;&gt;-->
<!--							</p>-->
<!--						</div>-->
<!--						<p class="cp_date">-->
<!--							<span class="availStdt"></span>&nbsp;~&nbsp;<span class="availEddt"></span>-->
<!--						</p>-->
<!--					</div>-->
<!--					<button type="button" class="btn_underline" id="btn_cartCouponInfo_pop">-->
<!--						<span>사용안내</span>-->
<!--					</button>-->
<!--				</div>-->
<!--			</div>-->
<!--		</div>-->
		<div class="clear"></div>
		<!-- // CONT-BODY -->
	</form>

	<!-- 옵션변경 팝업 -->
	<div class="modal fade optModify_pop" id="optModifyPop" tabindex="-1" role="dialog" aria-labelledby="optModifyLabel" aria-hidden="true"></div>
	<!-- //옵션변경 팝업 -->

	<!-- 즉시구매 form -->
	<form id="cartInfoForm" method="post" action="/order/noMember"></form>

	<!-- 쿠폰사용안내 팝업 -->
	<div class="modal fade couponInfo_pop cartCpnInfoModal" id="couponInfoPop" tabindex="-1" role="dialog" aria-labelledby="couponInfoLabel" aria-hidden="true">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<h5 class="modal-title" id="couponInfoLabel"></h5>
				</div>
				<div class="modal-body">
					<div class="pop_cont">
						<dl>
							<div class="cartCpnCondition">
								<dt>사용조건</dt>
								<dd class="cpnCondition"></dd>
							</div>
							<div class="cartCpnPubLimitQty">
								<dt>발급수량</dt>
								<dd class="custPubLimitQtyTxt"></dd>
							</div>
							<div>
								<dt>유효기간</dt>
								<dd class="availDt"></dd>
							</div>
							<div>
								<dt>대상조건</dt>
								<dd class="refVal"></dd>
							</div>
						</dl>
					</div>
				</div>
			</div>
		</div>
		<a href="#close-modal" rel="modal:close" id="couponInfoPop_close" class="close-modal">Close</a>
	</div>
	<!-- //쿠폰사용안내 팝업 -->

	<script th:inline="javascript">
		let sumRealPayAmt = [[${order.sumRealPayAmt + order.totDelvFee}]];
		let totDcAmt = [[${order.totDcAmt}]];
		let checkSelectCartListCnt = [[${order.totCartCnt}]];
		let sumListPrice = [[${order.sumListPrice}]];
		let totDelvFee = [[${order.totDelvFee}]];
		let shotCartList = [[${order.shotCartList}]];
		let wmsCartList = [[${order.wmsCartList}]];
		let delvCartList = [[${order.delvCartList}]];
		let loginInfo = new Object();
		let orderFlag = true;

		function setLoginInfo() {
			gagajf.ajaxJsonSubmit("/cart/login/info", null, function (result) {
				loginInfo = result;

				if (!loginInfo || loginInfo.custNo == null || loginInfo.custNo == 0) {
					$("#cartListForm .area_salecoupon").hide();
				}
			});
		};

		$(document).ready(function() {
			setLoginInfo();

			if([[${!order.shotCanYn.equals('Y')}]]) {
				$(".shotDelvSelect").hide();
			}

			$(".area_salecoupon .coupon_box").hide();

			$('.checkSelectCartListCnt').text(checkSelectCartListCnt.addComma());
			$('.sumListPrice').text(sumListPrice.addComma());
			$('.totDelvFee').text(totDelvFee.addComma());
			$('#totDcAmt').text(totDcAmt.addComma());
			$('#sumRealPayAmt').text(sumRealPayAmt.addComma());
			
			if (shotCartList.length > 0 || wmsCartList.length > 0 || delvCartList.length > 0) {
				$('.od_side').css('display', '');
			}

			/* 딜 및 일반 상품 */
			/*let compsList = [];
			let temp 			= new Object;
			temp.goodsCd 		= "AOW13QDM76";
			temp.optCd 			= "13256848-2";
			temp.goodsQty 		= 3;
			temp.goodsType 		= "G056_N";
			temp.cartGb 		= "C";
			temp.afLinkCd 		= "afLinkCd";
			temp.ithrCd 		= "G027_ZZZ";
			temp.contentsLoc 	= "G028_YYY";
			temp.planDtlSq 		= "123";
			compsList.push(temp);

			temp 				= new Object;
			temp.goodsCd 		= "AOW13QDM76";
			temp.optCd 			= "13256848-6";
			temp.goodsQty 		= 3;
			temp.goodsType 		= "G056_N";
			temp.cartGb 		= "C";
			temp.afLinkCd 		= "afLinkCd";
			temp.ithrCd 		= "G027_ZZZ";
			temp.contentsLoc 	= "G028_YYY";
			temp.planDtlSq 		= "123";
			compsList.push(temp);

			cfnAddCart(compsList);*/

			/* 세트상품 장바구니 */
			/*let goodsList = {
				cartCompsList : new Array()
			}
			let cartGoodsList = [];

			let compsList = [];
			let temp = new Object;
			temp.goodsCd = "STYS00000009";
			temp.itemCd = "ELW23ZVE83";
			temp.optCd = "13520522-3";
			temp.goodsQty = 3;
			temp.goodsType = "G056_S";
			temp.cartGb = "G";
			temp.afLinkCd = "aaaa";
			temp.ithrCd = "12311";
			temp.contentsLoc = "afasd";
			temp.planDtlSq = "44";
			compsList.push(temp);
			temp = new Object;
			temp.goodsCd = "STYS00000009";
			temp.itemCd = "EMF11QPT46";
			temp.optCd = "10195722-4";
			temp.goodsQty = 3;
			temp.goodsType = "G056_S";
			temp.cartGb = "G";
			temp.afLinkCd = "aaaa";
			temp.ithrCd = "12311";
			temp.contentsLoc = "afasd";
			temp.planDtlSq = "44";
			compsList.push(temp);
			temp = new Object;
			temp.goodsCd = "STYS00000009";
			temp.itemCd = "EMF11QTS37";
			temp.optCd = "10702803-2";
			temp.goodsQty = 3;
			temp.goodsType = "G056_S";
			temp.cartGb = "G";
			temp.afLinkCd = "aaaa";
			temp.ithrCd = "12311";
			temp.contentsLoc = "afasd";
			temp.planDtlSq = "44";
			compsList.push(temp);

			goodsList.cartCompsList = compsList;
			cartGoodsList.push(goodsList);

			let compsList2 = [];
			let goodsList2 = {
				cartCompsList : new Array()
			}
			temp = new Object;
			temp.goodsCd = "STYS00000009";
			temp.itemCd = "ELW23ZVE83";
			temp.optCd = "13520522-1";
			temp.goodsQty = 2;
			temp.goodsType = "G056_S";
			temp.cartGb = "G";
			temp.afLinkCd = "aaaa";
			temp.ithrCd = "12311";
			temp.contentsLoc = "afasd";
			temp.planDtlSq = "44";
			compsList2.push(temp);
			temp = new Object;
			temp.goodsCd = "STYS00000009";
			temp.itemCd = "EMF11QPT46";
			temp.optCd = "10195722-2";
			temp.goodsQty = 2;
			temp.goodsType = "G056_S";
			temp.cartGb = "G";
			temp.afLinkCd = "aaaa";
			temp.ithrCd = "12311";
			temp.contentsLoc = "afasd";
			temp.planDtlSq = "44";
			compsList2.push(temp);
			temp = new Object;
			temp.goodsCd = "STYS00000009";
			temp.itemCd = "EMF11QTS37";
			temp.optCd = "10702803-1";
			temp.goodsQty = 2;
			temp.goodsType = "G056_S";
			temp.cartGb = "G";
			temp.afLinkCd = "aaaa";
			temp.ithrCd = "12311";
			temp.contentsLoc = "afasd";
			temp.planDtlSq = "44";
			compsList2.push(temp);

			goodsList2.cartCompsList = compsList2;
			cartGoodsList.push(goodsList2);

			cfnAddCart(cartGoodsList);*/
		});

		function cancelCartCpn() {
			$("#cartListForm #sumRealPayAmt").text(Number(sumRealPayAmt).toLocaleString());
			$("#cartListForm #totDcAmt").text(Number(totDcAmt).toLocaleString());
			$("#cartListForm .area_salecoupon .coupon_box").hide();
		}

		function serialCpnApply() {
			let cartArr = [];
			let currPrices = [];
			let rdCpnNm = $("#cartListForm #serialCpnNm").val();

			if(!$("#serialCpnNm").val()) {
				mcxDialog.alert("할인코드를 입력해주세요.");
				return false;
			}

			$("#cartListForm input[name=cartSqArr]:checked").each(function(index, item) {
				cartArr.push($(this).val());
				currPrices.push($(this).parents(".cartInfo").find("input[name=tmtbDcAmt]").val());
			});

			if(!$("#cartListForm #serialCpnNm").val()) {
				mcxDialog.alert("할인코드를 입력해주세요.");
				return false;
			}

			let data = {
				rdCpnNm : $("#cartListForm #serialCpnNm").val(),
				cartSqArr : cartArr,
				currPrices : currPrices
			}

			let jsonData = JSON.stringify(data);

			$.ajax( {
				type: "POST",
				url : '/cart/list/serialCpnApply',
				contentType: 'application/json',
				dataType : 'json',
				data : jsonData,
				success : function(result) {
					if(result.serialCpnInfo.result == "SUCCESS") {
						let cpnInfo = result.serialCpnInfo;
						$("#cartListForm .area_salecoupon .coupon_box").show();

						// 합계 금액
						if(cartArr.length > 0) {
							$("#cartListForm #sumRealPayAmt").text(Number(sumRealPayAmt - cpnInfo.dcAmt).toLocaleString());
							$("#cartListForm #totDcAmt").text(Number(totDcAmt - cpnInfo.dcAmt).toLocaleString());
						}

						// 쿠폰 정보
						$("#cartListForm .area_salecoupon .cp_name").text(cpnInfo.cpnNm);
						$("#cartListForm .area_salecoupon .cp_condition").html(cpnInfo.cpnDesc + "<span><em class='tag'>1장 보유</em></span>");
						$("#cartListForm .area_salecoupon .availStdt").text(cpnInfo.availStdt);
						$("#cartListForm .area_salecoupon .availEddt").text(cpnInfo.availEddt);
						if (cpnInfo.dcWay == "G240_10") {
							$("#cartListForm .area_salecoupon .cp_dc_val").html("<em>" + Number(cpnInfo.dcVal).toLocaleString() + "</em> 원");
						} else if (cpnInfo.dcWay == "G240_11") {
							$("#cartListForm .area_salecoupon .cp_dc_val").html("<em>" + cpnInfo.dcVal + "%</em>");
						}

						let conditionComment = "", refValComment = "";

						if(cpnInfo.buyLimitAmt > 0) { conditionComment += "<span>" + Number(cpnInfo.buyLimitAmt).toLocaleString() + "</span>원 이상 구매 시 "; }
						if(cpnInfo.maxDcAmt > 0) { conditionComment += "최대 <span>" +  Number(cpnInfo.maxDcAmt).toLocaleString() + "</span>원 할인"; }

						if("A" == cpnInfo.applyScope) {
							refValComment += "전체<br/>";
						} else {
							if(cpnInfo.refCateCnt > 0) {
								refValComment += cpnInfo.refCateNm + " 카테고리";
								if(cpnInfo.refCateCnt > 1) { refValComment += " 外"; }
								refValComment += "<br/>";
							}
							if(cpnInfo.refSupplyCompCnt > 0) {
								refValComment += cpnInfo.refSupplyCompNm + " 업체";
								if(cpnInfo.refSupplyCompCnt > 1) { refValComment += " 外"; }
								refValComment += "<br/>";
							}
							if(cpnInfo.refBrandCnt > 0) {
								refValComment += cpnInfo.refBrandNm;
								refValComment += " 브랜드";
								if(cpnInfo.refBrandCnt > 2) { refValComment += " 外"; }
								refValComment += "<br/>";
							}
							if(cpnInfo.refGoodsCnt > 0) {
								refValComment += cpnInfo.refGoodsNm + " 상품";
								if(cpnInfo.refGoodsCnt > 1) { refValComment += " 外"; }
								refValComment += "<br/>";
							}
						}
						refValComment += "일부상품, 특가상품 제외";

						$(".cartCpnInfoModal .modal-header").html('<h5 class="modal-title" id="couponInfoLabel">' + cpnInfo.cpnNm + '</h5>');

						if(conditionComment != "") { $(".cartCpnInfoModal .cpnCondition").html(conditionComment); }
						else { $(".cartCpnInfoModal .cartCpnCondition").hide(); }

						if(cpnInfo.custPubLimitQty > 0) { $(".cartCpnInfoModal .custPubLimitQtyTxt").html("1인 최대 <span>" + Number(cpnInfo.custPubLimitQty).toLocaleString() + "</span>매"); }
						else { $(".cartCpnInfoModal .cartCpnPubLimitQty").hide(); }

						$(".cartCpnInfoModal .availDt").html('<span>' + cpnInfo.availStdtTime + "</span> ~ <span>" + cpnInfo.availEddtTime + "</span>");
						$(".cartCpnInfoModal .refVal").html(refValComment);

						if(cpnInfo.downloadCnt > 0) {
							mcxDialog.alert("성공적으로 등록되었습니다.");
						}

						$("#cartListForm #checkAbleCpnNm").val("Y");
						$("#cartListForm #ableCpnNm").val(rdCpnNm);
					} else {
						$("#cartListForm #checkAbleCpnNm").val("N");
						$("#cartListForm #ableCpnNm").val("");
						mcxDialog.alert(result.serialCpnInfo.result);
					}
				}
			});
		}

		//다다익선 적용내역 보기
		$(document).on('click','.shopping_bag .part_deliver .btn_moresale',function(e){
			$(this).toggleClass('active');
			$(this).parents('.od_moresale').find('.li_moresale').toggle();
			return false;
		});

		//관심상품 등록
		$(document).on('click','.shopping_bag .part_deliver .btn_favorite',function(e){
			$(this).toggleClass('active');
			return false;
		});

		$("input[name=cartSqArr]").on("change", function(e) {
			changeCartSqArr();
		});

		function changeCartSqArr() {
			let cartArr = [];

			// 선택된 장바구니 번호
			$("#cartListForm input[name=cartSqArr]:checked").each(function () {
				cartArr.push($(this).val());
			});

			if(cartArr.length == 0) {
				cartArr.push(0);
				$("#cartListForm .goods_foot .btn_popup_save").hide();
			}

			// 선택된 장바구니 정보 가공
			let data = {	cartSqArr : cartArr, shotDelvUseYn : $("input[name=shotDelvUseYn]:checked").val() }
			let jsonData = JSON.stringify(data);

			$.ajax( {
				type: "POST",
				url : '/cart/change/goods/list',
				contentType: 'application/json',
				dataType : 'json',
				data : jsonData,
				success : function(result) {
					fnChangeCartListInfo(result);
				}
			});
		}

		function fnChangeCartListInfo(order) {
			let shotList = order.shotCartList;
			let wmsList = order.wmsCartList;
			let delvList = order.delvCartList;
			let cartList = new Array();

			// 다다익선 정보 숨김
			$("#cartListForm .applyTmtb").hide();
			$("#cartListForm .notApplyTmtb").hide();

			// 배송비 정보 0원으로 모두 변경 (체크 되지 않은 업체는 0원처리)
			$("#cartListForm .goods_foot .delvFeeArea").text("배송비 0원");

			// 장바구니 각 상품 가격 정보 할인 전으로 변경
			$("#cartListForm .cartInfo input[name=cartSq]").each(function() {
				if($(this).parent().find(".calc_box .price_org").text() != "") {
					$(this).parent().find(".calc_box .price_sale").text($(this).parent().find(".calc_box .price_org").text());
					$(this).parent().find(".calc_box .price_org").remove();
				}

				$(this).parent().find(".calc_box .point" + $(this).val()).text(Number($(this).parent().find("input[name=orgSavePntAmt]").val()).toLocaleString());
			});

			// $("#cartListForm").find(".delvFeeArea").html("<div class='info_dlvr'><span class='dlvr_fee'>배송비 무료</span></div>");
			for(let i = 0 ; i < shotList.length ; i++) {
				$("#cartListForm .shotCartInfo input[name=cartSq]").each(function() {
					if(shotList[i].cartSq == $(this).val()) {
						let shot = shotList[i];
						$(this).parent().find("input[name=applyQtySectionYn]").val(shot.applyQtySectionYn);
						$(this).parent().find("input[name=applyAmtSectionYn]").val(shot.applyAmtSectionYn);
						$(this).parent().find(".calc_box .point>em").text(Number(shot.savePntAmt).toLocaleString());

						// 다다익선 적용 정보 생성성
						if((shot.qtyTmtbSq > 0 && shot.applyQtySectionYn == "Y") || shot.amtTmtbSq > 0 && shot.applyAmtSectionYn == "Y") {
							$(this).parent().find(".applyTmtb").show();
						}
						if((shot.qtyTmtbSq > 0 && shot.applyQtySectionYn == "N") || shot.amtTmtbSq > 0 && shot.applyAmtSectionYn == "N") {
							$(this).parent().find(".notApplyTmtb").show();
						}

						// 다다익선 할인가 적용
						if(shot.tmtbDcAmt < shot.currPrice) {
							$(this).parent().find(".calc_box .price_sale").text(Number(shot.tmtbDcAmt).toLocaleString() + " 원");
							$(this).parent().find(".calc_box").prepend("<p><span class='price_org'><em>" + Number(shot.currPrice).toLocaleString() + "</em>원</span></p>");
							$(this).parent().find("input[name=tmtbDcAmt]").val(shot.tmtbDcAmt);
						}
					}
				});
			}

			// 자사 상품 배송비
			if(order.delvYn == "Y") {
				if (order.wmsDelvFee == 0) {
					$(".selfGoodsDelv").html("<span class='dlvr_fee delvFeeArea'>배송비 무료</span>");
				} else {
					let html = "<span class='dlvr_fee delvFeeArea'>배송비 <em>" + Number(order.wmsDelvFee).toLocaleString() + "</em> 원</span><a href=\"javascript:fnGetDelvFeeSaveGoods('WMS', '" + (order.minOrdAmt - order.compSumPrice) + "');\" class='btn_popup_save btn_dlvrSave_pop'>배송비 SAVE 상품 보기</a>";
					$(".selfGoodsDelv").html(html);
				}
			}

			for(let i = 0 ; i < wmsList.length ; i++) {
				$("#cartListForm .wmsCartInfo input[name=cartSq]").each(function() {
					if(wmsList[i].cartSq == $(this).val()) {
						let wms = wmsList[i];
						$(this).parent().find("input[name=applyQtySectionYn]").val(wms.applyQtySectionYn);
						$(this).parent().find("input[name=applyAmtSectionYn]").val(wms.applyAmtSectionYn);
						$(this).parent().find(".calc_box .point>em").text(Number(wms.savePntAmt).toLocaleString());

						// 다다익선 적용 정보 생성성
						if((wms.qtyTmtbSq > 0 && wms.applyQtySectionYn == "Y") || (wms.amtTmtbSq > 0 && wms.applyAmtSectionYn == "Y")) {
							$(this).parent().find(".applyTmtb").show();
						}
						if((wms.qtyTmtbSq > 0 && wms.applyQtySectionYn == "N") || (wms.amtTmtbSq > 0 && wms.applyAmtSectionYn == "N")) {
							$(this).parent().find(".notApplyTmtb").show();
						}

						// 다다익선 할인가 적용
						if(wms.tmtbDcAmt < wms.currPrice) {
							$(this).parent().find(".calc_box .price_sale").text(Number(wms.tmtbDcAmt).toLocaleString() + " 원");
							$(this).parent().find(".calc_box").prepend("<p><span class='price_org'><em>" + Number(wms.currPrice).toLocaleString() + "</em>원</span></p>");
							$(this).parent().find("input[name=tmtbDcAmt]").val(wms.tmtbDcAmt);
						}
					}
				});
			}

			for(let i = 0 ; i < delvList.length ; i++) {
				$("#cartListForm .delvList .delvCartInfo input[name=cartSq]").each(function() {
					if(delvList[i].cartSq == $(this).val()) {
						let delv = delvList[i];
						$(this).parent().find("input[name=applyQtySectionYn]").val(delv.applyQtySectionYn);
						$(this).parent().find("input[name=applyAmtSectionYn]").val(delv.applyAmtSectionYn);
						$(this).parent().find(".calc_box .point>em").text(Number(delv.savePntAmt).toLocaleString());

						// 다다익선 적용 정보 생성성
						if((delv.qtyTmtbSq > 0 && delv.applyQtySectionYn == "Y") || (delv.amtTmtbSq > 0 && delv.applyAmtSectionYn == "Y")) {
							$(this).parent().find(".applyTmtb").show();
						}
						if((delv.qtyTmtbSq > 0 && delv.applyQtySectionYn == "N") || (delv.amtTmtbSq > 0 && delv.applyAmtSectionYn == "N")) {
							$(this).parent().find(".notApplyTmtb").show();
						}

						// 다다익선 할인가 적용
						if(delv.tmtbDcAmt < delv.currPrice) {
							$(this).parent().find(".calc_box .price_sale").text(Number(delv.tmtbDcAmt).toLocaleString() + " 원");
							$(this).parent().find(".calc_box").prepend("<p><span class='price_org'><em>" + Number(delv.currPrice).toLocaleString() + "</em>원</span></p>");
							$(this).parent().find("input[name=tmtbDcAmt]").val(delv.tmtbDcAmt);
						}

						// 입점업체 배송비 목록
						if(delv.delvFee == 0) {
							$(".delvList").find(".delv_" + delv.delvFeeCd).html("<span class='dlvr_fee delvFeeArea'>배송비 무료</span><span class='dlvr_fee'><em>" + delv.supplyCompNm + "</em> 업체직배송</span>");
						} else {
							let html = "<span class='dlvr_fee delvFeeArea'>배송비 <em>" + Number(delv.delvFee).toLocaleString() + "</em>원</span><span class='dlvr_shop'><em>" + delv.supplyCompNm + "</em> 업체직배송</span><a href=\"javascript:fnGetDelvFeeSaveGoods('" + delv.delvFeeCd + "','" + (delv.minOrdAmt - delv.compSumPrice) +  "');\" class='btn_popup_save btn_dlvrSave_pop'>배송비 SAVE 상품 보기</a>";
							$(".delvList").find(".delv_" + delv.delvFeeCd).html(html);
						}
					}
				});
			}

			// 결제 총액 영역 수정
			$(".checkSelectCartListCnt").text(Number(order.totCartCnt).toLocaleString());
			$(".sumListPrice").text(Number(order.sumListPrice).toLocaleString());
			$(".totDelvFee").text(Number(order.totDelvFee).toLocaleString());
			sumRealPayAmt = order.sumRealPayAmt + order.totDelvFee;
			totDcAmt = order.totDcAmt;

			// 할인코드 쿠폰 금액 재확인
			if($("#serialCpnNm").val()) {
				if($("#checkAbleCpnNm").val() == "Y" && $("#ableCpnNm").val() == $("#serialCpnNm").val()) {
					serialCpnApply();
				} else {
					$(".totDcAmt").text(Number(order.totDcAmt).toLocaleString());
					$(".sumRealPayAmt").text(Number(order.sumRealPayAmt + order.totDelvFee).toLocaleString());
					cancelCartCpn();
				}
			} else {
				$(".totDcAmt").text(Number(order.totDcAmt).toLocaleString());
				$(".sumRealPayAmt").text(Number(order.sumRealPayAmt + order.totDelvFee).toLocaleString());
				cancelCartCpn();
			}
		}

		//옵션변경 팝업열기
		function fnChangeCartOptCd(cartSq) {
			$.ajax( {
				type: "POST",
				url : '/cart/goods/info',
				dataType : 'html',
				data : {cartSq : cartSq},
				success : function(result) {
					$("#cartOptionModal").remove();
					$("#optModifyPop").html(result);
					$("#optModifyPop").modal("show");
				}
			});
		}

		// 주문 정보 체크
		function fnOrderValidation(list, listIndex, cartSqArr, allYn) {
			// listIndex가 -1이면 (마지막이 지난후)
			if(listIndex ==  -1) {
				// 광고스크립트
				if(orderFlag) {
					var fbqContents = [];
					var enlipleItems = [];
					var totalCnt = 0;

					for (var i=0; i < list.length; i++) {
						var item = list[i];
						fbqContents.push({id: item.goodsCd, quantity: item.goodsQty + ''});
						enlipleItems.push({productCode: item.goodsCd, productName: item.goodsNm, price: item.listPrice + '', dcPrice: item.currPrice + '', qty: item.goodsQty + ''});
						totalCnt += item.goodsQty;
					}

					fbq('track', 'InitiateCheckout', {
						value: sumRealPayAmt,
						currency: 'KRW',
						contents: fbqContents
					});
				}

				if(allYn == "Y" && orderFlag) {
					$("#cartListForm").submit();
				} else {
					if(orderFlag) {
						let html	 = "<input type='hidden' name='cartSqArr' value='" + cartSqArr + "' />";
						html		+= "<input type='hidden' name='shotDelvUseYn' value='" + $("input[name=shotDelvUseYn]:checked").val() + "' />";
						$("#cartInfoForm").html(html);
						$("#cartInfoForm").submit();
					}
				}
				
				return false;
			}

			let info = list[listIndex];
			let removeCartSq = 0, updateCartSq = 0, goodsQty = 0;
			listIndex++;

			// list[listIndex]가 null이 아니라면
			if(info != null) {
				if (info.ordCanYn == "N") {		// 주문 불가
					let message = info.goodsNm + " 상품은 구매 할 수 없습니다. 제외하고 계속 주문하시겠습니까?";
					fnRemoveCartSqConfirm(message, cartSqArr, info.cartSq, list, listIndex, allYn);
				} else if (info.newCustCanYn == "N") {		// 신규 고객 구매 상품
					let message = info.goodsNm + " 상품은 신규회원만 구매 가능한 상품입니다. 제외하고 계속 주문하시겠습니까?";
					fnRemoveCartSqConfirm(message, cartSqArr, info.cartSq, list, listIndex, allYn);
				} else if (info.soldoutYn == "Y") {		// 품절
					if (info.goodsStat == "G008_70") {		// 상품 상태가 품절이거나 주문 가능 수량이 최소주문수량보다 적을경우
						let message = info.goodsNm + " 상품은 품절입니다. 제외하고 계속 주문하시겠습니까?";
						fnRemoveCartSqConfirm(message, cartSqArr, info.cartSq, list, listIndex, allYn)
					} else if (info.goodsQty < info.ordCanQty || info.ordCanQty < info.minOrdQty) {		// 주문 가능 수량이 0일경우
						let message = info.goodsNm + "의 " + info.colorNm + "/" + info.optCd2 + "이 품절되었습니다. 제외하고 계속 주문하시겠습니까?";
						fnRemoveCartSqConfirm(message, cartSqArr, info.cartSq, list, listIndex, allYn)
					} else if (listIndex < list.length) {
						// 혹시 else일 경우
						fnOrderValidation(list, listIndex, cartSqArr, allYn);
					}
				} else if (info.ordCanQty < info.goodsQty && info.ordCanQty != info.maxOrdQty) {
					let message;
					if ("G056_S" == info.goodsType) {
						message = info.goodsNm + " 의" + info.itemNm + "/" + info.colorNm + "/" + info.optCd2 + "의 수량이 부족합니다.\n구매가능 수량은 " + info.ordCanQty + "개입니다.\n구매가능 수량만큼 주문하시겠습니까?";
					} else {
						message = info.goodsNm + " 의" + info.colorNm + "/" + info.optCd2 + "의 수량이 부족합니다.\n구매가능 수량은 " + info.ordCanQty + "개입니다.\n구매가능 수량만큼 주문하시겠습니까?";
					}

					fnUpdateConfirmChangeQty(message, info.cartSq, info.ordCanQty, list, listIndex, cartSqArr, allYn);
				} else if (info.goodsQty < info.minOrdQty) {		// 최소 주문 수량보다 장바구니에 적게 들어왔을 경우
					let message = info.goodsNm + " 의 최소 구매수량은 " + info.minOrdQty + "개입니다.\n최소 구매 수량으로 주문하시겠습니까?";
					fnUpdateConfirmChangeQty(message, info.cartSq, info.minOrdQty, list, listIndex, cartSqArr, allYn);
				} else if (info.goodsQty > info.maxOrdQty) {
					let message = info.goodsNm + " 의 최대 구매 가능 수량은 " + info.maxOrdQty + "개입니다. 최대 구매 가능한 수량으로 주문하시겠습니까?";
					fnUpdateConfirmChangeQty(message, info.cartSq, info.maxOrdQty, list, listIndex, cartSqArr, allYn);
				} else if (listIndex < list.length) {
					fnOrderValidation(list, listIndex, cartSqArr, allYn);
				} else {
					fnOrderValidation(list, -1, cartSqArr, allYn);
				}
			} else {
				fnOrderValidation(list, -1, cartSqArr, allYn);
			}
		}

		// 최소, 최대 구매 수량에서 벗어난 상품의 수량 변경 확인
		function fnUpdateConfirmChangeQty(message, cartSq, goodsQty, list, listIndex, cartSqArr, allYn) {
			mcxDialog.confirmC(message, { //내용
				btn     : ["취소", "확인"],
				btnClick: function (index) {
					if (index == 1) { //button1 일때 처리문
						orderFlag = false; return false;
					} else {	//button2 일때 처리문
						updateGoodsQty(cartSq, goodsQty);
						fnOrderValidation(list, listIndex, cartSqArr, allYn);
					}
				}
			});
		}

		// 품절 및 구매불가 상품 구매 목록에서 제거 확인
		function fnRemoveCartSqConfirm(message, cartSqArr, cartSq, list, listIndex, allYn) {
			mcxDialog.confirmC(message, { //내용
				btn     : ["취소", "확인"],
				btnClick: function (index) {
					if (index == 1) { //button1 일때 처리문
						orderFlag = false; return false;
					} else {	//button2 일때 처리문
						if(cartSqArr.length > 1) {
							fnCheckOffCartSqArr(cartSqArr, cartSq);
							fnOrderValidation(list, listIndex, cartSqArr, allYn);
						} else {
							mcxDialog.alert("주문 가능한 상품이 없습니다.");
							orderFlag = false; return false;
						}
					}
				}
			});
		}

		// 품절, 구매 최소수량, 최대수량, 1일 제한 수량 넘는 상품은 구매내역에서 제외
		function fnCheckOffCartSqArr(cartSqArr, cartSq) {
			// 체크박스 해제
			$("#cartListForm input[name=cartSqArr]").each(function () {
				if ($(this).val() == cartSq) {
					$(this).prop("checked", false);
				}
			});

			// 장바구니 선택된것 삭제 > cartSq 0으로 변경
			let cartSqLength = 0;
			for (let i = 0; i < cartSqArr.length; i++) {
				if (cartSqArr[i] == cartSq) {
					cartSqArr[i] = 0;
				}
				if(cartSqArr[i] > 0) {
					cartSqLength++;
				}
			}

			if(cartSqLength < 1) {
				mcxDialog.alert("주문 가능한 상품이 없습니다.");
				orderFlag = false; return false;
			}
		}

		// 주문하기
		function fnSubmitNoMember(cartSq) {
			let cartSqArr = [];
			orderFlag = true;

			if(cartSq == 'all') {
				if ($("#cartListForm input[name=cartSqArr]:checked").length < 1) {
					mcxDialog.alert("구매하실 상품을 선택해주세요.");
					return false;
				}
			}

			if(loginInfo == null || loginInfo.custNo == null || loginInfo.custNo == 0) {
				var btn = ["비회원 구매", "로그인 후 구매"];
				mcxDialog.confirmC("로그인 후 구매 시 다양한 혜택을 받으실 수 있습니다.", { //내용
					btn: btn,
					btnClick: function(index){
						if (index == 1){ //button1 일때 처리문
							if(cartSq == "all") {
								// 선택된 장바구니 번호
								$("#cartListForm input[name=cartSqArr]:checked").each(function () {
									cartSqArr.push($(this).val());
								});

								fnOrderCheck(cartSqArr, 0, "Y");
							} else {
								fnOrderCheck(cartSq, 0, "N");
							}
						} else {	//button2 일때 처리문
							location.href="/signin";
						}
					}
				});
			} else {
				if(cartSq == "all") {
					// 선택된 장바구니 번호
					$("#cartListForm input[name=cartSqArr]:checked").each(function () {
						cartSqArr.push($(this).val());
					});

					fnOrderCheck(cartSqArr, loginInfo.custNo, "Y");
				} else {
					fnOrderCheck(cartSq, loginInfo.custNo, "N");
				}
			}
		}

		// 주문 정보 validation 체크
		function fnOrderCheck(cartSq, custNo, allYn) {
			// 선택된 장바구니 정보 가공
			let data = {	  cartSqArr : cartSq
							, custNo : custNo
			}
			let jsonData = JSON.stringify(data);

			$.ajax( {
				type: "POST",
				url : '/cart/order/list/check',
				contentType: 'application/json',
				dataType : 'json',
				data : jsonData,
				success : function(result) {
					if(result == null || result.length == 0) {
						mcxDialog.alert("주문 가능한 상품이 존재하지 않습니다. 새로고침 후 다시 시도해주세요.");
					} else {
						fnOrderValidation(result, 0, cartSq, allYn);
					}
				}
			});
		}

		// 장바구니 구매 수량 변경
		function updateGoodsQty(cartSq, goodsQty) {
			let url = '/cart/update/goodsQty';
			// 선택된 장바구니 정보 가공
			let data = {	  cartSq : cartSq
							, goodsQty : goodsQty
			}
			let jsonData = JSON.stringify(data);

			gagajf.ajaxJsonSubmit(url, jsonData, function(result) {
				//alert(result.changeQty);
			});
		}

		// 페이지 이동
		function fnGoToGoodsDetail(goodsCd, ordCanYn) {
			if(ordCanYn == "Y" || !ordCanYn) {
				cfnGoToPage(_PAGE_GOODS_DETAIL + goodsCd + "&colorCd=&ithrCd=IN18_01");
			} else {
				mcxDialog.alert("현재 구매가 불가능한 상품입니다.");
			}
		}

		// 전체선택 버튼
		$("#od_item_all").on("change", function() {
			if($("#od_item_all").is(":checked")) {
				$("input[name=cartSqArr]").each(function() {
					if(!$(this).prop("disabled")) {
						$(this).prop("checked", true);
					}
				});
			} else {
				$("input[name=cartSqArr]").prop("checked", false);
			}
			changeCartSqArr();
		});

		$(function(){
			$("#container .od_recommend").show();

			//추천상품 슬라이드
			var rcmdItemSwiper = new Swiper('.od_recommend .swiper-container', {
				slidesPerView: 5,
				slidesPerGroup: 5, //210708_ 추가 : 슬라이드 전환시 5개씩 이동.
				spaceBetween: 20,
				navigation: {
					nextEl: '.od_recommend .swiper-button-next',
					prevEl: '.od_recommend .swiper-button-prev',
				},
				pagination: {
					el: '.od_recommend .swiper-pagination',
					clickable: true,
				},
			});
			//지금 많이 보고 있어요 슬라이드
			var realtimeItemSwiper = new Swiper('.od_realtime .swiper-container', {
				slidesPerView: 5,
				slidesPerGroup: 5, //210708_ 추가 : 슬라이드 전환시 5개씩 이동.
				spaceBetween: 20,
				navigation: {
					nextEl: '.od_realtime .swiper-button-next',
					prevEl: '.od_realtime .swiper-button-prev',
				},
				pagination: {
					el: '.od_realtime .swiper-pagination',
					clickable: true,
				},
			});
		});
	</script>
</div>
</html>