ExchangeRequestForm.html 48 KB

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