ExchangeRequestForm.html 51 KB

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