OrderWithdrawConfirmForm.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <!DOCTYPE html>
  2. <html lang="ko" xmlns:th="http://www.thymeleaf.org">
  3. <!--
  4. *******************************************************************************
  5. * @source : OrderWithdrawConfirmForm.html
  6. * @desc : 입점업체 회수컨펌 화면
  7. *============================================================================
  8. * STYLE24
  9. * Copyright(C) 2019 TSIT, All rights reserved.
  10. *============================================================================
  11. * VER DATE AUTHOR DESCRIPTION
  12. * === =========== ========== =============================================
  13. * 1.0 2021.05.18 jsh77b 최초 작성
  14. *******************************************************************************
  15. -->
  16. <div class="modalPopup" data-width="1400" data-height="520">
  17. <div class="panelStyle">
  18. <div class="panelTitle">
  19. <h2>회수컨펌</h2>
  20. <button type="button" class="close" onclick="uifnPopupClose('popupReturnRequestForm');"><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="cancelRequestFrm" name="cancelRequestFrm" method="post" target="hdFrameForOrderCancel">
  24. <input type="hidden" name="ordNo" th:value="${ordNo}"/>
  25. <input type="hidden" name="ordChgSq" th:value="${ordChgSq}"/>
  26. <input type="hidden" name="chgReason" th:value="${chgReason}"/>
  27. <th:block th:if="${chgGb} == 'G680_30'">
  28. <h4>반품정보</h4>
  29. </th:block>
  30. <th:block th:if="${chgGb} == 'G680_40'">
  31. <h4>교환정보</h4>
  32. </th:block>
  33. <div id="gridOrderWithdrawList" style="width:100%; height: 200px;" class="ag-theme-balham"></div>
  34. <div style="text-align:right; padding-bottom:5px; padding-top:5px;">
  35. <button type="button" class="btn btn-success" id="widthdrawConfirmBtn">회수컨펌</button>
  36. </div>
  37. <table class="frmStyle">
  38. <colgroup>
  39. <col style="width:160px;" />
  40. <col style="width:320px;" />
  41. <col style="width:160px;" />
  42. <col style="width:320px;" />
  43. <col style="width:160px;" />
  44. <col />
  45. </colgroup>
  46. <tbody>
  47. <tr>
  48. <!-- 반품회수 -->
  49. <th:block th:if="${chgGb} == 'G680_30'">
  50. <th>반품사유 <i class="star"></i></th>
  51. <td>
  52. <select name="selectChgReason" onchange="fnChangeChgReason($(this).val());">
  53. <option value="">[선택하세요]</option>
  54. <th:block th:if="${chgReasonList1}" th:each="oneData, status : ${chgReasonList1}">
  55. <th:block th:if="${oneData.cd} == ${chgReason}">
  56. <option th:value="|${oneData.cd}|" th:text="|${oneData.cdNm}|" selected></option>
  57. </th:block>
  58. <th:block th:unless="${oneData.cd} == ${chgReason}">
  59. <option th:value="|${oneData.cd}|" th:text="|${oneData.cdNm}|"></option>
  60. </th:block>
  61. </th:block>
  62. </select>
  63. </td>
  64. </th:block>
  65. <!-- //반품회수 -->
  66. <!-- 교환회수 -->
  67. <th:block th:if="${chgGb} == 'G680_40'">
  68. <th>교환사유 <i class="star"></i></th>
  69. <td>
  70. <select name="selectChgReason" onchange="fnChangeChgReason($(this).val());">
  71. <option value="">[선택하세요]</option>
  72. <th:block th:if="${chgReasonList2}" th:each="oneData, status : ${chgReasonList2}">
  73. <th:block th:if="${oneData.cd} == ${chgReason}">
  74. <option th:value="|${oneData.cd}|" th:text="|${oneData.cdNm}|" selected></option>
  75. </th:block>
  76. <th:block th:unless="${oneData.cd} == ${chgReason}">
  77. <option th:value="|${oneData.cd}|" th:text="|${oneData.cdNm}|"></option>
  78. </th:block>
  79. </th:block>
  80. </select>
  81. </td>
  82. </th:block>
  83. <!-- //교환회수 -->
  84. <th>회수방법</th>
  85. <td>
  86. <th:blcok th:if="${wdGb} == 'W'">회수요청</th:blcok>
  87. <th:blcok th:if="${wdGb} == 'D'">직접발송</th:blcok>
  88. </td>
  89. <th>귀책사유</th>
  90. <td><span id="imputeReason"></span></td>
  91. </tr>
  92. <tr>
  93. <th>요청메모</th>
  94. <td colspan="5">
  95. <textarea id="chgMemo" name="chgMemo" style="height:80px;" placeholder="취소사유를 300자내외로 작성해 주세요" th:text="${chgMemo}"></textarea>
  96. </td>
  97. </tr>
  98. </tbody>
  99. </table>
  100. </form>
  101. </div>
  102. </div>
  103. </div>
  104. <!-- data -->
  105. <script th:inline="javascript">
  106. /*<![CDATA[*/
  107. var orderWithdrawList = [[${orderWithdrawList}]]; // 회수대상목록
  108. var sessRoleCd = [[${sessionInfo.roleCd}]]; // 권한코드
  109. var chgReason = [[${chgReason}]]; // 사유코드
  110. var chgGb = [[${chgGb}]]; // 요천구분
  111. var orderInfoList = [[${orderInfoList}]]; // 주문기본정보
  112. var ordNo = orderInfoList[0].ordNo; // 주문번호
  113. var payGb = orderInfoList[0].payGb; // 결제수단
  114. var payMeans = orderInfoList[0].payMeans; // 결제방법
  115. var payStat = orderInfoList[0].payStat; // 결제상태
  116. var columnWidthdrawList = [
  117. {headerName: "입점업체", field:"supplyCompNm", width:120, cellClass: 'text-center' , hide: true},
  118. {headerName: "입점업체코드", field:"supplyCompCd", width:120, cellClass: 'text-center' , hide: true},
  119. {headerName: "브랜드", field:"brandKnm", width:100, cellClass: 'text-center' , hide: true},
  120. {headerName: "변경번호", field:"ordChgSq", width:80, cellClass: 'text-center'},
  121. {headerName: "주문번호", field:"ordNo", width:80, cellClass: 'text-center'},
  122. {headerName: "상세번호", field:"ordDtlNo", width:80, cellClass: 'text-center'},
  123. {headerName: "클레임상태", field:"chgStatNm", width:100, cellClass: 'text-center'},
  124. {headerName: "요청일시", field:"regDt", width:150, cellClass: 'text-center'},
  125. {headerName: "요청자명", field:"chgerNm", width:100, cellClass: 'text-center'},
  126. {headerName: "휴대전화", field:"chgerPhnno", width:120, cellClass: 'text-center'},
  127. {headerName: "회수지우편번호", field:"chgerZipcode", width:120, cellClass: 'text-center' , hide: true},
  128. {headerName: "회수지기본주소", field:"chgerBaseAddr", width:150, cellClass: 'text-left' , hide: true},
  129. {headerName: "회수지상세주소", field:"chgerDtlAddr", width:120, cellClass: 'text-left' , hide: true},
  130. {headerName: "업체상품코드", field:"supplyGoodsCd", width:100, cellClass: 'text-center'},
  131. {headerName: "상품코드", field:"goodsCd", width:100, cellClass: 'text-center'},
  132. {headerName: "상품명", field:"goodsNm", width:100, cellClass: 'text-center'},
  133. {headerName: "옵션1", field:"optCd1", width:100, cellClass: 'text-center'},
  134. {headerName: "옵션2", field:"optCd2", width:100, cellClass: 'text-center'},
  135. {headerName: "요청수량", field:"chgQty", width:100, cellClass: 'text-center'},
  136. {headerName: "교환상세번호", field:"exchangeOrdDtlNo", width:100, cellClass: 'text-center'},
  137. {headerName: "교환옵션1", field:"optCd11", width:100, cellClass: 'text-center'},
  138. {headerName: "교환옵션2", field:"optCd12", width:100, cellClass: 'text-center'},
  139. {headerName: "물류메모", field:"whMemo", width:200, cellClass: 'text-left' , editable:true},
  140. {
  141. headerName : "주문"
  142. , field : "ordAmt"
  143. , width : 80
  144. , cellClass : 'text-right'
  145. , cellRenderer : function (params) {
  146. return params.value.addComma();
  147. }
  148. },
  149. {
  150. headerName : "취소"
  151. , field : "cnclRtnAmt"
  152. , width : 80
  153. , cellClass : 'text-right'
  154. , cellRenderer : function (params) {
  155. return params.value.addComma();
  156. }
  157. },
  158. {
  159. headerName : "즉시할인"
  160. , field : "cpn1DcAmt"
  161. , width : 80
  162. , cellClass : 'text-right'
  163. , cellRenderer : function (params) {
  164. return params.value.addComma();
  165. }
  166. },
  167. {
  168. headerName : "다다익선1"
  169. , field : "tmtb1DcAmt"
  170. , width : 80
  171. , cellClass : 'text-right'
  172. , cellRenderer : function (params) {
  173. return params.value.addComma();
  174. }
  175. },
  176. {
  177. headerName : "다다익선2"
  178. , field : "tmtb2DcAmt"
  179. , width : 80
  180. , cellClass : 'text-right'
  181. , cellRenderer : function (params) {
  182. return params.value.addComma();
  183. }
  184. },
  185. {
  186. headerName : "상품쿠폰"
  187. , field : "goodsCpnDcAmt"
  188. , width : 80
  189. , cellClass : 'text-right'
  190. , cellRenderer : function (params) {
  191. return params.value.addComma();
  192. }
  193. },
  194. {
  195. headerName : "장바구니쿠폰"
  196. , field : "cartCpnDcAmt"
  197. , width : 100
  198. , cellClass : 'text-right'
  199. , cellRenderer : function (params) {
  200. return params.value.addComma();
  201. }
  202. },
  203. {
  204. headerName : "포인트"
  205. , field : "pntDcAmt"
  206. , width : 80
  207. , cellClass : 'text-right'
  208. , cellRenderer : function (params) {
  209. return params.value.addComma();
  210. }
  211. },
  212. {
  213. headerName : "선포인트"
  214. , field : "prePntDcAmt"
  215. , width : 80
  216. , cellClass : 'text-right'
  217. , cellRenderer : function (params) {
  218. return params.value.addComma();
  219. }
  220. },
  221. {
  222. headerName : "상품권"
  223. , field : "gfcdUseAmt"
  224. , width : 80
  225. , cellClass : 'text-right'
  226. , cellRenderer : function (params) {
  227. return params.value.addComma();
  228. }
  229. },
  230. {
  231. headerName : "실결제금액"
  232. , field : "realOrdAmt"
  233. , width : 100
  234. , cellClass : 'text-right'
  235. , cellRenderer : function (params) {
  236. return params.value.addComma();
  237. }
  238. },
  239. {headerName: "주문자명", field:"ordNm", width:120, cellClass: 'text-left' , hide: true},
  240. {headerName: "주문자핸드폰번호", field:"ordPhnno", width:120, cellClass: 'text-left' , hide: true},
  241. ];
  242. var gridOptionsWidthdrawList = gagaAgGrid.getGridOptions(columnWidthdrawList);
  243. </script>
  244. <script th:inline="javascript">
  245. // 사유코드체크
  246. var fnChangeChgReason = function(reasonCd) {
  247. var customerReasonArr = ['G688_10', 'G689_10'];
  248. isCustomer = false;
  249. // 귀책사유체크(취소,반품,교환)
  250. for (i=0 ; i<customerReasonArr.length ; i++) {
  251. if (customerReasonArr[i] == reasonCd) {
  252. isCustomer = true;
  253. }
  254. }
  255. // 귀책사유체크(회사,고객)
  256. if (isCustomer) {
  257. $("#imputeReason").text("고객");
  258. } else {
  259. $("#imputeReason").text("회사");
  260. }
  261. $('#cancelRequestFrm input[name=chgReason]').val(reasonCd);
  262. }
  263. // 환불예상금액계산
  264. var fnCalculateRefundAmt = function (obj) {
  265. // 2021.05.25 수정
  266. var ordDtlNoArr = [];
  267. var cnclRtnReqQtyArr = [];
  268. // 1. 반품신청수량 체크
  269. for (i=0 ; i<orderWithdrawList.length ; i++) {
  270. if (orderWithdrawList[i].chgQty > 0) {
  271. // 반품신청값설정
  272. ordDtlNoArr.push(orderWithdrawList[i].ordDtlNo);
  273. cnclRtnReqQtyArr.push(orderWithdrawList[i].chgQty);
  274. }
  275. }
  276. // 2. 추가정보설정
  277. var chgerNm = orderInfoList[0].ordNm;
  278. var chgerEmail = orderInfoList[0].ordEmail;
  279. var chgerPhnno = orderInfoList[0].ordPhnno;
  280. var chgerTelno = orderInfoList[0].ordTelno;
  281. var custNo = orderInfoList[0].custNo;
  282. var delvFeeCd = orderInfoList[0].delvFeeCd;
  283. // 환불금액계산호출
  284. var jsonObj = {
  285. "ordNo" : ordNo
  286. ,"ordDtlNoArr" : ordDtlNoArr
  287. ,"cnclRtnReqQtyArr" : cnclRtnReqQtyArr
  288. ,"isCustomer" : isCustomer
  289. ,"chgerNm" : chgerNm
  290. ,"chgerEmail" : chgerEmail
  291. ,"chgerPhnno" : chgerPhnno
  292. ,"custNo" : custNo
  293. ,"ordNm" : chgerNm
  294. ,"ordPhnno" : chgerPhnno
  295. ,"delvFeeCd" : delvFeeCd
  296. }
  297. var jsonData = JSON.stringify(jsonObj);
  298. gagajf.ajaxJsonSubmit(
  299. '/orderChange/cancel/refundAmt'
  300. , jsonData
  301. , function(result) {
  302. // 2021.12.01 취소금액설정
  303. if (result.cancelOrderRefundList != null && result.cancelOrderRefundList.length > 0) {
  304. for (i=0 ; i<result.cancelOrderRefundList.length ; i++) {
  305. for (j=0 ; j<orderWithdrawList.length ; j++) {
  306. if (result.cancelOrderRefundList[i].ordDtlNo == orderWithdrawList[j].ordDtlNo) {
  307. orderWithdrawList[j].cnclRtnAmt = result.cancelOrderRefundList[i].cnclRtnAmt; // 취소금액
  308. orderWithdrawList[j].cpn1DcAmt = result.cancelOrderRefundList[i].cpn1DcAmt; // 즉시할인쿠폰금액
  309. orderWithdrawList[j].tmtb1DcAmt = result.cancelOrderRefundList[i].tmtb1DcAmt; // 수량할인다다익선금액
  310. orderWithdrawList[j].tmtb2DcAmt = result.cancelOrderRefundList[i].tmtb2DcAmt; // 금액할인다다익선금액
  311. orderWithdrawList[j].goodsCpnDcAmt = result.cancelOrderRefundList[i].goodsCpnDcAmt; // 상품쿠폰금액
  312. orderWithdrawList[j].cartCpnDcAmt = result.cancelOrderRefundList[i].cartCpnDcAmt; // 장바구니쿠폰금액
  313. orderWithdrawList[j].pntDcAmt = result.cancelOrderRefundList[i].pntDcAmt; // 포인트금액
  314. orderWithdrawList[j].prePntDcAmt = result.cancelOrderRefundList[i].prePntDcAmt; // 선포인트금액
  315. orderWithdrawList[j].gfcdUseAmt = result.cancelOrderRefundList[i].gfcdUseAmt; // 상품권적용금액
  316. orderWithdrawList[j].realOrdAmt = result.cancelOrderRefundList[i].realOrdAmt; // 실결제금액
  317. }
  318. }
  319. }
  320. // 주문변경대상정보 재설정
  321. gridOptionsWidthdrawList.api.setRowData(orderWithdrawList);
  322. }
  323. }
  324. );
  325. }
  326. $(document).ready(function() {
  327. // 1. 그리드생성
  328. gagaAgGrid.createGrid('gridOrderWithdrawList', gridOptionsWidthdrawList);
  329. gridOptionsWidthdrawList.api.setRowData(orderWithdrawList);
  330. // 2. TOTAL ROWS 없애기
  331. gagaAgGrid.hideStatusBar('gridOrderWithdrawList');
  332. // 사유체크실행
  333. fnChangeChgReason(chgReason);
  334. // 2021.12.10 취소금액계산
  335. fnCalculateRefundAmt(null);
  336. });
  337. // 회수컨펌버튼
  338. $("#widthdrawConfirmBtn").on("click", function(){
  339. // 1. 취소사유 체크
  340. var chgReason = $("#cancelRequestFrm select[name=selectChgReason]").val();
  341. if (gagajf.isNull(chgReason)) {
  342. mcxDialog.alert("취소사유를 입력하세요.");
  343. return ;
  344. }
  345. // 변경신청목록
  346. var withdrawConfirmList = [];
  347. for (i=0 ; i<orderWithdrawList.length ; i++) {
  348. var obj = new Object();
  349. obj.ordChgSq = orderWithdrawList[i].ordChgSq;
  350. obj.ordNo = orderWithdrawList[i].ordNo;
  351. obj.ordDtlNo = orderWithdrawList[i].ordDtlNo;
  352. obj.whMemo = orderWithdrawList[i].whMemo;
  353. obj.supplyCompCd = orderWithdrawList[i].supplyCompCd;
  354. obj.ordNm = orderWithdrawList[i].ordNm;
  355. obj.ordPhnno = orderWithdrawList[i].ordPhnno;
  356. obj.chgQty = orderWithdrawList[i].chgQty;
  357. obj.exchangeOrdDtlNo = orderWithdrawList[i].exchangeOrdDtlNo;
  358. withdrawConfirmList.push(obj);
  359. }
  360. // 2. 데이타적재
  361. var jsonObj = {
  362. "ordNo" : $('#cancelRequestFrm input[name=ordNo]').val()
  363. ,"ordChgSq" : $('#cancelRequestFrm input[name=ordChgSq]').val()
  364. ,"chgReason" : $('#cancelRequestFrm input[name=chgReason]').val()
  365. ,"chgGb" : chgGb
  366. ,"chgMemo" : $('#chgMemo').val()
  367. ,"isCustomer" : isCustomer
  368. ,"withdrawConfirmList" : withdrawConfirmList
  369. }
  370. // 주문번호, 취소사유, 취소메모, (취소, 반품, 교환 신청 정보 목록), 환불계좌
  371. var jsonData = JSON.stringify(jsonObj);
  372. mcxDialog.confirm('회수컨펌을 진행 하시겠습니까?', {
  373. cancelBtnText : "취소",
  374. sureBtnClick : function(){
  375. gagajf.ajaxJsonSubmit(
  376. "/orderChange/seller/widthdraw/confirm/update"
  377. , jsonData
  378. , function() {
  379. uifnPopupClose('popupReturnRequestForm');
  380. fnSearch();
  381. }
  382. );
  383. }
  384. });
  385. });
  386. </script>
  387. </html>