<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<!--
 *******************************************************************************
 * @source  : OrderDcAmtInfoWeb.html
 * @desc    : 할인혜택 Page
 *============================================================================
 * STYLE24
 * Copyright(C) 2020 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE         AUTHOR      DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2021.02.01   jsh77b     최초 작성
 *******************************************************************************
 -->

<!-- 할인/혜택 사용 -->
<div class="fold_head">
	<a href="javascript:void(0)">
		<div>
			<div class="fold_tit">
				<span>할인/혜택 사용</span>
			</div>
			<div class="data maxdisc">
				<div class="form_field">
					<input id="chk-maxdisc" type="checkbox" checked="">
					<label for="chk-maxdisc">
						<span>최대 할인혜택을 바로 적용하세요!</span>&nbsp;
						<span class="maxdisc_amount">(<em class="cpnDcAmt"></em>원 할인)</span>
					</label>
				</div>
			</div>
		</div>
	</a>
</div>
<div class="fold_cont" style="display: none;">
	<div class="area_seldiscount">
		<dl>
			<div>
				<dt>할인쿠폰</dt>
				<dd>
					<div class="sale_coupon_box">
						<div>
							<span class="maxdisc_amount">총&nbsp;<em class="goodsCartCpnDcAmt"></em>원 할인</span>
							<input type="hidden" name="custCpnCnt" th:value="${goodsApplyCpnList.size()} + ${cartCpnList.size()}">
							<input type="hidden" name="custDelvCpnCnt" th:value="${delvCpnList.size()}">
							
							<button type="button" id="btn_couponModify_pop" class="btn btn_default btn_sm">
								<span>쿠폰변경</span>
							</button>
						</div>
						<div class="form_field">
							<div class="input_wrap">
								<input type="text" id="serialCpnNm" class="form_control" maxlength="13" placeholder="할인코드를 입력해주세요.">
								<button type="button" class="btn btn_dark btn_sm" onclick="serialCpnApply()">
									<span>적용</span>
								</button>
							</div>
						</div>
					</div>
				</dd>
			</div>
			
			<!-- 배송비쿠폰 -->
			<!-- 배송비쿠폰이 존재 -->
			<th:block th:if="${delvCpnList.size() > 0}">
				<div>
					<dt>배송비 쿠폰</dt>
					<dd>
						<div class="dlvr_fee_box">
							<div class="form_field">
								<div class="select_custom coupon_list">
									<div class="combo">
										<div class="select">
											<div class="dlvr_coupon"><p class="empty">선택</p></div>
										</div>
										<ul class="list" style="display: none;">
											<input type="hidden" name="cpnType" value="delvCpn"/>
											<input type="hidden" name="custCpnSq" value="0"/>
											<input type="hidden" name="cpnDcAmt" value="0"/>
											<input type="hidden" name="delvFeeCd" value="0"/>
											
											<th:block th:each="delvCpn, k : ${delvCpnList}">
												<li class="delvCpn" th:value="${delvCpn.custCpnSq}" th:data="${delvCpn.cpnDcAmt}" th:delvfeecd="${delvCpn.delvFeeCd}" th:delvfee="${delvCpn.delvFee}">
													<div class="dlvr_coupon">
														<p class="name" th:text="${delvCpn.cpnNm}"></p>
														<p class="discount">
															<span th:text="${#numbers.formatInteger(delvCpn.cpnDcAmt, 1, 'COMMA')}"></span>원 할인
														</p>
													</div>
												</li>
											</th:block>
											<li class="delvCpn" value="0" data="0" delvfeecd="0" delvfee="0">
												<div class="dlvr_coupon"><p class="empty">적용 안함</p></div>
											</li>
										</ul>
									</div>
								</div>
							</div>
						</div>
					</dd>
				</div>
			</th:block>
			<!-- //배송비쿠폰이 존재 -->
			<!-- 배송비쿠폰이 미존재 -->
			<th:block th:if="${delvCpnList.size() < 1}">
				<div>
					<dt>배송비 쿠폰</dt>
					<dd>
						<div class="dlvr_fee_box">
							<div class="form_field">
								<div class="select_custom" disabled="">
									<div class="combo">
										<div class="select">
											<div class="dlvr_coupon">
												<p class="empty">적용 가능한 쿠폰이 없습니다</p>
											</div>
										</div>
										<ul class="list">
										<!-- 선택처리 class="selected" / 선택불가 aria-disabled="true"추가  -->
											<li class="selected">
												<div class="dlvr_coupon">
													<p class="empty">적용 가능한 쿠폰이 없습니다</p>
												</div>
											</li>
										</ul>
									</div>
								</div>
							</div>
						</div>
					</dd>
				</div>
			</th:block>
			<!-- //배송비쿠폰이 미존재 -->
			<!-- //배송비쿠폰 -->
		</dl>
	</div>
	
	<!-- 선포인트금액, 포인트금액, 상품권금액 0보다 클때 적용 -->
	<!-- <th:block th:if="${prePntDcAmt} > 0 or ${rmPntAmt} > 0 or ${rmGfcdAmt} > 0"> -->
		<div class="area_selpoint">
			<dl>
				<!-- 선포인트금액 0보다 클때 적용 -->
				<th:block th:if="${prePntDcAmt} > 0">
					<div>
						<dt>선 포인트 사용</dt>
						<dd>
							<div class="form_field">
								<input type="hidden" name="rmPrePntAmt" th:value="${prePntDcAmt}"/>
								<div>
									<input type="radio" name="rdi-beforpoint" id="rdi-beforpoint1" value="N"> 
									<label for="rdi-beforpoint1"><span>사용 안함</span></label>
								</div>
								<div>
									<input type="radio" name="rdi-beforpoint" id="rdi-beforpoint2" value="Y" checked> 
									<label for="rdi-beforpoint2"><span>사용함</span></label> 
									<span class="useable_point">(<em th:text="|${#numbers.formatInteger(prePntDcAmt, 1, 'COMMA')}|"></em>&nbsp;원 사용 가능)</span>
								</div>
							</div>
						</dd>
					</div>
				</th:block>
				<!-- //선포인트금액 0보다 클때 적용 -->

				<!-- 포인트금액 0보다 클때 적용 -->
				<th:block th:if="${rmPntAmt} > 0">
					<div>
						<dt>스타일 포인트</dt>
						<dd>
							<div class="form_field">
								<input type="hidden" name="rmPntAmt" th:value="${rmPntAmt}"/>
								<input type="hidden" name="pointUseOrdMinAmt" th:value="${pointUseEnvset.pointUseOrdMinAmt}"/>
								<input type="hidden" name="pointUseMaxLimit" th:value="${pointUseEnvset.pointUseMaxLimit}"/>
								
								<!-- 스타일 포인트 3만원 이상 결제시 노출 -->
								<th:block th:if="${orgGoodsSumAmt} >= ${pointUseEnvset.pointUseOrdMinAmt}">
									<div class="input_wrap">
										<input type="text" name="pntDcAmtStr" class="form_control" maxlength="11" placeholder="사용할 포인트를 입력해주세요." onkeyup="inputNumberFormat(this);">
										<button type="button" class="btn btn_dark btn_sm" id="btn_point_apply">
											<span>적용</span>
										</button>
									</div>
								</th:block>
								<!-- 스타일 포인트 3만원 이상 결제시 노출 -->
								
								<!-- 스타일 포인트 3만원 미만 결제시 노출 -->
								<th:block th:if="${orgGoodsSumAmt} < ${pointUseEnvset.pointUseOrdMinAmt}">
									<div class="input_wrap">
										<input type="text" class="form_control" maxlength="" th:placeholder="|${#numbers.formatInteger(pointUseEnvset.pointUseOrdMinAmt, 1, 'COMMA')}원 이상 결제시에만 포인트 사용이 가능합니다.|" disabled="">
									</div>
								</th:block>
								<!-- //스타일 포인트 3만원 미만 결제시 노출 -->
								
								<p>
									<span class="remain_point">보유:&nbsp;
										<em class="rmPntAmt" th:text="${#numbers.formatInteger(rmPntAmt, 1, 'COMMA')}"></em>P
									</span>
									<th:block th:text="|(결제금액의 최대 ${pointUseEnvset.pointUseMaxLimit}%까지 사용가능)|"></th:block>
								</p>
							</div>
						</dd>
					</div>
				</th:block>
				<!-- //포인트금액 0보다 클때 적용 -->
				
				<!-- 포인트금액 1보다 작을때 적용 -->
				<th:block th:if="${rmPntAmt} < 1">
					<div>
						<dt>스타일 포인트</dt>
						<dd>
							<div class="form_field">
								<input type="hidden" name="rmPntAmt" th:value="${rmPntAmt}"/>
								<!-- 스타일 포인트 3만원 이상 결제시 노출 -->
								<th:block th:if="${orgGoodsSumAmt} >= 30000">
									<div class="input_wrap">
										<input type="text" name="pntDcAmtStr" class="form_control" maxlength="11" placeholder="사용할 포인트를 입력해주세요." onkeyup="inputNumberFormat(this);" disabled="">
										<button type="button" class="btn btn_dark btn_sm" id="btn_point_apply">
											<span>적용</span>
										</button>
									</div>
								</th:block>
								<!-- 스타일 포인트 3만원 이상 결제시 노출 -->
								
								<!-- 스타일 포인트 3만원 미만 결제시 노출 -->
								<th:block th:if="${orgGoodsSumAmt} < 30000">
									<div class="input_wrap">
										<input type="text" class="form_control" maxlength="" placeholder="3만원 이상 결제시에만 포인트 사용이 가능합니다." disabled="">
									</div>
								</th:block>
								<!-- //스타일 포인트 3만원 미만 결제시 노출 -->
								
								<p>
									<span class="remain_point">보유:&nbsp;
										<em class="rmPntAmt" th:text="${#numbers.formatInteger(rmPntAmt, 1, 'COMMA')}"></em>P
									</span>(결제금액의 최대 40%까지 사용가능)
								</p>
							</div>
						</dd>
					</div>
				</th:block>
				<!-- //포인트금액 1보다 작을때 적용 -->
				
				<!-- 상품권금액 0보다 클때 적용 -->
				<th:block th:if="${rmGfcdAmt} > 0">
					<div>
						<dt>상품권</dt>
						<dd>
							<div class="form_field">
								<input type="hidden" name="rmGfcdAmt" th:value="${rmGfcdAmt}"/>
								<div class="input_wrap">
									<input type="text" name="gfcdUseAmtStr" class="form_control" maxlength="11" placeholder="사용할 금액을 입력해주세요." onkeyup="inputNumberFormat(this);">
									<button type="button" class="btn btn_dark btn_sm" id="btn_gfcd_apply">
										<span>적용</span>
									</button>
								</div>
								<p><span class="remain_point">보유:&nbsp;<em th:text="${#numbers.formatInteger(rmGfcdAmt, 1, 'COMMA')}"></em>원</span></p>
							</div>
						</dd>
					</div>
				</th:block>
				<!-- //상품권금액 0보다 클때 적용 -->
				
				<!-- 상품권금액 1보다 작을때 적용 -->
				<th:block th:if="${rmGfcdAmt} < 1">
					<div>
						<dt>상품권</dt>
						<dd>
							<div class="form_field">
								<input type="hidden" name="rmGfcdAmt" th:value="${rmGfcdAmt}"/>
								<div class="input_wrap">
									<input type="text" name="gfcdUseAmtStr" class="form_control" maxlength="11" placeholder="사용할 금액을 입력해주세요." onkeyup="inputNumberFormat(this);" disabled="">
									<button type="button" class="btn btn_dark btn_sm" id="btn_gfcd_apply">
										<span>적용</span>
									</button>
								</div>
								<p><span class="remain_point">보유:&nbsp;<em th:text="${#numbers.formatInteger(rmGfcdAmt, 1, 'COMMA')}"></em>원</span></p>
							</div>
						</dd>
					</div>
				</th:block>
				<!-- //상품권금액 1보다 작을때 적용 -->
			</dl>
		</div>
	<!-- </th:block> -->
</div> <!-- //할인/혜택 사용 -->

<script th:inline="javascript">
var dispYn = [[${order.dispYn}]]; // 노출여부

//컨텐츠 호출
$(document).ready( function() {
	// 화면펼침
	if (dispYn == "Y") {
		$("#dcAmtInfo .fold_head").addClass("on");
		$("#dcAmtInfo .fold_cont").show();
	}
	
	//할인쿠폰(배송비) 선택
    var od_dlvrfee_coupon_selecter = new sCombo('.od .odPayment .dlvr_fee_box .select_custom.coupon_list');
});
</script>
</html>