DelvAddrChangePopWeb.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <!-- 배송지변경 팝업 -->
  2. <form name="delvAddrChangeForm" id="delvAddrChangeForm">
  3. <div class="modal-header">
  4. <h5 class="modal-title" id="adrsChangeLabel">배송지 선택</h5>
  5. </div>
  6. <div class="modal-body">
  7. <th:block th:if="${deliveryAddrList != null and #lists.size(deliveryAddrList) > 0}">
  8. <div class="pop_cont">
  9. <ul>
  10. <!-- 배송지목록 -->
  11. <th:block th:each="deliveryAddr, index : ${deliveryAddrList}">
  12. <li>
  13. <div class="adrs_box" th:defaultyn="${deliveryAddr.defaultYn}">
  14. <dl>
  15. <div>
  16. <dt><span class="sr-only">배송지명</span></dt>
  17. <dd>
  18. <th:block th:text="${deliveryAddr.recipNm}"></th:block>
  19. <span class="icon_tag">
  20. <th:block th:if="${deliveryAddr.defaultYn} == 'Y'">
  21. <em class="tag">기본 배송지</em>
  22. </th:block>
  23. <th:block th:if="${deliveryAddr.shotDelvUseYn} == 'Y'">
  24. <em class="tag primary_line">총알배송</em>
  25. </th:block>
  26. </span>
  27. </dd>
  28. </div>
  29. <div>
  30. <dt><span class="sr-only">휴대폰 번호</span></dt>
  31. <dd th:text="${deliveryAddr.recipPhnno}"></dd>
  32. </div>
  33. <div>
  34. <dt><span class="sr-only">배송주소</span></dt>
  35. <dd th:text="${deliveryAddr.recipBaseAddr} + ' ' + ${deliveryAddr.recipDtlAddr}"></dd>
  36. </div>
  37. <div>
  38. <dt>배송요청 사항&nbsp;:&nbsp;</dt>
  39. <dd th:text="${deliveryAddr.delvMemo}"></dd>
  40. </div>
  41. </dl>
  42. <button type="button" class="btn btn_default btn_sm btn_addrModify_pop" th:value="${deliveryAddr.custDelvAddrSq}"><span>수정</span></button>
  43. <button type="button" class="btn btn_dark btn_sm btn_sel_delvAddr" th:value="${deliveryAddr.custDelvAddrSq}" style="float:right;"><span>선택</span></button>
  44. <input type="hidden" name="recipNm" th:value="${deliveryAddr.recipNm}"/>
  45. <input type="hidden" name="recipPhnno" th:value="${deliveryAddr.recipPhnno}"/>
  46. <input type="hidden" name="recipZipcode" th:value="${deliveryAddr.recipZipcode}"/>
  47. <input type="hidden" name="recipBaseAddr" th:value="${deliveryAddr.recipBaseAddr}"/>
  48. <input type="hidden" name="recipDtlAddr" th:value="${deliveryAddr.recipDtlAddr}"/>
  49. <input type="hidden" name="delvMemo" th:value="${deliveryAddr.delvMemo}"/>
  50. </div>
  51. </li>
  52. </th:block>
  53. </ul>
  54. </div>
  55. </th:block>
  56. </div>
  57. <div class="modal-footer">
  58. <button type="button" class="btn btn_dark" id="btn_adrsAdd_pop"><span>배송지 추가</span></button>
  59. </div>
  60. </form>
  61. <script th:inline="javascript">
  62. var deliveryAddrCnt = [[${deliveryAddrCnt}]];
  63. //컨텐츠 호출
  64. $(document).ready( function() {
  65. // 목록이없으면 등록화면 이동
  66. if (parseInt(deliveryAddrCnt) < 1) {
  67. $.ajax( {
  68. type : "POST",
  69. url : '/common/delvAddrAddPop',
  70. data : JSON.stringify(jsonObj),
  71. dataType : 'html',
  72. beforeSend : function(xhr, settings) {
  73. xhr.setRequestHeader("AJAX" , "true");
  74. xhr.setRequestHeader('Accept' , 'application/json');
  75. xhr.setRequestHeader('Content-Type' , 'application/json');
  76. },
  77. success : function(result) {
  78. $("#adrsAddPop .modal-dialog .modal-content").html(result);
  79. $("#adrsAddPop").modal("show");
  80. }
  81. });
  82. }
  83. });
  84. // 2. 버튼기능구현
  85. // 2.1 배송지선택버튼
  86. $("#delvAddrChangeForm .btn_sel_delvAddr").on("click", function(){
  87. // custDelvAddrSq 부모창으로 전달
  88. var delvObj = {
  89. "custDelvAddrSq" : $(this).attr("value")
  90. , "dispYn" : "Y"
  91. , "recipNm" : $(this).parent().find("input[name=recipNm]").val()
  92. , "recipPhnno" : $(this).parent().find("input[name=recipPhnno]").val()
  93. , "recipZipcode" : $(this).parent().find("input[name=recipZipcode]").val()
  94. , "recipBaseAddr" : $(this).parent().find("input[name=recipBaseAddr]").val()
  95. , "recipDtlAddr" : $(this).parent().find("input[name=recipDtlAddr]").val()
  96. , "delvMemo" : $(this).parent().find("input[name=delvMemo]").val()
  97. }
  98. // 부모장으로 값 전닫
  99. delvAddrSet(delvObj);
  100. // 팝업닫기
  101. $(".close-modal").trigger("click");
  102. });
  103. // 2.2 배송지수정버튼
  104. $("#delvAddrChangeForm .btn_addrModify_pop").on("click", function(){
  105. var obj = {
  106. "custDelvAddrSq" : $(this).attr("value")
  107. }
  108. $.ajax( {
  109. type : "POST",
  110. url : '/common/delvAddrModifyPop',
  111. data : JSON.stringify(obj),
  112. dataType : 'html',
  113. beforeSend : function(xhr, settings) {
  114. xhr.setRequestHeader("AJAX" , "true");
  115. xhr.setRequestHeader('Accept' , 'application/json');
  116. xhr.setRequestHeader('Content-Type' , 'application/json');
  117. },
  118. success : function(result) {
  119. $("#adrsModifyPop .modal-dialog .modal-content").html(result);
  120. $("#adrsModifyPop").modal("show");
  121. }
  122. });
  123. });
  124. // 2.3 배송지추가 팝업열기
  125. $('#btn_adrsAdd_pop').on("click", function(){
  126. // 2021.08.11 배송지갯수체크 20개이하
  127. $.ajax( {
  128. type : "POST",
  129. url : '/common/addDelvAddrCnt',
  130. dataType : 'html',
  131. beforeSend : function(xhr, settings) {
  132. xhr.setRequestHeader("AJAX" , "true");
  133. xhr.setRequestHeader('Accept' , 'application/json');
  134. xhr.setRequestHeader('Content-Type' , 'application/json');
  135. },
  136. success : function(result) {
  137. if (parseInt(result) >= 20) {
  138. mcxDialog.alert("배송지는 최대 20개까지 등록 가능합니다.");
  139. return false;
  140. } else {
  141. $.ajax( {
  142. type : "POST",
  143. url : '/common/delvAddrAddPop',
  144. dataType : 'html',
  145. beforeSend : function(xhr, settings) {
  146. xhr.setRequestHeader("AJAX" , "true");
  147. xhr.setRequestHeader('Accept' , 'application/json');
  148. xhr.setRequestHeader('Content-Type' , 'application/json');
  149. },
  150. success : function(result) {
  151. $("#adrsAddPop .modal-dialog .modal-content").html(result);
  152. $("#adrsAddPop").modal("show");
  153. }
  154. });
  155. }
  156. }
  157. });
  158. });
  159. </script>