ExchangeRequestForm.html 46 KB

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