| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <!-- 배송지변경 팝업 -->
- <form name="delvAddrChangeForm" id="delvAddrChangeForm">
- <div class="modal-header">
- <h5 class="modal-title" id="adrsChangeLabel">배송지 선택</h5>
- </div>
- <div class="modal-body">
- <th:block th:if="${deliveryAddrList != null and #lists.size(deliveryAddrList) > 0}">
- <div class="pop_cont">
- <ul>
- <!-- 배송지목록 -->
- <th:block th:each="deliveryAddr, index : ${deliveryAddrList}">
- <li>
- <div class="adrs_box" th:defaultyn="${deliveryAddr.defaultYn}">
- <dl>
- <div>
- <dt><span class="sr-only">배송지명</span></dt>
- <dd>
- <th:block th:text="${deliveryAddr.recipNm}"></th:block>
- <span class="icon_tag">
- <th:block th:if="${deliveryAddr.defaultYn} == 'Y'">
- <em class="tag">기본 배송지</em>
- </th:block>
- <th:block th:if="${deliveryAddr.shotDelvUseYn} == 'Y'">
- <em class="tag primary_line">총알배송</em>
- </th:block>
- </span>
- </dd>
- </div>
- <div>
- <dt><span class="sr-only">휴대폰 번호</span></dt>
- <dd th:text="${deliveryAddr.recipPhnno}"></dd>
- </div>
- <div>
- <dt><span class="sr-only">배송주소</span></dt>
- <dd th:text="${deliveryAddr.recipBaseAddr} + ' ' + ${deliveryAddr.recipDtlAddr}"></dd>
- </div>
- <div>
- <dt>배송요청 사항 : </dt>
- <dd th:text="${deliveryAddr.delvMemo}"></dd>
- </div>
- </dl>
- <button type="button" class="btn btn_default btn_sm btn_addrModify_pop" th:value="${deliveryAddr.custDelvAddrSq}"><span>수정</span></button>
- <button type="button" class="btn btn_dark btn_sm btn_sel_delvAddr" th:value="${deliveryAddr.custDelvAddrSq}" style="float:right;"><span>선택</span></button>
-
- <input type="hidden" name="recipNm" th:value="${deliveryAddr.recipNm}"/>
- <input type="hidden" name="recipPhnno" th:value="${deliveryAddr.recipPhnno}"/>
- <input type="hidden" name="recipZipcode" th:value="${deliveryAddr.recipZipcode}"/>
- <input type="hidden" name="recipBaseAddr" th:value="${deliveryAddr.recipBaseAddr}"/>
- <input type="hidden" name="recipDtlAddr" th:value="${deliveryAddr.recipDtlAddr}"/>
- <input type="hidden" name="delvMemo" th:value="${deliveryAddr.delvMemo}"/>
- </div>
- </li>
- </th:block>
- </ul>
- </div>
- </th:block>
-
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn_dark" id="btn_adrsAdd_pop"><span>배송지 추가</span></button>
- </div>
- </form>
- <script th:inline="javascript">
- var deliveryAddrCnt = [[${deliveryAddrCnt}]];
- //컨텐츠 호출
- $(document).ready( function() {
- // 목록이없으면 등록화면 이동
- if (parseInt(deliveryAddrCnt) < 1) {
- $.ajax( {
- type : "POST",
- url : '/common/delvAddrAddPop',
- data : JSON.stringify(jsonObj),
- dataType : 'html',
- beforeSend : function(xhr, settings) {
- xhr.setRequestHeader("AJAX" , "true");
- xhr.setRequestHeader('Accept' , 'application/json');
- xhr.setRequestHeader('Content-Type' , 'application/json');
- },
- success : function(result) {
- $("#adrsAddPop .modal-dialog .modal-content").html(result);
- $("#adrsAddPop").modal("show");
- }
- });
- }
- });
- // 2. 버튼기능구현
- // 2.1 배송지선택버튼
- $("#delvAddrChangeForm .btn_sel_delvAddr").on("click", function(){
-
- // custDelvAddrSq 부모창으로 전달
- var delvObj = {
- "custDelvAddrSq" : $(this).attr("value")
- , "dispYn" : "Y"
- , "recipNm" : $(this).parent().find("input[name=recipNm]").val()
- , "recipPhnno" : $(this).parent().find("input[name=recipPhnno]").val()
- , "recipZipcode" : $(this).parent().find("input[name=recipZipcode]").val()
- , "recipBaseAddr" : $(this).parent().find("input[name=recipBaseAddr]").val()
- , "recipDtlAddr" : $(this).parent().find("input[name=recipDtlAddr]").val()
- , "delvMemo" : $(this).parent().find("input[name=delvMemo]").val()
- }
-
- // 부모장으로 값 전닫
- delvAddrSet(delvObj);
-
- // 팝업닫기
- $(".close-modal").trigger("click");
- });
- // 2.2 배송지수정버튼
- $("#delvAddrChangeForm .btn_addrModify_pop").on("click", function(){
-
- var obj = {
- "custDelvAddrSq" : $(this).attr("value")
- }
- $.ajax( {
- type : "POST",
- url : '/common/delvAddrModifyPop',
- data : JSON.stringify(obj),
- dataType : 'html',
- beforeSend : function(xhr, settings) {
- xhr.setRequestHeader("AJAX" , "true");
- xhr.setRequestHeader('Accept' , 'application/json');
- xhr.setRequestHeader('Content-Type' , 'application/json');
- },
- success : function(result) {
- $("#adrsModifyPop .modal-dialog .modal-content").html(result);
- $("#adrsModifyPop").modal("show");
- }
- });
- });
- // 2.3 배송지추가 팝업열기
- $('#btn_adrsAdd_pop').on("click", function(){
-
- // 2021.08.11 배송지갯수체크 20개이하
- $.ajax( {
- type : "POST",
- url : '/common/addDelvAddrCnt',
- dataType : 'html',
- beforeSend : function(xhr, settings) {
- xhr.setRequestHeader("AJAX" , "true");
- xhr.setRequestHeader('Accept' , 'application/json');
- xhr.setRequestHeader('Content-Type' , 'application/json');
- },
- success : function(result) {
- if (parseInt(result) >= 20) {
- mcxDialog.alert("배송지는 최대 20개까지 등록 가능합니다.");
- return false;
- } else {
- $.ajax( {
- type : "POST",
- url : '/common/delvAddrAddPop',
- dataType : 'html',
- beforeSend : function(xhr, settings) {
- xhr.setRequestHeader("AJAX" , "true");
- xhr.setRequestHeader('Accept' , 'application/json');
- xhr.setRequestHeader('Content-Type' , 'application/json');
- },
- success : function(result) {
- $("#adrsAddPop .modal-dialog .modal-content").html(result);
- $("#adrsAddPop").modal("show");
- }
- });
- }
- }
- });
- });
- </script>
|