ExchangeRequestForm.html 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419
  1. <!DOCTYPE html>
  2. <html lang="ko" xmlns:th="http://www.thymeleaf.org">
  3. <!--
  4. *******************************************************************************
  5. * @source : ExchangeRequestForm.html
  6. * @desc : 교환요청 화면
  7. *============================================================================
  8. * STYLE24
  9. * Copyright(C) 2021 TSIT, All rights reserved.
  10. *============================================================================
  11. * VER DATE AUTHOR DESCRIPTION
  12. * === =========== ========== =============================================
  13. * 1.0 2021.01.15 card007 최초 작성
  14. *******************************************************************************
  15. -->
  16. <div class="modalPopup" data-width="1400" data-height="600">
  17. <div class="panelStyle">
  18. <div class="panelTitle">
  19. <h2>교환요청</h2>
  20. <button type="button" class="close" onclick="uifnPopupClose('popupExchangeRequestForm');"><i class="fa fa-times"></i></button>
  21. </div>
  22. <div class="panelContent" style="height:90%; overflow-y:auto; padding:0px 20px !important; ">
  23. <form id="exchangeRequestFrm" name="exchangeRequestFrm" action="/orderChange/exchange" method="post" target="hdFrameForOrderExchange">
  24. <input type="hidden" name="ordNo" th:value="${ordNo}"/>
  25. <input type="hidden" name="chgReason" value=""/>
  26. <input type="hidden" name="chgReasonDesc" value=""/>
  27. <h4>주문정보</h4>
  28. <div id="gridOrderCancelRequestList" style="width:100%; height: 200px;" class="ag-theme-balham"></div>
  29. <div id="delvCdList">
  30. <h4>배송정보</h4>
  31. <div id="gridDelvCdList" style="width:100%; height: 66px;" class="ag-theme-balham"></div>
  32. </div>
  33. <div style="text-align:right; padding-bottom:5px; padding-top:5px;">
  34. <button type="button" class="btn btn-success" th:unless="${ordChgSq > 0}" id="fnExchangeRequestSubmit" onclick="fnExchange()">교환요청</button>
  35. <!-- 2021.07.22 선발송 처리 시 교환철회 불가 처리 -->
  36. <th:block th:if="${wdBfSendYn == 'N'}">
  37. <!-- 2021.07.22 택배사 회수 불가 시 회수요청상태에서 교환철회 처리 -->
  38. <!-- 2021.10.01 card007 CS 요청으로 상품검수중까지 교환철회 오픈 처리 -->
  39. <!-- <button type="button" class="btn btn-success" th:if="${chgStat == 'G685_20' or chgStat == 'G685_21' or (recallExceptionInfo != null and (chgStat == 'G685_30' or chgStat == 'G685_31'))}" id="fnExchangeCancelRequestSubmit" onclick="fnExchangeCancel()">교환철회</button> -->
  40. <!-- <button type="button" class="btn btn-success" th:if="${chgStat == 'G685_20' or chgStat == 'G685_21' or chgStat == 'G685_22' or (chgStat == 'G685_30' and (canRequestCancelYn == 'Y' or recallExceptionInfo != null)) or (chgStat == 'G685_31' and recallExceptionInfo != null)}" id="fnExchangeCancelRequestSubmit" onclick="fnExchangeCancel()">교환철회</button> -->
  41. <button type="button" class="btn btn-success" th:if="${chgStat == 'G685_20' or chgStat == 'G685_21' or chgStat == 'G685_22' or chgStat == 'G685_30' or chgStat == 'G685_31'}" id="fnExchangeCancelRequestSubmit" onclick="fnExchangeCancel()">교환철회</button>
  42. </th:block>
  43. <th:block th:if="${ordChgSq > 0 and (ordChgGb == 'G681_20' or ordChgGb == 'G681_40')}">
  44. <!-- 선발송 처리 시 교TO교 접수 불가 처리 -->
  45. <button type="button" class="btn btn-success" th:unless="${ordChgGb == 'G681_20' and wdBfSendYn == 'Y'}" id="fnReturnToExchangeSubmit" onclick="fnExchange()">교환변경</button>
  46. </th:block>
  47. <th:block th:if="${ordChgSq > 0 and chgStat == 'G685_22'}">
  48. <!-- 네이버페이 주문형 교환승인 버튼 -->
  49. <button type="button" class="btn btn-success" id="fnExchangeApprovalSubmit" onclick="fnExchange()">교환승인</button>
  50. </th:block>
  51. <th:block th:if="${ordChgSq > 0 and chgStat != 'G685_40'}">
  52. <!-- 네이버페이 주문형 교환보류 버튼 -->
  53. <button type="button" class="btn btn-success" id="fnExchangeHold" npayChangeHoldYn="N" onclick="fnNpayExchangeHold(this)">교환보류</button>
  54. <button type="button" class="btn btn-success" id="fnReleaseExchangeHold" npayChangeHoldYn="Y" onclick="fnNpayExchangeHold(this)">교환보류해제</button>
  55. </th:block>
  56. </div>
  57. <table class="frmStyle">
  58. <colgroup>
  59. <col style="width:160px;" />
  60. <col style="width:320px;" />
  61. <col style="width:160px;" />
  62. <col style="width:320px;" />
  63. <col style="width:160px;" />
  64. <col />
  65. </colgroup>
  66. <tbody>
  67. <tr>
  68. <th>교환사유 <i class="star"></i></th>
  69. <td th:if="${ordChgSq <= 0 or ordChgGb == 'G681_40'}">
  70. <select name="selectChgReason" onchange="fnChangeChgReason($(this).val());">
  71. <option value="">[선택하세요]</option>
  72. <option th:if="${chgReasonList}" th:each="oneData, status : ${chgReasonList}" th:value="|${oneData.cd}:${oneData.cdNm}|" th:text="|[${oneData.cd}] ${oneData.cdNm}|"></option>
  73. </select>
  74. </td>
  75. <td th:if="${ordChgSq > 0 and ordChgGb != 'G681_40'}" th:id="chgReason"></td>
  76. <th>귀책사유</th>
  77. <td><span id="imputeReason"></span></td>
  78. <th>선발송</th>
  79. <td>
  80. <label class="chkBox">
  81. <input type="checkbox" name="wdBfSendYn" id="wdBfSendYn" disabled="disabled"/>
  82. </label>
  83. </td>
  84. </tr>
  85. <tr>
  86. <th>회수방법</th>
  87. <td>
  88. <label class="rdoBtn"><input type="radio" name="wdGb" th:id="wdGb" value="W" onclick="fnChangeWdGb(this)"/>회수요청<span></span></label>
  89. <label class="rdoBtn"><input type="radio" name="wdGb" th:id="wdGb" value="D" onclick="fnChangeWdGb(this)"/>직접발송<span></span></label>
  90. </td>
  91. <th>추가배송비</th>
  92. <td id="addDelvFee" colspan="3"></td>
  93. </tr>
  94. <tr>
  95. <th>요청메모<br/><span id="chgMemoCount">0</span>/1,000Byte</th>
  96. <td colspan="5">
  97. <textarea id="chgMemo" name="chgMemo" style="height:80px;" onkeyup="cfnGetTextLength(this, 1000, $('#chgMemoCount'));"></textarea>
  98. </td>
  99. </tr>
  100. </tbody>
  101. </table>
  102. <h4 class="chger">회수지 정보</h4>
  103. <button style="float: right" type="button" class="btn btn-success chger" id="chgerButton" onclick="fnChangeChgerInfo();">회수지 수정</button>
  104. <!-- <button style="float: right" type="button" class="btn btn-success chger" id="chgerButton" th:if="${(#strings.isEmpty(ordChgGb) or ordChgGb == 'G681_50') and ordChgSq > 0 and wdGb == 'W' and (chgStat == 'G685_20' or chgStat == 'G685_21')}" onclick="fnChangeChgerInfo();">회수지 수정</button>-->
  105. <table class="frmStyle chger">
  106. <colgroup>
  107. <col style="width:160px;" />
  108. <col style="width:320px;" />
  109. <col style="width:160px;" />
  110. <col />
  111. </colgroup>
  112. <tbody>
  113. <tr>
  114. <th>보내는사람 <i class="star"></i></th>
  115. <td colspan="3"><input type="text" name ="chgerNm" class=""/></td>
  116. </tr>
  117. <tr>
  118. <th>회수지주소 <i class="star"></i></th>
  119. <td colspan="3">
  120. <input type="text" name ="chgerZipcode" class="w100" readonly="readonly"/>
  121. <!-- <button type="button" class="btn btn-info" th:if="${#strings.isEmpty(ordChgGb) and (ordChgSq == 0 or chgStat == 'G685_20' or chgStat == 'G685_21')}" onclick="fnOpenDaumAddr('withdraw');">우편번호찾기</button>-->
  122. <button type="button" class="btn btn-info" id="chgerFindAddr" onclick="fnOpenDaumAddr('withdraw');">우편번호찾기</button>
  123. <input type="text" name ="chgerBaseAddr" class="w300" readonly="readonly"/>
  124. <input type="text" name ="chgerDtlAddr" class="w300"/>
  125. </td>
  126. </tr>
  127. <tr>
  128. <th>일반전화</th>
  129. <td>
  130. <select name="chgerTelno1" class="w100">
  131. <option value="">[선택하세요]</option>
  132. <option th:if="${TelExcNoList}" th:each="oneData, status : ${TelExcNoList}" th:value="${oneData.cd}" th:text="${oneData.cd}"></option>
  133. </select>
  134. - <input type="text" name ="chgerTelno2" class="w60"/>
  135. - <input type="text" name ="chgerTelno3" class="w60"/>
  136. </td>
  137. <th>휴대전화 <i class="star"></i></th>
  138. <td>
  139. <select name="chgerPhnno1" class="w100">
  140. <option value="">[선택하세요]</option>
  141. <option th:if="${PhnExcNoList}" th:each="oneData, status : ${PhnExcNoList}" th:value="${oneData.cd}" th:text="${oneData.cd}"></option>
  142. </select>
  143. - <input type="text" name ="chgerPhnno2" class="w60"/>
  144. - <input type="text" name ="chgerPhnno3" class="w60"/>
  145. </td>
  146. </tr>
  147. <tr>
  148. <th>반품메모<br/><span id="chgerRtnMemoCount">0</span>/1,000Byte</th>
  149. <td colspan="3">
  150. <textarea id="chgerRtnMemo" name="chgerRtnMemo" style="height:80px;" onkeyup="cfnGetTextLength(this, 1000, $('#chgerRtnMemoCount'));"></textarea>
  151. </td>
  152. </tr>
  153. </tbody>
  154. </table>
  155. <h4>교환지 정보</h4>
  156. <button style="float: right" type="button" class="btn btn-success" id="recipButton" onclick="fnChangeRecipInfo();">교환지 수정</button>
  157. <!-- <button style="float: right" type="button" class="btn btn-success" th:unless="${ordChgSq == 0 or ordChgGb == 'G681_20' or (chgStat == 'G685_40' and (chgOrdDtlStat != 'G013_20' or chgOrdDtlStat != 'G013_30' or chgOrdDtlStat != 'G013_35'))}" onclick="fnChangeRecipInfo();">교환지 수정</button>-->
  158. <table class="frmStyle">
  159. <colgroup>
  160. <col style="width:160px;" />
  161. <col style="width:320px;" />
  162. <col style="width:160px;" />
  163. <col />
  164. </colgroup>
  165. <tbody>
  166. <tr>
  167. <th>받는사람 <i class="star"></i></th>
  168. <td colspan="3"><input type="text" name ="recipNm" class=""/></td>
  169. </tr>
  170. <tr>
  171. <th>교환지주소 <i class="star"></i></th>
  172. <td colspan="3">
  173. <input type="text" name ="recipZipcode" class="w100" readonly="readonly"/>
  174. <!-- <button type="button" class="btn btn-info" th:unless="${ordChgGb == 'G681_20' or (chgStat == 'G685_40' and (chgOrdDtlStat != 'G013_20' or chgOrdDtlStat != 'G013_30' or chgOrdDtlStat != 'G013_35')) or chgStat == 'G685_22'}" onclick="fnOpenDaumAddr('exchange');">우편번호찾기</button>-->
  175. <button type="button" class="btn btn-info" id="recipFindAddr" onclick="fnOpenDaumAddr('exchange');">우편번호찾기</button>
  176. <input type="text" name ="recipBaseAddr" class="w300" readonly="readonly"/>
  177. <input type="text" name ="recipDtlAddr" class="w300"/>
  178. </td>
  179. </tr>
  180. <tr>
  181. <th>일반전화</th>
  182. <td>
  183. <select name="recipTelno1" class="w100">
  184. <option value="">[선택하세요]</option>
  185. <option th:if="${TelExcNoList}" th:each="oneData, status : ${TelExcNoList}" th:value="${oneData.cd}" th:text="${oneData.cd}"></option>
  186. </select>
  187. - <input type="text" name ="recipTelno2" class="w60"/>
  188. - <input type="text" name ="recipTelno3" class="w60"/>
  189. </td>
  190. <th>휴대전화 <i class="star"></i></th>
  191. <td>
  192. <select name="recipPhnno1" class="w100">
  193. <option value="">[선택하세요]</option>
  194. <option th:if="${PhnExcNoList}" th:each="oneData, status : ${PhnExcNoList}" th:value="${oneData.cd}" th:text="${oneData.cd}"></option>
  195. </select>
  196. - <input type="text" name ="recipPhnno2" class="w60"/>
  197. - <input type="text" name ="recipPhnno3" class="w60"/>
  198. </td>
  199. </tr>
  200. <tr>
  201. <th>배송메모<br/><span id="delvMemoCount">0</span>/1,000Byte</th>
  202. <td colspan="3">
  203. <textarea id="delvMemo" name="delvMemo" style="height:80px;" onkeyup="cfnGetTextLength(this, 1000, $('#delvMemoCount'));"></textarea>
  204. </td>
  205. </tr>
  206. </tbody>
  207. </table>
  208. </form>
  209. </div>
  210. </div>
  211. </div>
  212. <!-- data -->
  213. <script th:inline="javascript">
  214. /*<![CDATA[*/
  215. var cancelRequestTargetList = [[${cancelRequestTargetList}]]; // 교환대상목록
  216. var ordNo = [[${ordNo}]]; // 주문번호
  217. var ordChgSq = [[${ordChgSq}]]; // 주문변경번호
  218. var chgStat = [[${chgStat}]]; // 변경상태
  219. var orderInfoList = [[${orderInfoList}]]; // 주문기본정보
  220. var payMeans = orderInfoList[0].payMeans; // 결제수단
  221. var pgGb = orderInfoList[0].pgGb; // PG구분
  222. var orderDelvAddrInfo = [[${orderDelvAddrInfo}]]; // 회수지정보
  223. var recallExceptionInfo = [[${recallExceptionInfo}]]; // 회수 예외 정보
  224. var rtnLocInfo = [[${rtnLocInfo}]]; // 반송지주소정보
  225. var addPayCost = 0; // 추가배송비
  226. var addDelvFee = 0; // 추가배송비
  227. //var addDelvFeeList = []; // 추가배송비정보
  228. var exchangeRequestList = []; // 교환요청목록
  229. var exchangeInfoList; // 교환정보
  230. var wdGb; // 회수방법
  231. var ordChgGb = [[${ordChgGb}]]; // 변경요청변경구분
  232. var orderChangeDetailList; // 취소/반품/교환요청 정보
  233. var chgOrdDtlStat; // 교환상품상세상태값
  234. var delvAddrSq; // 교환상품배송지일련번호
  235. var npayChangeHoldYn = ''; // 네이버페이 주문형 반품/교환 보류 여부
  236. var selfGoodsYn = cancelRequestTargetList[0].selfGoodsYn; // 자사,입점여부
  237. var temp1 = true;
  238. var temp2 = true;
  239. // 변경요청정보 승인, 철회
  240. if (ordChgSq > 0) {
  241. orderChangeDetailList = [[${orderChangeDetailList}]]; // 취소/반품/교환요청 정보
  242. exchangeInfoList = [[${exchangeInfoList}]]; // 교환정보
  243. npayChangeHoldYn = orderChangeDetailList[0].npayChangeHoldYn; // 네이버페이 주문형 반품/교환 보류 여부
  244. if (ordChgGb == 'G681_40') {
  245. chgReason = orderChangeDetailList[0].chgReason; // 변경사유코드
  246. chgReasonNm = orderChangeDetailList[0].chgReasonNm; // 변경사유코드명
  247. chgMemo = orderChangeDetailList[0].chgMemo; // 변경사유메모
  248. wdGb = orderChangeDetailList[0].wdGb; // 회수방법
  249. chgOrdDtlStat = ''; // 교환상품상세상태값
  250. delvAddrSq = ''; // 교환상품배송지일련번호
  251. } else {
  252. chgReason = exchangeInfoList[0].chgReason; // 변경사유코드
  253. chgReasonNm = exchangeInfoList[0].chgReasonNm; // 변경사유코드명
  254. chgMemo = exchangeInfoList[0].chgMemo; // 변경사유메모
  255. wdGb = exchangeInfoList[0].wdGb; // 회수방법
  256. chgOrdDtlStat = exchangeInfoList[0].ordDtlStat; // 교환상품상세상태값
  257. delvAddrSq = exchangeInfoList[0].delvAddrSq; // 교환상품배송지일련번호
  258. addPayCost = exchangeInfoList[0].addPayCost; // 추가배송비
  259. }
  260. }
  261. // 1. 주문정보(교환대상)
  262. var columnExchangeReqList = [
  263. {
  264. headerName : "주문상세정보",
  265. children : [
  266. {headerName: "주문번호" , field: "ordNo" , width: 80 , cellClass: 'text-center', hide: temp1},
  267. {headerName: "주문상세" , field: "ordDtlNo" , width: 80 , cellClass: 'text-center'},
  268. {headerName: "주문상세" , field: "ordDtlStat" , width: 80 , cellClass: 'text-center', hide: temp1},
  269. {headerName: "주문상세상태" , field: "ordDtlStatNm" , width: 100 , cellClass: 'text-center', hide: temp1},
  270. {headerName: "상품코드" , field: "goodsCd" , width: 100 , cellClass: 'text-center'},
  271. {headerName: "상품명" , field: "goodsNm" , width: 200 , cellClass: 'text-center'},
  272. {headerName: "상품타입" , field: "goodsTypeNm" , width: 100 , cellClass: 'text-center', hide: temp2}
  273. ]
  274. },
  275. {
  276. headerName : "주문상세단품정보",
  277. children : [
  278. {headerName: "단품번호" , field: "ordDtlItemSq" , width: 100 , cellClass: 'text-center', hide: temp2},
  279. {headerName: "단품코드" , field: "itemCd" , width: 100 , cellClass: 'text-center'},
  280. {headerName: "단품명" , field: "itemNm" , width: 200 , cellClass: 'text-center'},
  281. {headerName: "옵션1" , field: "optCd1" , width: 60 , cellClass: 'text-center'},
  282. {headerName: "옵션2" , field: "optCd2" , width: 60 , cellClass: 'text-center'},
  283. {
  284. headerName : "단품수량"
  285. , field : "itemQty"
  286. , width : 60
  287. , cellClass : 'text-center'
  288. , cellRenderer : function (params) {
  289. return params.value.addComma();
  290. }
  291. },
  292. {
  293. headerName : "단품금액"
  294. , field : "itemPrice"
  295. , width : 80
  296. , cellClass : 'text-right'
  297. , cellRenderer : function (params) {
  298. return params.value.addComma();
  299. }
  300. },
  301. {
  302. headerName : "단품옵션금액"
  303. , field : "optAddPrice"
  304. , width : 90
  305. , cellClass : 'text-right'
  306. , cellRenderer : function (params) {
  307. return params.value.addComma();
  308. }
  309. }
  310. ]
  311. },
  312. {
  313. headerName : "주문상세수량",
  314. children : [
  315. {
  316. headerName : "주문"
  317. , field : "ordQty"
  318. , width : 70
  319. , cellClass : 'text-center'
  320. , cellRenderer : function (params) {
  321. return params.value.addComma();
  322. }
  323. },
  324. {
  325. headerName : "취소/요청"
  326. , field : "cnclRtnQty"
  327. , width : 70
  328. , cellClass : 'text-center'
  329. , cellRenderer : function (params) {
  330. var cnclRtnReqQty = parseInt(params.data.cnclRtnQty) + parseInt(params.data.ordReqChgQty);
  331. return cnclRtnReqQty;
  332. }
  333. },
  334. {headerName: "교환가능옵션" , field: "optCd2s" , width: 200 , cellClass: 'text-center', hide: temp2},
  335. {
  336. headerName : "교환옵션"
  337. , field : "ordChgOpt"
  338. , width : 100
  339. , cellClass : "text-center"
  340. , cellRenderer : function (params) {
  341. if (ordChgSq > 0 && ordChgGb != 'G681_40' && chgStat != 'G685_22') {
  342. $.each(exchangeInfoList, function(idx, item) {
  343. if (params.data.itemCd == item.itemCd && params.data.optCd1 == item.optCd1) {
  344. strVal = item.optCd2;
  345. }
  346. });
  347. } else {
  348. var optCd2Arr = params.data.optCd2s.split(',');
  349. var optCdArr = params.data.optCds.split(',');
  350. var ordChgOpt = params.data.ordChgOpt;
  351. var ordQty = parseInt(params.data.ordQty);
  352. var cnclRtnQty = parseInt(params.data.cnclRtnQty);
  353. var ordReqChgQty = parseInt(params.data.ordReqChgQty);
  354. var ordCanChgQty = ordQty - (cnclRtnQty + ordReqChgQty);
  355. if (ordChgGb == 'G681_40' || chgStat == 'G685_22') {
  356. ordCanChgQty = params.data.chgQty;
  357. }
  358. var strVal = '';
  359. if (ordCanChgQty == 0) {
  360. strVal += '<select class="ordChgOpt" name="ordChgOpt" ordDtlNo="' + params.data.ordDtlNo + '" ordDtlItemSq="' + params.data.ordDtlItemSq + '" onchange="fnChangeOption(this)" disabled="disabled">';
  361. } else {
  362. strVal += '<select class="ordChgOpt" name="ordChgOpt" ordDtlNo="' + params.data.ordDtlNo + '" ordDtlItemSq="' + params.data.ordDtlItemSq + '" onchange="fnChangeOption(this)">';
  363. }
  364. if (gagajf.isNull(ordChgOpt)) {
  365. strVal += '<option value="">선택</option>';
  366. } else {
  367. strVal += '<option value="" selected>선택</option>';
  368. }
  369. $.each(optCdArr, function (idx, item) {
  370. // 2021.07.26 교환옵션 optCd2 -> optCd로 변경 처리
  371. if (ordChgOpt == item) {
  372. //strVal += '<option value="' + item + '" selected>' + item + '</option>';
  373. strVal += '<option value="' + item + '/' + optCd2Arr[idx] + '" selected>' + optCd2Arr[idx] + '</option>';
  374. } else {
  375. //strVal += '<option value="' + item + '">' + item + '</option>';
  376. strVal += '<option value="' + item + '/' + optCd2Arr[idx] + '">' + optCd2Arr[idx] + '</option>';
  377. }
  378. });
  379. }
  380. return strVal;
  381. }
  382. },
  383. {headerName: "재고수량" , field: "currStockQty" , width: 100 , cellClass: 'text-center', hide: temp2},
  384. {
  385. headerName : "교환신청수량"
  386. , field : "chgQty"
  387. , width : 100
  388. , cellClass : 'text-center'
  389. , cellRenderer : function (params) {
  390. if (ordChgSq > 0) {
  391. // 반품TO교환, 교환TO교환
  392. if (ordChgGb == 'G681_40' || ordChgGb == 'G681_20') {
  393. strVal = params.data.chgQty;
  394. }
  395. // 교환상세
  396. else {
  397. $.each(exchangeInfoList, function (idx, item) {
  398. if (params.data.itemCd == item.itemCd && params.data.optCd1 == item.optCd1) {
  399. strVal = item.chgQty;
  400. }
  401. });
  402. }
  403. } else {
  404. var ordQty = parseInt(params.data.ordQty);
  405. var cnclRtnQty = parseInt(params.data.cnclRtnQty);
  406. var ordReqChgQty = parseInt(params.data.ordReqChgQty);
  407. var ordCanChgQty = ordQty - (cnclRtnQty + ordReqChgQty);
  408. //// 교환TO교환
  409. //if (ordChgGb == 'G681_20') {
  410. // ordCanChgQty = parseInt(params.data.ordCanChgQty);
  411. //}
  412. var strVal = "";
  413. if (ordCanChgQty == 0) {
  414. strVal += '<select class="ordCanChgQty ' + params.data.ordDtlNo + '" name="chgQty" ordDtlNo="' + params.data.ordDtlNo + '" onchange="fnChangeQty(this)" disabled="disabled">';
  415. } else {
  416. strVal += '<select class="ordCanChgQty ' + params.data.ordDtlNo + '" name="chgQty" ordDtlNo="' + params.data.ordDtlNo + '" onchange="fnChangeQty(this)">';
  417. }
  418. for (i = 0; i <= ordCanChgQty; i++) {
  419. if (i == params.data.chgQty) {
  420. strVal += " <option value='" + i + "' selected>" + i + "</option>";
  421. } else {
  422. strVal += " <option value='" + i + "'>" + i + "</option>";
  423. }
  424. }
  425. strVal += "</select>";
  426. }
  427. return strVal;
  428. }
  429. }
  430. ]
  431. },
  432. {
  433. headerName : "주문단품금액",
  434. children : [
  435. {
  436. headerName : "주문"
  437. , field : "ordAmt"
  438. , width : 80
  439. , cellClass : 'text-right'
  440. , cellRenderer : function (params) {
  441. return params.value.addComma();
  442. }
  443. },
  444. {
  445. headerName : "취소"
  446. , field : "cnclRtnAmt"
  447. , width : 80
  448. , cellClass : 'text-right'
  449. , cellRenderer : function (params) {
  450. return params.value.addComma();
  451. }
  452. },
  453. {
  454. headerName : "즉시할인"
  455. , field : "cpn1DcAmt"
  456. , width : 80
  457. , cellClass : 'text-right'
  458. , cellRenderer : function (params) {
  459. return params.value.addComma();
  460. }
  461. },
  462. {
  463. headerName : "다다익선1"
  464. , field : "tmtb1DcAmt"
  465. , width : 80
  466. , cellClass : 'text-right'
  467. , cellRenderer : function (params) {
  468. return params.value.addComma();
  469. }
  470. },
  471. {
  472. headerName : "다다익선2"
  473. , field : "tmtb2DcAmt"
  474. , width : 80
  475. , cellClass : 'text-right'
  476. , cellRenderer : function (params) {
  477. return params.value.addComma();
  478. }
  479. },
  480. {
  481. headerName : "상품쿠폰"
  482. , field : "goodsCpnDcAmt"
  483. , width : 80
  484. , cellClass : 'text-right'
  485. , cellRenderer : function (params) {
  486. return params.value.addComma();
  487. }
  488. },
  489. {
  490. headerName : "장바구니쿠폰"
  491. , field : "cartCpnDcAmt"
  492. , width : 80
  493. , cellClass : 'text-right'
  494. , cellRenderer : function (params) {
  495. return params.value.addComma();
  496. }
  497. },
  498. {
  499. headerName : "포인트"
  500. , field : "pntDcAmt"
  501. , width : 80
  502. , cellClass : 'text-right'
  503. , cellRenderer : function (params) {
  504. return params.value.addComma();
  505. }
  506. },
  507. {
  508. headerName : "선포인트"
  509. , field : "prePntDcAmt"
  510. , width : 80
  511. , cellClass : 'text-right'
  512. , cellRenderer : function (params) {
  513. return params.value.addComma();
  514. }
  515. },
  516. {
  517. headerName : "상품권"
  518. , field : "gfcdUseAmt"
  519. , width : 80
  520. , cellClass : 'text-right'
  521. , cellRenderer : function (params) {
  522. return params.value.addComma();
  523. }
  524. },
  525. {
  526. headerName : "실결제금액"
  527. , field : "realOrdAmt"
  528. , width : 80
  529. , cellClass : 'text-right'
  530. , cellRenderer : function (params) {
  531. return params.value.addComma();
  532. }
  533. }
  534. ]
  535. },
  536. {
  537. headerName : "주문배송비정보",
  538. children : [
  539. {
  540. headerName : "배송비"
  541. , field : "delvFee"
  542. , width : 80
  543. , cellClass : 'text-right'
  544. , cellRenderer : function (params) {
  545. return params.value.addComma();
  546. }
  547. , hide : temp2
  548. },
  549. {headerName: "업체" , field: "supplyCompCd" , width: 100 , cellClass: 'text-center', hide: temp2},
  550. {headerName: "배송비코드" , field: "delvFeeCd" , width: 100 , cellClass: 'text-center', hide: temp2},
  551. {
  552. headerName : "무료배송비"
  553. , field : "minOrdAmt"
  554. , width : 80
  555. , cellClass : 'text-right'
  556. , cellRenderer : function (params) {
  557. return params.value.addComma();
  558. }
  559. , hide : temp2
  560. },
  561. {
  562. headerName : "기본배송비"
  563. , field : "orgDelvFee"
  564. , width : 80
  565. , cellClass : 'text-right'
  566. , cellRenderer : function (params) {
  567. return params.value.addComma();
  568. }
  569. , hide : temp2
  570. },
  571. {
  572. headerName : "반품배송비"
  573. , field : "rtnDelvFee"
  574. , width : 80
  575. , cellClass : 'text-right'
  576. , cellRenderer : function (params) {
  577. return params.value.addComma();
  578. }
  579. , hide : temp2
  580. },
  581. {
  582. headerName : "교환배송비"
  583. , field : "excDelvFee"
  584. , width : 80
  585. , cellClass : 'text-right'
  586. , cellRenderer : function (params) {
  587. return params.value.addComma();
  588. }
  589. , hide : temp2
  590. },
  591. {headerName: "전체취소가능" , field: "allCanYn" , width: 100 , cellClass: 'text-center', hide: temp2},
  592. ]
  593. }
  594. ];
  595. var gridOptionsExchangeReqList = gagaAgGrid.getGridOptions(columnExchangeReqList);
  596. // Add on options
  597. gridOptionsExchangeReqList.suppressRowClickSelection = true;
  598. gridOptionsExchangeReqList.rowSelection = 'multiple';
  599. // 3. 배송정보(환불정보)
  600. var columnDelvCdList = [
  601. {headerName: "업체" , field: "supplyCompNm" , width: 100 , cellClass: 'text-center'},
  602. {headerName: "배송비코드" , field: "delvFeeCd" , width: 100 , cellClass: 'text-center'},
  603. {
  604. headerName : "추가배송비"
  605. , field : "addDelvFee"
  606. , width : 100
  607. , cellClass : 'text-right'
  608. , cellRenderer : function (params) {
  609. return params.value.addComma();
  610. }
  611. , hide : true
  612. },
  613. {headerName: "반품지명" , field: "rtnLocNm" , width: 100 , cellClass: 'text-center'},
  614. {headerName: "반품지전화번호" , field: "rtnLocTelno" , width: 100 , cellClass: 'text-center'},
  615. {headerName: "반품지우편번호" , field: "rtnLocZipcode" , width: 100 , cellClass: 'text-center'},
  616. {headerName: "반품지기본주소" , field: "rtnLocBaseAddr" , width: 300 , cellClass: 'text-center'},
  617. {headerName: "반품지상세주소" , field: "rtnLocDtlAddr" , width: 300 , cellClass: 'text-center'},
  618. ];
  619. var gridOptionsDelvCdList = gagaAgGrid.getGridOptions(columnDelvCdList);
  620. </script>
  621. <script>
  622. //현재 사유는 회사 입니다.
  623. var isCustomer = false;
  624. // 사유 변경
  625. var fnChangeChgReason = function(reasonCd){
  626. var arrReasonCd = reasonCd.split(":");
  627. var customerReasonArr = ['G689_10', 'G689_30', 'G688_10'];
  628. isCustomer = false;
  629. // 취소, 반품, 교환 사유 판단
  630. for (i=0 ; i<customerReasonArr.length ; i++) {
  631. if (customerReasonArr[i] == arrReasonCd[0]) {
  632. isCustomer = true;
  633. }
  634. }
  635. // 귀책사유설정 회사, 고객
  636. if (isCustomer) {
  637. $("#imputeReason").text("고객");
  638. if ($('#wdBfSendYn').is(':checked')) {
  639. $('#wdBfSendYn').prop('checked', false);
  640. }
  641. $('#wdBfSendYn').attr('disabled', true);
  642. } else {
  643. $("#imputeReason").text("회사");
  644. if (selfGoodsYn == 'Y' && (ordChgSq == null || ordChgSq <= 0)) {
  645. $('#wdBfSendYn').attr('disabled', false);
  646. }
  647. }
  648. $('#exchangeRequestFrm input[name=chgReason]').val(arrReasonCd[0]);
  649. $('#exchangeRequestFrm input[name=chgReasonDesc]').val(arrReasonCd[1]);
  650. // 추가배송비 설정
  651. fnChangeQty();
  652. }
  653. // 교환요청
  654. var fnExchange = function () {
  655. var qty = true;
  656. var opt = true;
  657. var wdGb = $('#wdGb:checked').val();
  658. if (ordChgGb == 'G681_50') {
  659. wdGb = 'D';
  660. }
  661. // 1. 교환수량 체크
  662. //$.each(cancelRequestTargetList, function(idx, item) {
  663. // if (item.chgQty > 0) {
  664. // qty = true;
  665. //
  666. // if (!gagajf.isNull(item.ordChgOpt)) {
  667. // opt = true;
  668. // }
  669. // }
  670. //});
  671. // 교환TO교환, 반품TO교환 신청 수량 설정
  672. if (ordChgGb == 'G681_20' || ordChgGb == 'G681_40') {
  673. exchangeRequestList = cancelRequestTargetList;
  674. //$.each(exchangeRequestList, function(idx, exchangeRequest) {
  675. // $.each(exchangeInfoList , function(idx2, exchangeInfo) {
  676. // if (exchangeRequest.itemCd == exchangeInfo.itemCd && exchangeRequest.optCd1 == exchangeInfo.optCd1) {
  677. // exchangeRequest.chgQty = exchangeInfo.chgQty;
  678. // }
  679. // });
  680. //});
  681. }
  682. $.each(exchangeRequestList, function(idx, item) {
  683. if (item.chgQty == null || item.chgQty == 0) {
  684. qty = false;
  685. }
  686. if (gagajf.isNull(item.ordChgOpt)) {
  687. opt = false;
  688. }
  689. });
  690. if (qty == false) {
  691. mcxDialog.alert('교환 할 수량을 입력하세요.');
  692. return;
  693. }
  694. if (opt == false) {
  695. mcxDialog.alert('교환옵션을 선택해주세요.');
  696. return;
  697. }
  698. // 2. 교환사유 체크
  699. var chgReason = $("#exchangeRequestFrm select[name=selectChgReason]").val();
  700. if (ordChgGb == 'G681_20' || chgStat == 'G685_22') {
  701. chgReason = $('#exchangeRequestFrm input[name=chgReason]').val();
  702. }
  703. //var chgReason = $('#exchangeRequestFrm input[name=chgReason]').val();
  704. if (gagajf.isNull(chgReason)) {
  705. mcxDialog.alert("교환사유를 입력하세요.");
  706. return;
  707. }
  708. // 5. 회수지정보설정
  709. var chgerNm = "";
  710. var chgerZipcode = "";
  711. var chgerBaseAddr = "";
  712. var chgerDtlAddr = "";
  713. var chgerPhnno1 = "";
  714. var chgerPhnno2 = "";
  715. var chgerPhnno3 = "";
  716. var chgerTelno1 = "";
  717. var chgerTelno2 = "";
  718. var chgerTelno3 = "";
  719. var chgerPhnno = "";
  720. var chgerTelno = "";
  721. var chgerEmail = "";
  722. var chgerRtnMemo = "";
  723. if (wdGb == 'W' && selfGoodsYn == 'Y') {
  724. chgerNm = $("#exchangeRequestFrm input[name=chgerNm]").val();
  725. chgerZipcode = $("#exchangeRequestFrm input[name=chgerZipcode]").val();
  726. chgerBaseAddr = $("#exchangeRequestFrm input[name=chgerBaseAddr]").val();
  727. chgerDtlAddr = $("#exchangeRequestFrm input[name=chgerDtlAddr]").val();
  728. chgerPhnno1 = $("#exchangeRequestFrm select[name=chgerPhnno1]").val();
  729. chgerPhnno2 = $("#exchangeRequestFrm input[name=chgerPhnno2]").val();
  730. chgerPhnno3 = $("#exchangeRequestFrm input[name=chgerPhnno3]").val();
  731. chgerTelno1 = $("#exchangeRequestFrm select[name=chgerTelno1]").val();
  732. chgerTelno2 = $("#exchangeRequestFrm input[name=chgerTelno2]").val();
  733. chgerTelno3 = $("#exchangeRequestFrm input[name=chgerTelno3]").val();
  734. chgerRtnMemo = $("#exchangeRequestFrm textarea[name=chgerRtnMemo]").val();
  735. if (gagajf.isNull(chgerZipcode)) {
  736. mcxDialog.alert("회수지주소를 입력하세요."); return;
  737. }
  738. if (gagajf.isNull(chgerBaseAddr)) {
  739. mcxDialog.alert("회수지주소를 입력하세요."); return;
  740. }
  741. if (gagajf.isNull(chgerDtlAddr)) {
  742. mcxDialog.alert("회수지주소를 입력하세요."); return;
  743. }
  744. if (gagajf.isNull(chgerPhnno1)) {
  745. mcxDialog.alert("휴대전화를 입력하세요."); return;
  746. }
  747. if (gagajf.isNull(chgerPhnno2)) {
  748. mcxDialog.alert("휴대전화를 입력하세요."); return;
  749. }
  750. if (gagajf.isNull(chgerPhnno3)) {
  751. mcxDialog.alert("휴대전화를 입력하세요."); return;
  752. }
  753. chgerPhnno = chgerPhnno1 + '-' + chgerPhnno2 + '-' + chgerPhnno3;
  754. chgerEmail = orderInfoList[0].ordEmail;
  755. if (gagajf.isNull(chgerTelno1) && gagajf.isNull(chgerTelno2) && gagajf.isNull(chgerTelno3)) {
  756. chgerTelno = '';
  757. } else {
  758. chgerTelno = chgerTelno1 + '-' + chgerTelno2 + '-' + chgerTelno3;
  759. }
  760. }
  761. // 교환지정보 설정
  762. var recipNm = $("#exchangeRequestFrm input[name=recipNm]").val();
  763. var recipZipcode = $("#exchangeRequestFrm input[name=recipZipcode]").val();
  764. var recipBaseAddr = $("#exchangeRequestFrm input[name=recipBaseAddr]").val();
  765. var recipDtlAddr = $("#exchangeRequestFrm input[name=recipDtlAddr]").val();
  766. var recipPhnno1 = $("#exchangeRequestFrm select[name=recipPhnno1]").val();
  767. var recipPhnno2 = $("#exchangeRequestFrm input[name=recipPhnno2]").val();
  768. var recipPhnno3 = $("#exchangeRequestFrm input[name=recipPhnno3]").val();
  769. var recipTelno1 = $("#exchangeRequestFrm select[name=recipTelno1]").val();
  770. var recipTelno2 = $("#exchangeRequestFrm input[name=recipTelno2]").val();
  771. var recipTelno3 = $("#exchangeRequestFrm input[name=recipTelno3]").val();
  772. if (gagajf.isNull(recipZipcode)) {
  773. mcxDialog.alert("교환지주소를 입력하세요."); return;
  774. }
  775. if (gagajf.isNull(recipBaseAddr)) {
  776. mcxDialog.alert("교환지주소를 입력하세요."); return;
  777. }
  778. if (gagajf.isNull(recipDtlAddr)) {
  779. mcxDialog.alert("교환지주소를 입력하세요."); return;
  780. }
  781. if (gagajf.isNull(recipPhnno1)) {
  782. mcxDialog.alert("휴대전화를 입력하세요."); return;
  783. }
  784. if (gagajf.isNull(recipPhnno2)) {
  785. mcxDialog.alert("휴대전화를 입력하세요."); return;
  786. }
  787. if (gagajf.isNull(recipPhnno3)) {
  788. mcxDialog.alert("휴대전화를 입력하세요."); return;
  789. }
  790. var recipPhnno = recipPhnno1 + '-' + recipPhnno2 + '-' + recipPhnno3;
  791. var recipEmail = orderInfoList[0].ordEmail;
  792. var recipTelno;
  793. if (gagajf.isNull(recipTelno1) && gagajf.isNull(recipTelno2) && gagajf.isNull(recipTelno3)) {
  794. recipTelno = '';
  795. } else {
  796. recipTelno = recipTelno1 + '-' + recipTelno2 + '-' + recipTelno3;
  797. }
  798. // 선발송 여부 설정
  799. let wdBfSendYn = $('#wdBfSendYn').is(':checked') ? 'Y' : 'N';
  800. var jsonObj = {
  801. "ordNo" : $('#exchangeRequestFrm input[name=ordNo]').val()
  802. ,"chgReason" : $('#exchangeRequestFrm input[name=chgReason]').val()
  803. ,"chgMemo" : $('#chgMemo').val()
  804. ,"cancelReqList" : exchangeRequestList
  805. ,"isCustomer" : isCustomer
  806. ,"wdGb" : wdGb
  807. ,"addPayCost" : addDelvFee
  808. ,"chgerNm" : chgerNm
  809. ,"chgerEmail" : chgerEmail
  810. ,"chgerZipcode" : chgerZipcode
  811. ,"chgerBaseAddr" : chgerBaseAddr
  812. ,"chgerDtlAddr" : chgerDtlAddr
  813. ,"chgerPhnno" : chgerPhnno
  814. ,"chgerTelno" : chgerTelno
  815. ,"chgerRtnMemo" : chgerRtnMemo
  816. ,"recipNm" : recipNm
  817. ,"recipEmail" : recipEmail
  818. ,"recipZipcode" : recipZipcode
  819. ,"recipBaseAddr" : recipBaseAddr
  820. ,"recipDtlAddr" : recipDtlAddr
  821. ,"recipPhnno" : recipPhnno
  822. ,"recipTelno" : recipTelno
  823. ,"delvMemo" : $("#exchangeRequestFrm textarea[name=delvMemo]").val()
  824. ,"ordChgSq" : ordChgSq
  825. ,"wdBfSendYn" : wdBfSendYn
  826. ,"ordChgGb" : ordChgGb
  827. }
  828. // 주문번호, 교환사유, 교환메모, (취소, 반품, 교환 신청 정보 목록)
  829. var jsonData = JSON.stringify(jsonObj);
  830. // URL 설정
  831. var url;
  832. if (ordChgGb == 'G681_40') {
  833. url = '/orderChange/return/to/exchange/';
  834. } else if (ordChgGb == 'G681_20') {
  835. url = '/orderChange/exchange/to/exchange/';
  836. } else if (chgStat == 'G685_22') {
  837. url = '/orderChange/exchange/approval/';
  838. } else {
  839. url = '/orderChange/exchange/request/';
  840. }
  841. mcxDialog.confirm('교환요청하시겠습니까?', {
  842. cancelBtnText : "취소",
  843. sureBtnClick : function(){
  844. // 교환 실행
  845. gagajf.ajaxJsonSubmit(
  846. url
  847. , jsonData
  848. , function() {
  849. if (chgStat == 'G685_22') {
  850. uifnPopupClose('popupExchangeRequestForm');
  851. fnSearchList();
  852. } else {
  853. uifnPopupClose('popupOrderDetail');
  854. fnReOpenOrderDetailPopup();
  855. uifnPopupClose('popupExchangeRequestForm');
  856. }
  857. }
  858. );
  859. }
  860. });
  861. }
  862. // 교환철회 처리
  863. var fnExchangeCancel = function() {
  864. let data = {};
  865. data.ordChgSq = ordChgSq;
  866. data.ordNo = ordNo;
  867. let jsonData = JSON.stringify(data);
  868. mcxDialog.confirm('요청번호 [' + ordChgSq + '] 에 대한 요청철회 처리를 하시겠습니까?', {
  869. cancelBtnText : "취소",
  870. sureBtnClick : function(){
  871. // 교환 실행
  872. gagajf.ajaxJsonSubmit(
  873. '/orderChange/exchangeCancelRequest/'
  874. , jsonData
  875. , function() {
  876. uifnPopupClose('popupOrderDetail');
  877. fnReOpenOrderDetailPopup();
  878. uifnPopupClose('popupExchangeRequestForm');
  879. }
  880. );
  881. }
  882. });
  883. }
  884. // 네이버페이 주문형 교환보류 버튼 클릭 이벤트
  885. var fnNpayExchangeHold = function(param) {
  886. let url = '/orderChange/nPay/order/exchange/hold';
  887. let npayChangeHoldYn = $(param).attr('npayChangeHoldYn');
  888. let data = {};
  889. data.cancelReqList = exchangeRequestList;
  890. data.npayChangeHoldYn = npayChangeHoldYn;
  891. data.ordChgSq = ordChgSq;
  892. let jsonData = JSON.stringify(data);
  893. gagajf.ajaxJsonSubmit(url, jsonData, function(result) {
  894. uifnPopupClose('popupOrderDetail');
  895. fnReOpenOrderDetailPopup();
  896. uifnPopupClose('popupExchangeRequestForm');
  897. });
  898. }
  899. // 우편번호 DAUM을 이용한 우편번호 팝업 레이어
  900. var fnOpenDaumAddr = function(loc) {
  901. let daumZip = new daum.Postcode({
  902. oncomplete: function(data) {
  903. // 우편번호와 주소 정보를 해당 필드에 넣는다.
  904. if (loc == 'withdraw') {
  905. $('#exchangeRequestFrm input[name=chgerZipcode]').val(data.zonecode);
  906. $('#exchangeRequestFrm input[name=chgerBaseAddr]').val(cfnGetDaumRoadAddr(data));
  907. $('#exchangeRequestFrm input[name=chgerDtlAddr]').focus();
  908. } else if (loc == 'exchange') {
  909. $('#exchangeRequestFrm input[name=recipZipcode]').val(data.zonecode);
  910. $('#exchangeRequestFrm input[name=recipBaseAddr]').val(cfnGetDaumRoadAddr(data));
  911. $('#exchangeRequestFrm input[name=recipDtlAddr]').focus();
  912. }
  913. cfnCloseDaumAddr();
  914. },
  915. width: '100%'
  916. });
  917. cfnOpenDaumAddr(daumZip);
  918. }
  919. // 회수지정보 설정
  920. var fnSetChger = function(){
  921. var data;
  922. if (ordChgSq > 0) {
  923. data = orderChangeDetailList[0];
  924. data.recipPhnno = data.chgerPhnno;
  925. data.recipTelno = data.chgerTelno;
  926. data.recipNm = data.chgerNm;
  927. data.recipZipcode = data.chgerZipcode;
  928. data.recipBaseAddr = data.chgerBaseAddr;
  929. data.recipDtlAddr = data.chgerDtlAddr;
  930. } else {
  931. data = orderDelvAddrInfo[0];
  932. }
  933. var spRecipPhnno = (data.recipPhnno != null) ? data.recipPhnno.split('-') : null;
  934. var spRecipTelno = (data.recipTelno != null) ? data.recipTelno.split('-') : null;
  935. $("#exchangeRequestFrm input[name=chgerNm]").val(data.recipNm);
  936. $("#exchangeRequestFrm input[name=chgerZipcode]").val(data.recipZipcode);
  937. $("#exchangeRequestFrm input[name=chgerBaseAddr]").val(data.recipBaseAddr);
  938. $("#exchangeRequestFrm input[name=chgerDtlAddr]").val(data.recipDtlAddr);
  939. $("#exchangeRequestFrm textarea[name=chgerRtnMemo]").val(data.chgerRtnMemo);
  940. if (spRecipPhnno) {
  941. $("#exchangeRequestFrm select[name=chgerPhnno1]").val(spRecipPhnno[0]);
  942. $("#exchangeRequestFrm input[name=chgerPhnno2]").val(spRecipPhnno[1]);
  943. $("#exchangeRequestFrm input[name=chgerPhnno3]").val(spRecipPhnno[2]);
  944. }
  945. if (spRecipTelno) {
  946. $("#exchangeRequestFrm select[name=chgerTelno1]").val(spRecipTelno[0]);
  947. $("#exchangeRequestFrm input[name=chgerTelno2]").val(spRecipTelno[1]);
  948. $("#exchangeRequestFrm input[name=chgerTelno3]").val(spRecipTelno[2]);
  949. }
  950. }
  951. // 교환지정보 설정
  952. var fnSetExchangeAddr = function(){
  953. var data;
  954. if (ordChgSq > 0 && ordChgGb != 'G681_40') {
  955. data = exchangeInfoList[0];
  956. } else {
  957. data = orderDelvAddrInfo[0];
  958. }
  959. var spRecipPhnno = (data.recipPhnno != null) ? data.recipPhnno.split('-') : null;
  960. var spRecipTelno = (data.recipTelno != null) ? data.recipTelno.split('-') : null;
  961. $("#exchangeRequestFrm input[name=recipNm]").val(data.recipNm);
  962. $("#exchangeRequestFrm input[name=recipZipcode]").val(data.recipZipcode);
  963. $("#exchangeRequestFrm input[name=recipBaseAddr]").val(data.recipBaseAddr);
  964. $("#exchangeRequestFrm input[name=recipDtlAddr]").val(data.recipDtlAddr);
  965. $("#exchangeRequestFrm textarea[name=delvMemo]").val(data.delvMemo);
  966. if (spRecipPhnno) {
  967. $("#exchangeRequestFrm select[name=recipPhnno1]").val(spRecipPhnno[0]);
  968. $("#exchangeRequestFrm input[name=recipPhnno2]").val(spRecipPhnno[1]);
  969. $("#exchangeRequestFrm input[name=recipPhnno3]").val(spRecipPhnno[2]);
  970. }
  971. if (spRecipTelno) {
  972. $("#exchangeRequestFrm select[name=recipTelno1]").val(spRecipTelno[0]);
  973. $("#exchangeRequestFrm input[name=recipTelno2]").val(spRecipTelno[1]);
  974. $("#exchangeRequestFrm input[name=recipTelno3]").val(spRecipTelno[2]);
  975. }
  976. }
  977. // 교환옵션 변경 이벤트
  978. var fnChangeOption = function(param) {
  979. var opt = $(param).val().split('/');
  980. var optCd = opt[0];
  981. var optCd2 = opt[1];
  982. var ordDtlNo = $(param).attr('ordDtlNo');
  983. var ordDtlItemSq = $(param).attr('ordDtlItemSq');
  984. $.each(cancelRequestTargetList, function(idx, item){
  985. if (item.ordDtlNo == ordDtlNo && item.ordDtlItemSq == ordDtlItemSq) {
  986. var stockQtyArr = item.currStockQtys.split(',');
  987. var sizeCdArr = item.optCd2s.split(',');
  988. var stockIdx = sizeCdArr.indexOf(optCd2);
  989. var stockQty = stockQtyArr[stockIdx];
  990. item.currStockQty = stockQty;
  991. item.ordChgOpt = optCd;
  992. }
  993. });
  994. //gridOptionsExchangeReqList.api.setRowData(cancelRequestTargetList);
  995. }
  996. // 교환수량 변경 이벤트
  997. var fnChangeQty = function(param) {
  998. var chgQty = $(param).val();
  999. var ordDtlNo = $(param).attr('ordDtlNo');
  1000. var exchangeRequestTargetList = [];
  1001. $.each(cancelRequestTargetList, function(idx, item){
  1002. if (item.ordDtlNo == ordDtlNo) {
  1003. if (gagajf.isNull(item.ordChgOpt) && chgQty > 0) {
  1004. mcxDialog.alert('교환옵션을 선택해주세요.');
  1005. return false;
  1006. }
  1007. item.chgQty = chgQty;
  1008. if (chgQty > 0) {
  1009. exchangeRequestTargetList.push(item);
  1010. }
  1011. } else if (item.chgQty > 0) {
  1012. exchangeRequestTargetList.push(item);
  1013. } else if (ordChgSq > 0 && item.ordCanChgQty > 0) {
  1014. exchangeRequestTargetList.push(item);
  1015. }
  1016. });
  1017. // 추가배송비 설정
  1018. fnAddDelvFee(exchangeRequestTargetList);
  1019. // 교환대상목록 설정
  1020. exchangeRequestList = exchangeRequestTargetList;
  1021. //gridOptionsExchangeReqList.api.setRowData(cancelRequestTargetList);
  1022. }
  1023. // 추가배송비 설정
  1024. var fnAddDelvFee = function (exchangeRequestTargetList) {
  1025. var delvCdList = [];
  1026. var delvFeeList = [];
  1027. var delvFee = 0;
  1028. // 고객 귀책사유에 한하여 추가배송비 설정
  1029. $.each(exchangeRequestTargetList, function (idx, item) {
  1030. if (!delvCdList.includes(item.delvFeeCd)) {
  1031. if (isCustomer) {
  1032. var delvFeeTmp = $('#wdGb:checked').val() == 'W' ? item.excDelvFee : item.rtnDelvFee;
  1033. delvFee += delvFeeTmp;
  1034. item.addDelvFeeYn = 'Y';
  1035. item.addDelvFee = delvFeeTmp;
  1036. } else {
  1037. item.addDelvFeeYn = 'N';
  1038. item.addDelvFee = 0;
  1039. }
  1040. delvCdList.push(item.delvFeeCd);
  1041. delvFeeList.push(item);
  1042. }
  1043. });
  1044. addDelvFee = delvFee;
  1045. //addDelvFeeList = delvFeeList;
  1046. // 회수방법 > 직접발송일 경우 그리드 표시
  1047. // 2021.07.19 그리드 표시 여부 처리 변경
  1048. //if ($('#wdGb:checked').val() == 'D') {
  1049. // gridOptionsDelvCdList.api.setRowData(addDelvFeeList);
  1050. //} else {
  1051. // gridOptionsDelvCdList.api.setRowData();
  1052. //}
  1053. if (ordChgSq > 0) {
  1054. $('#addDelvFee').text(addPayCost.addComma() + '원');
  1055. } else {
  1056. $('#addDelvFee').text(addDelvFee.addComma() + '원');
  1057. }
  1058. }
  1059. // 회수방법 라디오 클릭 이벤트
  1060. var fnChangeWdGb = function(param) {
  1061. let wdGb = $(param).val();
  1062. // 회수지정보 히든 처리
  1063. if (wdGb == 'D') {
  1064. $('.chger').css('display', 'none');
  1065. $('#delvCdList').css('display', '');
  1066. } else {
  1067. $('.chger').css('display', '');
  1068. $('#delvCdList').css('display', 'none');
  1069. if (ordChgSq == 0) {
  1070. $('#chgerButton').css('display', 'none');
  1071. }
  1072. }
  1073. // 추가배송비 계산
  1074. fnChangeQty();
  1075. }
  1076. // 회수지 정보 수정
  1077. var fnChangeChgerInfo = function() {
  1078. let url = '/orderChange/change/chger/addr';
  1079. let chgerNm = $("#exchangeRequestFrm input[name=chgerNm]").val();
  1080. let chgerZipcode = $("#exchangeRequestFrm input[name=chgerZipcode]").val();
  1081. let chgerBaseAddr = $("#exchangeRequestFrm input[name=chgerBaseAddr]").val();
  1082. let chgerDtlAddr = $("#exchangeRequestFrm input[name=chgerDtlAddr]").val();
  1083. let chgerPhnno1 = $("#exchangeRequestFrm select[name=chgerPhnno1]").val();
  1084. let chgerPhnno2 = $("#exchangeRequestFrm input[name=chgerPhnno2]").val();
  1085. let chgerPhnno3 = $("#exchangeRequestFrm input[name=chgerPhnno3]").val();
  1086. let chgerTelno1 = $("#exchangeRequestFrm select[name=chgerTelno1]").val();
  1087. let chgerTelno2 = $("#exchangeRequestFrm input[name=chgerTelno2]").val();
  1088. let chgerTelno3 = $("#exchangeRequestFrm input[name=chgerTelno3]").val();
  1089. if (gagajf.isNull(chgerZipcode)) {
  1090. mcxDialog.alert("회수지주소를 입력하세요."); return;
  1091. }
  1092. if (gagajf.isNull(chgerBaseAddr)) {
  1093. mcxDialog.alert("회수지주소를 입력하세요."); return;
  1094. }
  1095. if (gagajf.isNull(chgerDtlAddr)) {
  1096. mcxDialog.alert("회수지주소를 입력하세요."); return;
  1097. }
  1098. if (gagajf.isNull(chgerPhnno1)) {
  1099. mcxDialog.alert("휴대전화를 입력하세요."); return;
  1100. }
  1101. if (gagajf.isNull(chgerPhnno2)) {
  1102. mcxDialog.alert("휴대전화를 입력하세요."); return;
  1103. }
  1104. if (gagajf.isNull(chgerPhnno3)) {
  1105. mcxDialog.alert("휴대전화를 입력하세요."); return;
  1106. }
  1107. let chgerPhnno = chgerPhnno1 + '-' + chgerPhnno2 + '-' + chgerPhnno3;
  1108. let chgerRtnMemo = $("#exchangeRequestFrm textarea[name=chgerRtnMemo]").val();
  1109. let chgerTelno = '';
  1110. if (!gagajf.isNull(chgerTelno1) && !gagajf.isNull(chgerTelno2) && !gagajf.isNull(chgerTelno3)) {
  1111. chgerTelno = chgerTelno1 + '-' + chgerTelno2 + '-' + chgerTelno3;
  1112. }
  1113. let data = {};
  1114. data.ordChgSq = ordChgSq;
  1115. data.chgerNm = chgerNm;
  1116. data.chgerPhnno = chgerPhnno;
  1117. data.chgerZipcode = chgerZipcode;
  1118. data.chgerBaseAddr = chgerBaseAddr;
  1119. data.chgerDtlAddr = chgerDtlAddr;
  1120. data.chgerRtnMemo = chgerRtnMemo;
  1121. let jsonData = JSON.stringify(data);
  1122. gagajf.ajaxJsonSubmit(url, jsonData, function(result){
  1123. });
  1124. }
  1125. // 교환지 정보 수정
  1126. var fnChangeRecipInfo = function() {
  1127. let url = '/order/deliver/addr/update';
  1128. var recipNm = $("#exchangeRequestFrm input[name=recipNm]").val();
  1129. var recipZipcode = $("#exchangeRequestFrm input[name=recipZipcode]").val();
  1130. var recipBaseAddr = $("#exchangeRequestFrm input[name=recipBaseAddr]").val();
  1131. var recipDtlAddr = $("#exchangeRequestFrm input[name=recipDtlAddr]").val();
  1132. var delvMemo = $("#exchangeRequestFrm textarea[name=delvMemo]").val();
  1133. var recipPhnno1 = $("#exchangeRequestFrm select[name=recipPhnno1]").val();
  1134. var recipPhnno2 = $("#exchangeRequestFrm input[name=recipPhnno2]").val();
  1135. var recipPhnno3 = $("#exchangeRequestFrm input[name=recipPhnno3]").val();
  1136. var recipTelno1 = $("#exchangeRequestFrm select[name=recipTelno1]").val();
  1137. var recipTelno2 = $("#exchangeRequestFrm input[name=recipTelno2]").val();
  1138. var recipTelno3 = $("#exchangeRequestFrm input[name=recipTelno3]").val();
  1139. if (gagajf.isNull(recipZipcode)) {
  1140. mcxDialog.alert("교환지주소를 입력하세요."); return;
  1141. }
  1142. if (gagajf.isNull(recipBaseAddr)) {
  1143. mcxDialog.alert("교환지주소를 입력하세요."); return;
  1144. }
  1145. if (gagajf.isNull(recipDtlAddr)) {
  1146. mcxDialog.alert("교환지주소를 입력하세요."); return;
  1147. }
  1148. if (gagajf.isNull(recipPhnno1)) {
  1149. mcxDialog.alert("휴대전화를 입력하세요."); return;
  1150. }
  1151. if (gagajf.isNull(recipPhnno2)) {
  1152. mcxDialog.alert("휴대전화를 입력하세요."); return;
  1153. }
  1154. if (gagajf.isNull(recipPhnno3)) {
  1155. mcxDialog.alert("휴대전화를 입력하세요."); return;
  1156. }
  1157. var recipPhnno = recipPhnno1 + '-' + recipPhnno2 + '-' + recipPhnno3;
  1158. var recipTelno;
  1159. if (gagajf.isNull(recipTelno1) && gagajf.isNull(recipTelno2) && gagajf.isNull(recipTelno3)) {
  1160. recipTelno = '';
  1161. } else {
  1162. recipTelno = recipTelno1 + '-' + recipTelno2 + '-' + recipTelno3;
  1163. }
  1164. let data = {};
  1165. data.delvAddrSq = delvAddrSq;
  1166. data.recipNm = recipNm;
  1167. data.recipPhnno = recipPhnno;
  1168. data.recipZipcode = recipZipcode;
  1169. data.recipBaseAddr = recipBaseAddr;
  1170. data.recipDtlAddr = recipDtlAddr;
  1171. data.delvMemo = delvMemo;
  1172. let jsonData = JSON.stringify(data);
  1173. gagajf.ajaxJsonSubmit(url, jsonData, function(result){
  1174. });
  1175. }
  1176. $(document).ready(function() {
  1177. // 1. 그리드생성
  1178. gagaAgGrid.createGrid('gridOrderCancelRequestList' , gridOptionsExchangeReqList); // 주문정보
  1179. gagaAgGrid.createGrid('gridDelvCdList' , gridOptionsDelvCdList); // 배송정보
  1180. gridOptionsExchangeReqList.api.setRowData(cancelRequestTargetList);
  1181. gridOptionsDelvCdList.api.setRowData(rtnLocInfo);
  1182. // 2.1 TOTAL ROWS 없애기
  1183. gagaAgGrid.hideStatusBar('gridOrderCancelRequestList');
  1184. gagaAgGrid.hideStatusBar('gridOrderCancelRequestToBeList');
  1185. gagaAgGrid.hideStatusBar('gridDelvCdList');
  1186. // 3. 회수지정보설정
  1187. fnSetChger();
  1188. // 4. 교환지정보설정
  1189. fnSetExchangeAddr();
  1190. // 5. 회수방법 라디오 체크 처리
  1191. if (ordChgGb == 'G681_50') {
  1192. $('input:radio[name="wdGb"]:radio[value="D"]').prop('checked', true);
  1193. $('.chger').css('display', 'none');
  1194. $('input:radio[name=wdGb]').attr('disabled', true);
  1195. $('#delvCdList').css('display', 'none');
  1196. }
  1197. // 2021.07.15 입점업체인 경우에는 회수요청만 해당
  1198. else if (selfGoodsYn == "N") {
  1199. $('input:radio[name="wdGb"]:radio[value="W"]').prop('checked', true);
  1200. $('.chger').css('display', 'none');
  1201. $('input:radio[name=wdGb]').attr('disabled', true);
  1202. } else {
  1203. if (wdGb == 'D') {
  1204. $('input:radio[name="wdGb"]:radio[value="D"]').prop('checked', true);
  1205. $('.chger').css('display', 'none');
  1206. } else {
  1207. $('input:radio[name="wdGb"]:radio[value="W"]').prop('checked', true);
  1208. $('#delvCdList').css('display', 'none');
  1209. }
  1210. }
  1211. // 교환철회 처리
  1212. if (ordChgSq > 0) {
  1213. // 5. 교환사유설정
  1214. $('#chgReason').text(chgReasonNm);
  1215. // 6. 교환요청메모설정
  1216. $('#chgMemo').text(chgMemo);
  1217. // 7. 귀책사유 설정
  1218. fnChangeChgReason(chgReason);
  1219. // 8. 데이터 Disabled 처리
  1220. $('input:radio[name=wdGb]').attr('disabled', true); // 8-1. 회수방법
  1221. $('input[name=chgerBaseAddr]').attr('readOnly', true); // 8-4. 회수지정보 > 기본주소
  1222. $('input[name=recipBaseAddr]').attr('readOnly', true); // 8-10. 교환지정보 > 기본주소
  1223. $('#chgMemo').attr('readOnly', true); // 8-2. 요청메모
  1224. // 2021.06.25 교환접수, 교환대기 상태에서는 회수지 정보 수정 가능
  1225. if (!gagajf.isNull(ordChgGb) || (chgStat != 'G685_20' && chgStat != 'G685_21') || pgGb == 'NAVER_ORDER') {
  1226. $('input[name=chgerNm]').attr('readOnly', true); // 8-3. 회수지정보 > 보내는사람
  1227. $('input[name=chgerDtlAddr]').attr('readOnly', true); // 8-5. 회수지정보 > 상세주소
  1228. $('select[name=chgerTelno1]').attr('disabled', true); // 8-6. 회수지정보 > 일반전화
  1229. $('input[name=chgerTelno2]').attr('readOnly', true); // 8-6. 회수지정보 > 일반전화
  1230. $('input[name=chgerTelno3]').attr('readOnly', true); // 8-6. 회수지정보 > 일반전화
  1231. $('select[name=chgerPhnno1]').attr('disabled', true); // 8-7. 회수지정보 > 휴대전화
  1232. $('input[name=chgerPhnno2]').attr('readOnly', true); // 8-7. 회수지정보 > 휴대전화
  1233. $('input[name=chgerPhnno3]').attr('readOnly', true); // 8-7. 회수지정보 > 휴대전화
  1234. $('#chgerRtnMemo').attr('readOnly', true); // 8-8. 회수지정보 > 반품메모
  1235. $('#chgerButton').css('display', 'none'); // 회수지 수정 버튼
  1236. $('#chgerFindAddr').css('display', 'none'); // 회수지 우편번호 찾기 버튼
  1237. }
  1238. // 2021.06.25 교환상품 배송중 상태 전까지 정보 수정 가능
  1239. if (ordChgGb == 'G681_20' || (chgStat == 'G685_40' && (chgOrdDtlStat != 'G013_20' && chgOrdDtlStat != 'G013_30' && chgOrdDtlStat != 'G013_35')) || chgStat == 'G685_22' || pgGb == 'NAVER_ORDER') {
  1240. $('input[name=recipNm]').attr('readOnly', true); // 8-9. 교환지정보 > 받는사람
  1241. $('input[name=recipDtlAddr]').attr('readOnly', true); // 8-11. 교환지정보 > 상세주소
  1242. $('select[name=recipTelno1]').attr('disabled', true); // 8-12. 교환지정보 > 일반전화
  1243. $('input[name=recipTelno2]').attr('readOnly', true); // 8-12. 교환지정보 > 일반전화
  1244. $('input[name=recipTelno3]').attr('readOnly', true); // 8-12. 교환지정보 > 일반전화
  1245. $('select[name=recipPhnno1]').attr('disabled', true); // 8-13. 교환지정보 > 휴대전화
  1246. $('input[name=recipPhnno2]').attr('readOnly', true); // 8-13. 교환지정보 > 휴대전화
  1247. $('input[name=recipPhnno3]').attr('readOnly', true); // 8-13. 교환지정보 > 휴대전화
  1248. $('#delvMemo').attr('readOnly', true); // 8-14. 교환지정보 > 배송메모
  1249. $('#recipButton').css('display', 'none'); // 교환지 수정 버튼
  1250. $('#recipFindAddr').css('display', 'none'); // 교환지 우편번호 찾기 버튼
  1251. }
  1252. // 반품TO교환
  1253. if (ordChgGb == 'G681_40') {
  1254. $('#recipButton').css('display', 'none'); // 교환지 수정 버튼
  1255. }
  1256. // 네이버페이 주문형 보류 버튼 처리
  1257. if (!gagajf.isNull(npayChangeHoldYn)) {
  1258. if (npayChangeHoldYn == 'Y') {
  1259. $('#fnExchangeHold').css('display', 'none');
  1260. } else {
  1261. $('#fnReleaseExchangeHold').css('display', 'none');
  1262. }
  1263. }
  1264. } else {
  1265. $('#chgerButton').css('display', 'none'); // 회수지 수정 버튼
  1266. $('#recipButton').css('display', 'none'); // 교환지 수정 버튼
  1267. }
  1268. // 글자수 제한 byte 표기
  1269. cfnGetTextLength($('#chgMemo'), 1000, $('#chgMemoCount'));
  1270. cfnGetTextLength($('#chgerRtnMemo'), 1000, $('#chgerRtnMemoCount'));
  1271. cfnGetTextLength($('#delvMemo'), 1000, $('#delvMemoCount'));
  1272. });
  1273. </script>
  1274. </html>