<html lang="ko"
	  xmlns:th="http://www.thymeleaf.org">
<!--
 *******************************************************************************
 * @source  : cartListFormMob
 * @desc	: 장바구니
 *============================================================================
 * STYLE24
 * Copyright(C) 2020 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE		 AUTHOR	  DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2021.04.07   xodud1202   최초 작성
 *******************************************************************************
 -->
<body>
<th:block layout:fragment="content">
	<!-- 즉시구매 form -->
	<form id="cartInfoForm" method="post" action="/order/noMember"></form>

	<!-- 장바구니 화면 -->
	<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" id="checkAbleCpnNm" value="N" />
		<input type="hidden" id="ableCpnNm" value="" />

		<div class="inner shotDelvSelect">
			<div class="od_method">
				<div class="tbl_tit">
					<h3>배송방법 선택</h3>
				</div>
				<div class="tbl tbl_radio">
					<table>
						<colgroup>
							<col width="*">
						</colgroup>
						<tbody>
						<tr>
							<th class="sr-only">총알배송</th>
							<td>
								<div class="form_field">
									<input type="radio" id="chk-1" name="shotDelvUseYn" value="Y" th:checked="${order.shotDelvUseYn != null and order.shotDelvUseYn.equals('Y') and order.shotCartList.size() > 0}">
									<label for="chk-1">
										<span th:text="|${order.shotDelvDt}일 24:00 까지 도착|"></span>
										<span class="icon_tag">
											<em class="tag_stype2">총알배송</em>
										</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>
							</td>
						</tr>
						<tr>
							<th class="sr-only">총알배송 안함</th>
							<td>
								<div class="form_field">
									<input id="chk-2" type="radio" name="shotDelvUseYn" value="N" th:checked="${order.shotDelvUseYn == null or !order.shotDelvUseYn.equals('Y') or order.shotCartList.size() < 1}">
									<label for="chk-2">
										<span>총알배송 안함</span>
									</label>
								</div>
							</td>
						</tr>
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<div class="inner" style="padding:1.5rem 2rem;">
			<div class="sec_select">
				<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="inner" th:if="${order.shotCartList.size() < 1 and order.wmsCartList.size() < 1 and order.delvCartList.size() < 1}">
			<!-- STYLE24 배송 -->
			<div class="part_goods">
				<div class="nodata">
					<div class="txt_box">
						<p>
							쇼핑백에 담긴 상품이 없습니다.
						</p>
					</div>
				</div>
			</div>
			<!-- //STYLE24 배송 -->
		</div>

		<div class="inner" th:if="${order.shotCartList.size() > 0 or order.wmsCartList.size() > 0}">
			<!-- STYLE24 배송 -->
			<div class="part_goods">
				<div class="goods_top">
					<div class="goods_date">STYLE24 배송</div>
				</div>
				<!-- 총알 배송 -->
				<div class="goods_area goods_bullship shotList" th:if="${order.shotCartList != null and order.shotCartList.size() > 0}">
					<h3>총알배송 <span>오늘 자정까지 도착</span></h3>
					<div class="goods_section cartInfo shotCartInfo" th:each="cart, status : ${order.shotCartList}">
						<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="goodsCd"   th:value="${cart.goodsCd}" />
						<input type="hidden" name="cartSq"    th:value="${cart.cartSq}" />
						<input type="hidden" name="orgSavePntAmt" th:value="${cart.orgSavePntAmt}" />

						<button type="button" class="btn_delete" th:onclick="|deleteCart(${cart.cartSq}, 'cart')|"><span><em class="sr-only">상품삭제</em></span></button>
						<div class="goods_detail">
							<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 class="thumb_box">
								<a th:href="|javascript:fnGoToGoodsDetail('${cart.goodsCd}', '${cart.ordCanYn}')|">
									<img th:src="${IMG_PATH} + '/' + ${cart.sysImgNm} + '?RS=100'" src="/" th:onerror="'this.src=\''+@{${uxImgUrl}+ '/images/pc/thumb/bg_item_none.png'}+'\';'" th:alt="${cart.sysImgNm}" alt="">
								</a>
							</div>
							<div class="info_box">
								<div class="od_name">
									<div class="brand">
										<span th:text="${cart.brandGroupNm}"></span>
									</div>
									<div class="name"><a th:href="|javascript:fnGoToGoodsDetail('${cart.goodsCd}', '${cart.ordCanYn}')|" th:text="${cart.goodsNm}"></a></div>
								</div>
								<div class="od_opt">
									<th:block th:each="opt, index : ${cart.itemNmArr}">
										<th:block th:if="${cart.goodsType.equals('G056_S')}">
											<div class="option">
												<em th:text="${cart.itemNmArr[index.index]}"></em><em th:text="${cart.colorNmArr[index.index]}"></em><em th:text="${cart.optCd2Arr[index.index]}"></em>
											</div>
										</th:block>
										<th:block th:if="${!cart.goodsType.equals('G056_S')}">
											<div class="option">
												<em th:text="${cart.colorNmArr[index.index]}"></em><em th:text="${cart.optCd2Arr[index.index]}"></em>
											</div>
										</th:block>
									</th:block>
								</div>
								<div class="od_point">
									<p class="point"><span th:class="|point${cart.cartSq}|" th:text="${#numbers.formatInteger(cart.savePntAmt, 1, 'COMMA')}"></span>P 적립예정</p>
								</div>
								<div class="od_exinfo">
									<span th:style="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'Y') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'Y') ? 'display:inline-block' : 'display:none'}" class="applyTmtb btn_moresale order_badge order_bullet_badge">다다익선 할인 적용</span>
									<a    th:style="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'N') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'N') ? 'display:inline-block' : 'display:none'}" href="javascript:void(0);" onclick="fnGetTmtbSalesGoods(this);" id="btn_moresale_pop" class="notApplyTmtb btn_moresale btn_moresale_pop order_badge order_bullet_badge">다다익선 할인 대상</a>
								</div>
							</div>
						</div>
						<div class="od_calc">
							<p class="count">수량 <em th:text="${cart.goodsQty}"></em>개</p>
							<p class="price">
								<th:block  th:if="${cart.tmtbDcAmt < cart.currPrice}">
									<span class="sale_price"><del><em th:text="${#numbers.formatInteger(cart.currPrice, 1, 'COMMA')}"></em>원</del></span>
									<span class="selling_price"><em th:text="${#numbers.formatInteger(cart.tmtbDcAmt, 1, 'COMMA')}"></em>원</span>
								</th:block>
								<th:block th:if="${cart.tmtbDcAmt == cart.currPrice}">
									<span class="selling_price"><em th:text="${#numbers.formatInteger(cart.currPrice, 1, 'COMMA')}"></em>원</span>
								</th:block>
							</p>
						</div>
						<div class="goods_btn_wrap btn_group_flex">
							<div><button type="button" class="btn btn_default btn_option_pop01" th:onclick="|fnChangeCartOptCd(${cart.cartSq})|" th:disabled="${cart.ordCanYn.equals('N') or cart.newCustCanYn.equals('N')}"><span>옵션/수량변경</span></button></div> <!-- 옵션변경_팝업01 호출 -->
							<div>
								<button th:if="${cart.soldoutYn.equals('Y') or cart.ordCanYn.equals('N') or cart.newCustCanYn.equals('N')}" type="button" class="btn btn_primary_line" disabled=""><span>구매 불가</span></button>
								<button th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y')}" type="button" class="btn btn_primary_line" th:onclick="|fnSubmitNoMember(${cart.cartSq})|"><span>바로구매</span></button>
							</div> <!-- 210406_ID 추가 -->
						</div>

						<div class="goods_txt reserv" th:if="${!#strings.isEmpty(cart.delvResDt)}">
							<span>예약배송 상품</span><span th:text="|${cart.delvResDt} 배송예정|"></span>
						</div>

						<div class="goods_txt" th:if="${cart.ordCanYn.equals('N')}">
							<span>해당 상품은 구매 불가능한 상품입니다.</span>
						</div>
						<div class="goods_txt" th:if="${cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('N')}">
							<span>해당 상품은 신규회원만 구매 가능한 상품입니다.</span>
						</div>
						<div class="goods_txt" th:if="${cart.soldoutYn.equals('Y') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y')}">
							<span>품절된 상품입니다.</span>
						</div>
						<div class="goods_txt" th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.goodsQty < cart.minOrdQty}">
							<span th:text="|해당 상품은 최소 ${cart.minOrdQty}개부터 구매 가능합니다.|"></span>
						</div>
						<div class="goods_txt" 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}">
							<span th:text="|해당 상품은 최대 ${cart.ordCanQty}개까지 구매 가능합니다.|"></span>
						</div>
						<div class="goods_txt" 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}">
							<span th:text="|해당 상품은 최대 ${cart.maxOrdQty}개까지 구매 가능합니다.|"></span>
						</div>
					</div>
				</div>
				<!-- 총알 배송 -->
				<!-- 일반 배송 -->
				<div class="goods_area goods_basic wmsList" th:if="${order.wmsCartList != null and order.wmsCartList.size() > 0}" th:style="${order.shotCartList.size() < 1 ? 'padding-top:unset;border-top:unset;' : ''}">
					<h3>일반배송</h3>
					<div class="goods_section wmsCartInfo cartInfo" th:each="cart, status : ${order.wmsCartList}">
						<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="goodsCd"   th:value="${cart.goodsCd}" />
						<input type="hidden" name="cartSq"    th:value="${cart.cartSq}" />
						<input type="hidden" name="orgSavePntAmt" th:value="${cart.orgSavePntAmt}" />

						<button type="button" class="btn_delete" th:onclick="|deleteCart(${cart.cartSq}, 'cart')|"><span><em class="sr-only">상품삭제</em></span></button>
						<div class="goods_detail">
							<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 class="thumb_box">
								<a th:href="|javascript:fnGoToGoodsDetail('${cart.goodsCd}', '${cart.ordCanYn}')|">
									<img th:src="${IMG_PATH} + '/' + ${cart.sysImgNm} + '?RS=100'" src="/" th:onerror="'this.src=\''+@{${uxImgUrl}+ '/images/pc/thumb/bg_item_none.png'}+'\';'" th:alt="${cart.sysImgNm}" alt="">
								</a>
							</div>
							<div class="info_box">
								<div class="od_name">
									<div class="brand">
										<span th:text="${cart.brandGroupNm}"></span>
									</div>
									<div class="name"><a th:href="|javascript:fnGoToGoodsDetail('${cart.goodsCd}', '${cart.ordCanYn}')|" th:text="${cart.goodsNm}"></a></div>
								</div>
								<div class="od_opt">
									<th:block th:each="opt, index : ${cart.itemNmArr}">
										<th:block th:if="${cart.goodsType.equals('G056_S')}">
											<div class="option">
												<em th:text="${cart.itemNmArr[index.index]}"></em><em th:text="${cart.colorNmArr[index.index]}"></em><em th:text="${cart.optCd2Arr[index.index]}"></em>
											</div>
										</th:block>
										<th:block th:if="${!cart.goodsType.equals('G056_S')}">
											<div class="option">
												<em th:text="${cart.colorNmArr[index.index]}"></em><em th:text="${cart.optCd2Arr[index.index]}"></em>
											</div>
										</th:block>
									</th:block>
								</div>
								<div class="od_point">
									<p class="point"><span th:class="|point${cart.cartSq}|" th:text="${#numbers.formatInteger(cart.savePntAmt, 1, 'COMMA')}"></span>P 적립예정</p>
								</div>
								<div class="od_exinfo">
									<span th:style="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'Y') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'Y') ? 'display:inline-block' : 'display:none'}" class="applyTmtb btn_moresale order_badge order_bullet_badge">다다익선 할인 적용</span>
									<a    th:style="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'N') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'N') ? 'display:inline-block' : 'display:none'}" href="javascript:void(0);" onclick="fnGetTmtbSalesGoods(this);" id="btn_moresale_pop" class="notApplyTmtb btn_moresale btn_moresale_pop order_badge order_bullet_badge">다다익선 할인 대상</a>
								</div>
							</div>
						</div>
						<div class="od_calc">
							<p class="count">수량 <em th:text="${cart.goodsQty}"></em>개</p>
							<p class="price">
								<th:block  th:if="${cart.tmtbDcAmt < cart.currPrice}">
									<span class="sale_price"><del><em th:text="${#numbers.formatInteger(cart.currPrice, 1, 'COMMA')}"></em>원</del></span>
									<span class="selling_price"><em th:text="${#numbers.formatInteger(cart.tmtbDcAmt, 1, 'COMMA')}"></em>원</span>
								</th:block>
								<th:block th:if="${cart.tmtbDcAmt == cart.currPrice}">
									<span class="selling_price"><em th:text="${#numbers.formatInteger(cart.currPrice, 1, 'COMMA')}"></em>원</span>
								</th:block>
							</p>
						</div>
						<div class="goods_btn_wrap btn_group_flex">
							<div><button type="button" class="btn btn_default btn_option_pop01" th:onclick="|fnChangeCartOptCd(${cart.cartSq})|" th:disabled="${cart.ordCanYn.equals('N') or cart.newCustCanYn.equals('N')}"><span>옵션/수량변경</span></button></div> <!-- 옵션변경_팝업01 호출 -->
							<div>
								<button th:if="${cart.soldoutYn.equals('Y') or cart.ordCanYn.equals('N') or cart.newCustCanYn.equals('N')}" type="button" class="btn btn_primary_line" disabled=""><span>구매 불가</span></button>
								<button th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y')}" type="button" class="btn btn_primary_line" th:onclick="|fnSubmitNoMember(${cart.cartSq})|"><span>바로구매</span></button>
							</div> <!-- 210406_ID 추가 -->
						</div>

						<div class="goods_txt reserv" th:if="${!#strings.isEmpty(cart.delvResDt)}">
							<span>예약배송 상품</span><span th:text="|${cart.delvResDt} 배송예정|"></span>
						</div>

						<div class="goods_txt" th:if="${cart.ordCanYn.equals('N')}">
							<span>해당 상품은 구매 불가능한 상품입니다.</span>
						</div>
						<div class="goods_txt" th:if="${cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('N')}">
							<span>해당 상품은 신규회원만 구매 가능한 상품입니다.</span>
						</div>
						<div class="goods_txt" th:if="${cart.soldoutYn.equals('Y') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y')}">
							<span>품절된 상품입니다.</span>
						</div>
						<div class="goods_txt" th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.goodsQty < cart.minOrdQty}">
							<span th:text="|해당 상품은 최소 ${cart.minOrdQty}개부터 구매 가능합니다.|"></span>
						</div>
						<div class="goods_txt" 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}">
							<span th:text="|해당 상품은 최대 ${cart.ordCanQty}개까지 구매 가능합니다.|"></span>
						</div>
						<div class="goods_txt" 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}">
							<span th:text="|해당 상품은 최대 ${cart.maxOrdQty}개까지 구매 가능합니다.|"></span>
						</div>
					</div>
				</div>
				<!-- 일반 배송 -->

				<!-- 자사 배송비 -->
				<div class="goods_txt selfGoodsDelv delvArea" th:classappend="|delv_${order.cartDelvFeeCd}|" th:style="${'Y'.equals(order.delvYn) ? 'display:block' : 'display:none'}">
					<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>
					<span>STYLE24  배송</span>
				</div>

				<div class="goods_dlvr_save" th:style="${'Y'.equals(order.delvYn) and order.wmsDelvFee > 0 ? 'display:block' : 'display:none'}">
					<a th:href="|javascript:fnGetDelvFeeSaveGoods('WMS', '${order.minOrdAmt - order.compSumPrice}');|" id="btn_dlvrSave_pop" class="btn_popup_save">배송비 SAVE 상품 보기</a>
				</div>
			</div>
			<!-- //STYLE24 배송 -->
		</div>

		<div class="inner" th:if="${order.delvCartList != null and order.delvCartList.size() > 0}">
			<!-- 업체직배송 -->
			<div class="part_goods">
				<div class="goods_top">
					<div class="goods_date">업체직 배송</div>
				</div>
				<!-- 업체직배송 -->
				<div class="goods_area delvList">
					<div class="goods_section delvCartInfo cartInfo" th:each="cart, status : ${order.delvCartList}">
						<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="goodsCd"   th:value="${cart.goodsCd}" />
						<input type="hidden" name="cartSq"    th:value="${cart.cartSq}" />
						<input type="hidden" name="orgSavePntAmt" th:value="${cart.orgSavePntAmt}" />

						<button type="button" class="btn_delete" th:onclick="|deleteCart(${cart.cartSq}, 'cart')|"><span><em class="sr-only">상품삭제</em></span></button>
						<div class="goods_detail">
							<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 class="thumb_box">
								<a th:href="|javascript:fnGoToGoodsDetail('${cart.goodsCd}', '${cart.ordCanYn}')|">
									<img th:src="${IMG_PATH} + '/' + ${cart.sysImgNm} + '?RS=100'" src="/" th:onerror="'this.src=\''+@{${uxImgUrl}+ '/images/pc/thumb/bg_item_none.png'}+'\';'" th:alt="${cart.sysImgNm}" alt="">
								</a>
							</div>
							<div class="info_box">
								<div class="od_name">
									<div class="brand">
										<span th:text="${cart.brandGroupNm}"></span>
									</div>
									<div class="name"><a th:href="|javascript:fnGoToGoodsDetail('${cart.goodsCd}', '${cart.ordCanYn}')|" th:text="${cart.goodsNm}"></a></div>
								</div>
								<div class="od_opt">
									<th:block th:each="opt, index : ${cart.itemNmArr}">
										<th:block th:if="${cart.goodsType.equals('G056_S')}">
											<div class="option">
												<em th:text="${cart.itemNmArr[index.index]}"></em><em th:text="${cart.colorNmArr[index.index]}"></em><em th:text="${cart.optCd2Arr[index.index]}"></em>
											</div>
										</th:block>
										<th:block th:if="${!cart.goodsType.equals('G056_S')}">
											<div class="option">
												<em th:text="${cart.colorNmArr[index.index]}"></em><em th:text="${cart.optCd2Arr[index.index]}"></em>
											</div>
										</th:block>
									</th:block>
								</div>
								<div class="od_point">
									<p class="point"><span th:class="|point${cart.cartSq}|" th:text="${#numbers.formatInteger(cart.savePntAmt, 1, 'COMMA')}"></span>P 적립예정</p>
								</div>
								<div class="od_exinfo">
									<span th:style="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'Y') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'Y') ? 'display:inline-block' : 'display:none'}" class="applyTmtb btn_moresale order_badge order_bullet_badge">다다익선 할인 적용</span>
									<a    th:style="${(cart.qtyTmtbSq > 0 and cart.applyQtySectionYn == 'N') or (cart.amtTmtbSq > 0 and cart.applyAmtSectionYn == 'N') ? 'display:inline-block' : 'display:none'}" href="javascript:void(0);" onclick="fnGetTmtbSalesGoods(this);" id="btn_moresale_pop" class="notApplyTmtb btn_moresale btn_moresale_pop order_badge order_bullet_badge">다다익선 할인 대상</a>
								</div>
							</div>
						</div>
						<div class="od_calc">
							<p class="count">수량 <em th:text="${cart.goodsQty}"></em>개</p>
							<p class="price">
								<th:block  th:if="${cart.tmtbDcAmt < cart.currPrice}">
									<span class="sale_price"><del><em th:text="${#numbers.formatInteger(cart.currPrice, 1, 'COMMA')}"></em>원</del></span>
									<span class="selling_price"><em th:text="${#numbers.formatInteger(cart.tmtbDcAmt, 1, 'COMMA')}"></em>원</span>
								</th:block>
								<th:block th:if="${cart.tmtbDcAmt == cart.currPrice}">
									<span class="selling_price"><em th:text="${#numbers.formatInteger(cart.currPrice, 1, 'COMMA')}"></em>원</span>
								</th:block>
							</p>
						</div>
						<div class="goods_btn_wrap btn_group_flex">
							<div><button type="button" class="btn btn_default" th:onclick="|fnChangeCartOptCd(${cart.cartSq})|" th:disabled="${cart.ordCanYn.equals('N') or cart.newCustCanYn.equals('N')}"><span>옵션/수량변경</span></button></div>
							<div>
								<button th:if="${cart.soldoutYn.equals('Y') or cart.ordCanYn.equals('N') or cart.newCustCanYn.equals('N')}" type="button" class="btn btn_primary_line" disabled=""><span>구매 불가</span></button>
								<button th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y')}" type="button" class="btn btn_primary_line" th:onclick="|fnSubmitNoMember(${cart.cartSq})|"><span>바로구매</span></button>
							</div>
						</div>

						<div class="goods_txt reserv" th:if="${!#strings.isEmpty(cart.delvResDt)}">
							<span>예약배송 상품</span><span th:text="|${cart.delvResDt} 배송예정|"></span>
						</div>

						<div class="goods_txt" th:if="${cart.ordCanYn.equals('N')}">
							<span>해당 상품은 구매 불가능한 상품입니다.</span>
						</div>
						<div class="goods_txt" th:if="${cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('N')}">
							<span>해당 상품은 신규회원만 구매 가능한 상품입니다.</span>
						</div>
						<div class="goods_txt" th:if="${cart.soldoutYn.equals('Y') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y')}">
							<span>품절된 상품입니다.</span>
						</div>
						<div class="goods_txt" th:if="${cart.soldoutYn.equals('N') and cart.ordCanYn.equals('Y') and cart.newCustCanYn.equals('Y') and cart.goodsQty < cart.minOrdQty}">
							<span th:text="|해당 상품은 최소 ${cart.minOrdQty}개부터 구매 가능합니다.|"></span>
						</div>
						<div class="goods_txt" 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}">
							<span th:text="|해당 상품은 최대 ${cart.ordCanQty}개까지 구매 가능합니다.|"></span>
						</div>
						<div class="goods_txt" 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}">
							<span th:text="|해당 상품은 최대 ${cart.maxOrdQty}개까지 구매 가능합니다.|"></span>
						</div>

						<!-- 입점업체 배송비 -->
						<div class="goods_txt delvArea" th:if="${'Y'.equals(cart.addDelvFeeYn)}" th:classappend="|delv_${cart.delvFeeCd}|" th:style="${'Y'.equals(cart.delvYn) ? 'display:block' : 'display:none'}">
							<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 th:text="|${cart.supplyCompNm} 업체직배송|"></span>
						</div>

						<div class="goods_dlvr_save" th:if="${'Y'.equals(cart.addDelvFeeYn)}" th:style="${'Y'.equals(cart.delvYn) and cart.delvFee > 0 ? 'display:block' : 'display:none'}">
							<a th:href="|javascript:fnGetDelvFeeSaveGoods('${cart.delvFeeCd}', '${cart.minOrdAmt - cart.compSumPrice}');|" id="btn_dlvrSave_pop" class="btn_popup_save">배송비 SAVE 상품 보기</a>
						</div>
					</div>
				</div>
				<!-- 업체직배송 -->
			</div>
			<!-- //업체직배송 -->
		</div>
		<div class="inner">
			<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>
		</div>
		<div class="inner">
			<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" id="btn_salecode" class="btn btn_dark btn_sm" onclick="serialCpnApply()"><span>적용</span></button> <!-- 210406_ID 추가 -->
				</div>
				<div class="coupon_box">
					<div class="coupon">
						<button type="button" class="btn_delete" onclick="cancelCartCpn()"><span><em class="sr-only">쿠폰닫기</em></span></button>
						<div>
							<p class="cp_name"></p>
							<p class="cp_cont">
								<span class="cp_dc_val"></span>
							</p>
							<p class="cp_condition"></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_couponInfo_pop">
						<span>사용안내</span>
					</button>
				</div>
			</div>
		</div>
		<div class="inner wide">
			<div class="od_calc_wrap" id="bottomOrderArea">
				<button type="button" class="btn btn_dark"><span>합계 <em class="realOrderAmtText" th:text="${#numbers.formatInteger(order.sumRealPayAmt + order.totDelvFee, 1, 'COMMA')}">0</em>원</span></button>
				<button type="button" id="btn_purchase" class="btn btn_primary" onclick="fnSubmitNoMember('all'); return false;"><span>구매하기 (<em class="realOrderQtyText" th:text="${order.totCartCnt}"></em>개)</span></button> <!-- 210406_ID 추가 -->
			</div>
		</div>

		<!-- 쿠폰사용안내 팝업 -->
		<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_head">
							<h6 class="serialCpnNm"></h6>
						</div>
						<div class="pop_cont">
							<dl>
								<div>
									<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">
			var sumRealPayAmt = [[${order.sumRealPayAmt + order.totDelvFee}]];
			var totDcAmt = [[${order.totDcAmt}]];
			var loginInfo = new Object();
			var 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").parent().hide();
					}
				});
			};

			$(document).ready(function() {
				var od_recommend_slide = new Swiper('.od_recommend .swiper-container', {
					slidesPerView: 2,
					spaceBetween: 8,
					centerMode: true,
				});

				setLoginInfo();

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

				$("#cartListForm .area_salecoupon .coupon_box").hide();
			});

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

				$("#bottomOrderArea .realOrderAmtText").text(Number(sumRealPayAmt).toLocaleString());
			}

			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());
				});

				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());
								$("#bottomOrderArea .realOrderAmtText").text(Number(sumRealPayAmt - 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-body .pop_head h6").text(cpnInfo.cpnNm);

							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);
						}
					}
				});
			}

			$("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 .part_goods .goods_dlvr_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 .delvArea .delvFeeArea").text("배송비 0원");

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

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

				for(let i = 0 ; i < shotList.length ; i++) {
					cartList.push(shotList[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(".info_box .point>span").text(Number(shot.savePntAmt).toLocaleString());

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

							// 다다익선 상품보기 노출
							if((shot.qtyTmtbSq > 0 && shot.applyQtySectionYn == "N") || (shot.amtTmtbSq > 0 && shot.applyAmtSectionYn == "N")) {
								$(this).parent().find(".notApplyTmtb").css("display", "inline-block");
								//$(this).parent().find(".notApplyTmtb").show();
							}

							// 다다익선 할인가 적용
							if(shot.tmtbDcAmt < shot.currPrice) {
								$(this).parent().find(".od_calc .selling_price>em").text(Number(shot.tmtbDcAmt).toLocaleString());
								$(this).parent().find(".od_calc .sale_price>del>em").text(Number(shot.currPrice).toLocaleString());
								$(this).parent().find(".od_calc .sale_price").show();
								$(this).parent().find("input[name=tmtbDcAmt]").val(shot.tmtbDcAmt);
							}
						}
					});
				}

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

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

							if((wms.qtyTmtbSq > 0 && wms.applyQtySectionYn == "N") || (wms.amtTmtbSq > 0 && wms.applyAmtSectionYn == "N")) {
								$(this).parent().find(".notApplyTmtb").css("display", "inline-block");
								//$(this).parent().find(".notApplyTmtb").show();
							}

							// 다다익선 할인가 적용
							if(wms.tmtbDcAmt < wms.currPrice) {
								$(this).parent().find(".od_calc .selling_price>em").text(Number(wms.tmtbDcAmt).toLocaleString());
								$(this).parent().find(".od_calc .sale_price>del>em").text(Number(wms.currPrice).toLocaleString());
								$(this).parent().find(".od_calc .sale_price").show();
								$(this).parent().find("input[name=tmtbDcAmt]").val(wms.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><span>STYLE24  배송</span>";
						$(".selfGoodsDelv").parent().find(".goods_dlvr_save a").attr("href", "javascript:fnGetDelvFeeSaveGoods('WMS', '" + (order.minOrdAmt - order.compSumPrice) + "');")
						$(".selfGoodsDelv").parent().find(".goods_dlvr_save").show();
						$(".selfGoodsDelv").html(html);
					}
				}

				for(let i = 0 ; i < delvList.length ; i++) {
					cartList.push(delvList[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(".info_box .point>span").text(Number(delv.savePntAmt).toLocaleString());

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

							// 다다익선 할인가 적용
							if(delv.tmtbDcAmt < delv.currPrice) {
								$(this).parent().find(".od_calc .selling_price>em").text(Number(delv.tmtbDcAmt).toLocaleString());
								$(this).parent().find(".od_calc .sale_price>del>em").text(Number(delv.currPrice).toLocaleString());
								$(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>";
								$(".delvList").find(".delv_" + delv.delvFeeCd).parent().find(".goods_dlvr_save a").attr("href", "javascript:fnGetDelvFeeSaveGoods('" + delv.delvFeeCd + "','" + (delv.minOrdAmt - delv.compSumPrice) +  "');")
								$(".delvList").find(".delv_" + delv.delvFeeCd).parent().find(".goods_dlvr_save").show();
								$(".delvList").find(".delv_" + delv.delvFeeCd).html(html);
							}
						}
					});
				}

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

				// 하단 구매하기 버튼 수량 및 금액 변경
				$("#bottomOrderArea .realOrderQtyText").text(Number(order.totCartCnt).toLocaleString());
				$("#bottomOrderArea .realOrderAmtText").text(Number(sumRealPayAmt).toLocaleString());

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

			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;
							}
						}
					}
				});
			}

			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");
					}
				}
			}

			// 주문 데이터 밸리데이션 체크
			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 fnChangeCartOptCd(cartSq) {
				$.ajax( {
					type: "POST",
					url : '/cart/goods/info',
					dataType : 'html',
					data : {cartSq : cartSq},
					success : function(result) {
						$("#cartOptionModal").remove();
						$("#optModifyPop01").html(result);
						$('#optModifyPop01').show().addClass("active");
						$("body").css({"overflow":"hidden"});
					}
				});
			}

			// 장바구니 구매 수량 변경
			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();
			});

			/* 팝업 - 옵션변경 > 컬러선택 표기 */
			$(document).on('click','.optModifyPop .opt_color ul li a',function(e){
				$(this).parents('.opt_color').find('li a').removeClass('on');
				$(this).addClass('on');
				var optColor = $('.optModifyPop .opt_color ul li a.on img').attr('alt');
				$('.optModify_pop .opt_color .opt_header .color').text(optColor);
				return false;
			});

			function deleteCartAjax(cartArr, menu) {
				if(cartArr.length < 1) {
					mcxDialog.alert("삭제하실 상품을 선택해 주세요.");
					return false;
				}

				let data = {
					cartSqArr : cartArr
				}

				let jsonData = JSON.stringify(data);

				$.ajax( {
					type: "POST",
					url : '/cart/deleteCart',
					contentType: 'application/json',
					dataType : 'json',
					data : jsonData,
					success : function(result) {
						mcxDialog.alert("삭제 되었습니다.");
						let data = {shotDelvUseYn : $("input[name=shotDelvUseYn]:checked").val()};
						getCartList(data);
					}
				});
			}

			function deleteCart(gbn, menu) {
				let cartArr = [];
				let confirmMessage = "";
				if(gbn == "SELECT") {
					$("#cartListForm input[name=cartSqArr]:checked").each(function () {
						cartArr.push($(this).val());
					});

					if(cartArr.length < 1) {
						mcxDialog.alert("삭제하실 상품을 선택해 주세요.");
						return false;
					}

					// confirmMessage = "총 " + cartArr.length + "개의 상품을 삭제합니다.";
					confirmMessage = "선택한 상품을 삭제하시겠습니까?";
				} else {
					cartArr.push(gbn);
					deleteCartAjax(cartArr, menu);
					return false;
				}

				mcxDialog.confirm(confirmMessage, {
					cancelBtnText: "취소",			//취소 또는 닫기 버튼명
					sureBtnText  : "확인",				//처리문 버튼명
					sureBtnClick : function () {
						deleteCartAjax(cartArr, menu);
					}
				});
			}
		</script>
	</form>
</th:block>
</body>
</html>