OrderFormMob.html 95 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740
  1. <!DOCTYPE html>
  2. <html lang="ko" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorator="mob/common/layout/SubLayoutMob">
  3. <!--
  4. *******************************************************************************
  5. * @source : OrderFormMob.html
  6. * @desc : 주문/결제 Page
  7. *============================================================================
  8. * STYLE24
  9. * Copyright(C) 2020 TSIT, All rights reserved.
  10. *============================================================================
  11. * VER DATE AUTHOR DESCRIPTION
  12. * === =========== ========== =============================================
  13. * 1.0 2021.04.05 jsh77b 최초 작성
  14. *******************************************************************************
  15. -->
  16. <body onunload="">
  17. <th:block layout:fragment="content">
  18. <link rel="stylesheet" type="text/css" href="/ux/pc/css/swiper.min.css">
  19. <script type="text/javascript" src="/ux/pc/js/swiper.min.js"></script>
  20. <script type="text/javascript" src="/ux/pc/js/jquery-ui.js"></script>
  21. <!-- payment.js -->
  22. <script type="text/javascript" th:src="${@environment.getProperty('pg.kcp.js.url')}" src=""></script>
  23. <script type="text/javascript" src="/biz/payment.js"></script>
  24. <script type="text/javascript" src="/ux/plugins/approval_key.js" charset='euc-kr'></script>
  25. <form id="order_info" name="order_info" method="post" action="/order/pay/result/response" ></form>
  26. <!-- 주문금액정보표현 -->
  27. <form id="orderAmtForm" name="orderAmtForm">
  28. <!-- 고객정보 -->
  29. <table border="1" style="font-size:10px; text-align:center; margin-top:20px; display:none; width:100%;" name="orderInfo" id="orderInfo">
  30. <tbody>
  31. <tr style="height:30px;">
  32. <td class="custNm"></td>
  33. <td class="email"></td>
  34. <td class="cellPhnno"></td>
  35. <td class="recipNm"></td>
  36. <td class="recipPhnno"></td>
  37. <td class="recipZipcode"></td>
  38. <td class="recipBaseAddr"></td>
  39. <td class="recipDtlAddr"></td>
  40. <td class="delvMemo"></td>
  41. <td class="sexGb"></td>
  42. <td class="birthYmd"></td>
  43. <td class="giftPackYn" th:text="${giftPackYn}"></td>
  44. </tr>
  45. </tbody>
  46. </table>
  47. <!-- //고객정보 -->
  48. <!-- 사은품정보 -->
  49. <table border="1" style="font-size:10px; text-align:center; margin-top:20px; display:none; width:100%;" name="freegiftInfo">
  50. <tr style="height:30px;">
  51. <td class="freegiftValArr"></td>
  52. <td class="freegiftUsePointArr"></td>
  53. <td class="freegiftSqArr"></td>
  54. <td class="freegiftGoodsArr"></td>
  55. </tr>
  56. </table>
  57. <!-- //사은품정보 -->
  58. <!-- 주문상세금액 -->
  59. <table border="1" style="font-size:10px; text-align:center; margin-top:20px; display:none; width:100%;" name="orderDetailInfo" id="orderDetailInfo">
  60. <th:block th:each="delvAllCart, index : ${delvAllCartList}">
  61. <th:block th:if="${delvAllCart != null and #lists.size(delvAllCart) > 0}">
  62. <th:block th:each="goods, i : ${delvAllCart}">
  63. <tr style="height:30px;">
  64. <td class="cartSq" th:text="${goods.cartSq}"></td>
  65. <td class="goodsNm" th:text="${goods.goodsNm}" style="display:none"></td>
  66. <td class="goodsCd" th:text="${goods.goodsCd}"></td>
  67. <td class="goodsType" th:text="${goods.goodsType}"></td>
  68. <td class="itemCd" th:text="${goods.itemCd}"></td>
  69. <td class="optCd" th:text="${goods.optCd}"></td>
  70. <td class="optCd1" th:text="${goods.optCd1}" style="display:none"></td>
  71. <td class="optCd2" th:text="${goods.optCd2}" style="display:none"></td>
  72. <td class="itemQtyr" th:text="${goods.itemQtyr}" style="display:none"></td>
  73. <td class="orgCurrPrice" th:text="${goods.orgCurrPrice}"></td>
  74. <td class="cpn1CpnSq" th:text="${goods.cpn1CpnSq}"></td>
  75. <td class="cpn1DcAmt" th:text="${goods.orgCurrPrice} - ${goods.currPrice}"></td>
  76. <td class="optAddPrice" th:text="${goods.optAddPrice}"></td>
  77. <td class="goodsQty" th:text="${goods.goodsQty}"></td>
  78. <td class="ordAmt">0</td>
  79. <th:block th:if="${goods.applyQtySectionYn} == 'Y' and ${goods.qtyTmtbSq} > 0">
  80. <td class="tmtb1Sq" th:text="${goods.qtyTmtbSq}"></td>
  81. <td class="tmtb1DcAmt" th:text="${goods.tmtb1DcAmt}"></td>
  82. </th:block>
  83. <th:block th:if="${goods.applyQtySectionYn} != 'Y'">
  84. <td class="tmtb1Sq">0</td>
  85. <td class="tmtb1DcAmt">0</td>
  86. </th:block>
  87. <th:block th:if="${goods.applyAmtSectionYn} == 'Y' and ${goods.amtTmtbSq} > 0">
  88. <td class="tmtb2Sq" th:text="${goods.amtTmtbSq}"></td>
  89. <td class="tmtb2DcAmt" th:text="${goods.tmtb2DcAmt}"></td>
  90. </th:block>
  91. <th:block th:if="${goods.applyAmtSectionYn} != 'Y'">
  92. <td class="tmtb2Sq" >0</td>
  93. <td class="tmtb2DcAmt" >0</td>
  94. </th:block>
  95. <td class="goodsCpnSq">0</td>
  96. <td class="goodsCpnDcAmt">0</td>
  97. <td class="cartCpnSq">0</td>
  98. <td class="cartCpnDcAmt">0</td>
  99. <td class="prePntDcAmt1" th:text="${goods.prePntDcAmt}"></td>
  100. <td class="dcSumAmt">0</td>
  101. <td class="pntDcAmt1">0</td>
  102. <td class="gfcdUseAmt1">0</td>
  103. <td class="realOrdAmt1">0</td>
  104. <td class="savePntAmt1">0</td>
  105. <td class="shotDelvYn" th:text="${goods.shotDelvYn}"></td>
  106. <td class="foreignBuyYn" th:text="${goods.foreignBuyYn}"></td>
  107. <td class="orderMadeYn" th:text="${goods.orderMadeYn}"></td>
  108. <td class="delvFeeCd" th:text="${goods.delvFeeCd}"></td>
  109. <td class="pntPrate" th:text="${goods.pntPrate}"></td>
  110. <td class="pntMrate" th:text="${goods.pntMrate}"></td>
  111. </tr>
  112. </th:block>
  113. </th:block>
  114. </th:block>
  115. </table>
  116. <!-- //주문상세금액 -->
  117. <!-- 배송단위목록 -->
  118. <table border="1" style="font-size:10px; text-align:center; margin-top:20px; display:none; width:100%;" name="delvFeeCdInfo" id="delvFeeCdInfo">
  119. <th:block th:each="delvFeeCd, index : ${delvFeeCdList}">
  120. <tr style="height:30px;">
  121. <td class="supplyCompCd" th:text="${delvFeeCd.supplyCompCd}"></td>
  122. <td class="delvFeeCd" th:text="${delvFeeCd.delvFeeCd}"></td>
  123. <td class="delvFee" th:text="${delvFeeCd.delvFee}"></td>
  124. <td class="delvCpnSq">0</td>
  125. <td class="delvCpnDcAmt">0</td>
  126. </tr>
  127. </th:block>
  128. </table>
  129. <!-- //배송단위목록 -->
  130. <!-- 주문금액합계 -->
  131. <table border="1" style="font-size:10px; text-align:center; margin-top:20px; display:none; width:100%;" name="orderSumAmtInfo" id="orderSumAmtInfo">
  132. <tr style="height:30px;">
  133. <td class="orgGoodsSumAmt">0</td>
  134. <td class="delvSumAmt" th:text="${sumDelvFee}"></td>
  135. <td class="freegiftUsePnt">0</td>
  136. <td class="cpn1DcSumAmt">0</td>
  137. <td class="ordSumAmt">0</td>
  138. <td class="tmtb1DcSumAmt">0</td>
  139. <td class="tmtb2DcSumAmt">0</td>
  140. <td class="tmtbDcSumAmt">0</td>
  141. <td class="goodsCpnDcSumAmt">0</td>
  142. <td class="cartCpnDcSumAmt">0</td>
  143. <td class="delvCpnDcSumAmt">0</td>
  144. <td class="cpnDcSumAmt">0</td>
  145. <td class="prePntDcSumAmt">0</td>
  146. <td class="pntDcSumAmt">0</td>
  147. <td class="gfcdUseSumAmt">0</td>
  148. <td class="realOrdSumAmt">0</td>
  149. <td class="savePntSumAmt">0</td>
  150. </tr>
  151. </table>
  152. <!-- //주문금액합계 -->
  153. </form>
  154. <!-- //주문금액정보표현 -->
  155. <!-- 주문고객정보 -->
  156. <form id="orderForm" name="orderForm">
  157. <main role="" id="" class="container od">
  158. <section class="content odPayment od_gift">
  159. <form action="" class="form_wrap">
  160. <!-- 주문내역 -->
  161. <div class="inner wide" id="orderListInfo" style="display:none"></div>
  162. <!-- //주문내역 -->
  163. <!-- 주문고객 -->
  164. <div class="inner wide" id="custemerInfo" style="display:none"></div>
  165. <!-- //주문고객 -->
  166. <!-- 선물받으실분 -->
  167. <div class="inner wide" id="orderGiftInfo" style="display:none"></div>
  168. <!-- //선물받으실분 -->
  169. <!-- 배송지 정보 -->
  170. <div class="inner wide" id="deliveryAddrInfo" style="display:none"></div>
  171. <!-- //배송지 정보 -->
  172. <!-- 개인통관고유부호 -->
  173. <div class="inner wide" id="entryInfo" style="display:none"></div>
  174. <!-- //개인통관고유부호 -->
  175. <!-- 주문제작상품동의 -->
  176. <div class="inner wide" id="madeInfo" style="display:none"></div>
  177. <!-- //주문제작상품동의 -->
  178. <!-- 사은품 -->
  179. <div class="inner wide" id="freegiftInfo" style="display:none"></div>
  180. <!-- //사은품 -->
  181. <!-- 할인/혜택 사용 -->
  182. <div class="inner wide" id="dcAmtInfo" style="display:none"></div>
  183. <!-- //할인/혜택 사용 -->
  184. <!-- 결제수단 선택 -->
  185. <div class="inner wide" id="paymentInfo" style="display:none"></div>
  186. <!-- //결제수단 선택 -->
  187. <!-- 결제 정보 -->
  188. <div class="inner">
  189. <div class="tbl_wrap pay_wrap">
  190. <div class="tbl_tit">
  191. <h3>결제 예정금액</h3>
  192. <strong class="pay"><span class="realOrdAmt"></span>원</strong>
  193. </div>
  194. <div class="tbl type1">
  195. <table>
  196. <colgroup>
  197. <col width="227">
  198. <col width="*">
  199. </colgroup>
  200. <tbody>
  201. <tr>
  202. <td>
  203. <dl>
  204. <div>
  205. <dt>주문금액</dt>
  206. <dd><div><span class="orgGoodsSumAmt" th:text="${#numbers.formatInteger(orgGoodsSumAmt, 1, 'COMMA')}"></span>원</div></dd>
  207. </div>
  208. <div>
  209. <dt>할인금액</dt>
  210. <dd>
  211. <div class="c_primary"> <!-- 210526_ 추가 : [.c_primary] 클래스 추가시 #fd4802 색상 변경. -->
  212. <span class="dcSumAmt"></span>원
  213. </div>
  214. </dd>
  215. </div>
  216. <div>
  217. <dt>배송비</dt>
  218. <dd><div><span class="delvSumAmt" th:text="${#numbers.formatInteger(sumDelvFee, 1, 'COMMA')}"></span>원</div></dd>
  219. </div>
  220. </dl>
  221. </td>
  222. </tr>
  223. </tbody>
  224. </table>
  225. </div>
  226. </div>
  227. <div class="area_paymentinfo">
  228. <!-- @ 2021.06.11 자사만, (무통장, 실시간) 미노출 -->
  229. <!-- @ 입점있으면 무조건 노출 -->
  230. <div class="paymentinfo">
  231. <div class="payinfo_blk_wrap">
  232. <a href="javascript:void(0);">구매조건 확인 및 결제대행 서비스 약관 동의<span>보기</span></a>
  233. <div class="payinfo_blk_parent">
  234. <div class="payinfo_blk">
  235. <a href="javascript:void(0);">개인정보 제공에 대한 동의<span>보기</span></a>
  236. <div class="infotxt">
  237. STYLE24는 다음과 같이 회원님의 개인정보를 제3자에게 제공합니다.
  238. <table class="paymentinfo agree1">
  239. <colgroup>
  240. <col width="30%">
  241. <col width="*">
  242. </colgroup>
  243. <tbody>
  244. <tr>
  245. <th>제공받는 자</th>
  246. <td>서울보증보험㈜, ㈜유세이프</td>
  247. </tr>
  248. <tr>
  249. <th>제공하는 항목</th>
  250. <td>
  251. 구매자명, 구매자 생년월일,
  252. 구매자 성별, 구매자 연락처
  253. (일반전화 및 핸드폰), 구매자
  254. 이메일, 주문번호,
  255. 배송지 정보, 주문 금액
  256. </td>
  257. </tr>
  258. <tr>
  259. <th>제공 목적</th>
  260. <td>쇼핑몰보증보험 가입 및 보험가입 제반 사항</td>
  261. </tr>
  262. <tr>
  263. <th>보유 및 이용기간</th>
  264. <td>개별서비스 제공기간</td>
  265. </tr>
  266. </tbody>
  267. </table>
  268. <!-- 입점업체가 있을때 노출 -->
  269. <th:block th:if="${delvCnt} > 0">
  270. <table class="paymentinfo agree2">
  271. <colgroup>
  272. <col width="30%">
  273. <col width="*">
  274. </colgroup>
  275. <tbody>
  276. <tr>
  277. <th>제공받는 자</th>
  278. <td>
  279. <th:block th:each="delvFeeCd, i : ${delvFeeCdList}">
  280. <th:block th:unless="${delvFeeCd.delvFeeCd} == 'WMS'">
  281. <th:block th:if="${i.count == #lists.size(delvFeeCdList)}">
  282. <th:block th:text="|${delvFeeCd.supplyCompNm}|"></th:block>
  283. </th:block>
  284. <th:block th:if="${i.count < #lists.size(delvFeeCdList)}">
  285. <th:block th:text="|${delvFeeCd.supplyCompNm},|"></th:block>
  286. </th:block>
  287. </th:block>
  288. </th:block>
  289. </td>
  290. </tr>
  291. <tr>
  292. <th>제공하는 항목</th>
  293. <td>성명, 주소, 연락처</td>
  294. </tr>
  295. <tr>
  296. <th>제공 목적</th>
  297. <td>주문상품의 배송, 고객상담 및 불만처리</td>
  298. </tr>
  299. <tr>
  300. <th>보유 및 이용기간</th>
  301. <td>이용목적 달성 시 까지</td>
  302. </tr>
  303. </tbody>
  304. </table>
  305. </th:block>
  306. </div>
  307. </div>
  308. </div>
  309. </div>
  310. </div>
  311. <div class="agree_payment">
  312. 위 주문내역을 확인 하였으며, 회원 본인은 결제에 동의합니다. (전자상거래법 제 8조 제2항)
  313. </div>
  314. </div>
  315. </div>
  316. <!-- //결제 정보 -->
  317. <div class="inner wide">
  318. <div class="area_paybtn">
  319. <div class="btn_group btn_group_flex">
  320. <div>
  321. <button type="button" id="btn_payment" class="btn btn_primary">
  322. 동의 후 <span class="total_price">0</span>원 결제하기
  323. </button>
  324. </div> <!-- 210406_ID추가 -->
  325. </div>
  326. </div>
  327. </div>
  328. </form>
  329. </section>
  330. </main>
  331. <!-- 할인쿠폰 변경 팝업 -->
  332. <div class="modal pop_full couponModify_pop" id="couponModifyPop" tabindex="-1" role="dialog" aria-labelledby="couponModifyLabel" aria-hidden="true"></div>
  333. <!-- //할인쿠폰 변경 팝업 -->
  334. <!-- 배송비 쿠폰선택_팝업 -->
  335. <div id="couponSelectPop02" class="popup_box couponSelectPop couponSelectPop02"></div>
  336. <!-- //배송비 쿠폰선택_팝업 -->
  337. <script th:inline="javascript">
  338. // 배송관련정보 변수선언
  339. var cartGoodsList = [[${cartGoodsList}]] // 배송목록
  340. var shotCnt = [[${shotCnt}]]; // 자사 총알 배송건수
  341. var wmsCnt = [[${wmsCnt}]]; // 자사 일반 배송건수
  342. var shotWmsCnt = [[${shotWmsCnt}]]; // 자사 총알,일반 배송건수
  343. var resCnt = [[${resCnt}]]; // 자사 예약 배송건수
  344. var delvCnt = [[${delvCnt}]]; // 입점 일반 배송건수
  345. var orgSumDelvFee = [[${sumDelvFee}]]; // 최초배송비합계
  346. var prePntDcAmt = [[${prePntDcAmt}]]; // 선포인트사용가능금액
  347. var custNm = [[${order.custNm}]]; // 주문자명
  348. var cellPhnno = [[${order.cellPhnno}]]; // 핸드폰번호
  349. var email = [[${order.email}]]; // 이메일
  350. var recipZipcode = [[${order.recipZipcode}]]; // 우편번호
  351. var recipBaseAddr = [[${order.recipBaseAddr}]]; // 기본주소
  352. var recipDtlAddr = [[${order.recipDtlAddr}]]; // 상세주소
  353. var cartSqArr = [[${order.cartSqArr}]]; // 장바구니시퀀스 목록
  354. var shotDelvUseYn = [[${order.shotDelvUseYn}]]; // 총알배송사용여부(장바구니)
  355. var shotDelvYn = [[${order.shotDelvUseYn}]]; // 총알배송사용여부(장바구니)
  356. var foreignBuyYn = [[${order.foreignBuyYn}]]; // 해외구매대행
  357. var foreignBuyYn = [[${foreignBuyYn}]]; // 해외구매대행여부
  358. var orderMadeYn = [[${orderMadeYn}]]; // 주문제작상품여부
  359. var isLogin = [[${isLogin}]]; // 로그인여부
  360. var giftPackYn = [[${giftPackYn}]]; // 선물받기여부
  361. var devTempYn = [[${devTempYn}]]; // 개발자모드가능여부
  362. var frontGb = [[${frontGb}]]; // 프론트구분
  363. var custCpnSq = 0;
  364. var cpnIndex = 0;
  365. var cpnApplyTemp = false;
  366. //AJAX 로드를 위한 변수 설정
  367. var jsonObj = {};
  368. // 컨텐츠 호출
  369. $(document).ready( function() {
  370. // 999. 개발화면정보설정
  371. var devTemp = false;
  372. var arr = []
  373. arr[0] = "orderInfo";
  374. arr[1] = "freegiftInfo";
  375. arr[2] = "orderDetailInfo";
  376. arr[3] = "delvFeeCdInfo";
  377. arr[4] = "orderSumAmtInfo";
  378. // 개발자모드실행
  379. if (devTemp == true && devTempYn == true) {
  380. $("table").each(function(){
  381. var name = $(this).attr("name");
  382. for (i=0 ; i<arr.length ; i++) {
  383. if (name == arr[i]) {
  384. $(this).show();
  385. }
  386. }
  387. });
  388. }
  389. // 1. 타이틀설정
  390. $("#htopTitle").text("주문/결제");
  391. // 2. 장바구니시퀀스 배열 변환
  392. cartSqArr = String(cartSqArr).split(",");
  393. var dispYn = "N";
  394. if (isLogin == false) {
  395. //dispYn = "Y";
  396. }
  397. // AJAX 로드를 위한 변수 설정
  398. jsonObj = {
  399. "custNm" : custNm
  400. , "cellPhnno" : cellPhnno
  401. , "email" : email
  402. , "recipZipcode" : recipZipcode
  403. , "recipBaseAddr" : recipBaseAddr
  404. , "recipDtlAddr" : recipDtlAddr
  405. , "cartSqArr" : cartSqArr
  406. , "dispYn" : dispYn
  407. , "shotDelvYn" : shotDelvUseYn
  408. , "shotDelvUseYn" : shotDelvUseYn
  409. , "foreignBuyYn" : foreignBuyYn
  410. , "orderMadeYn" : orderMadeYn
  411. , "custDelvAddrSq" : 0
  412. , "giftPackYn" : giftPackYn
  413. , "cartGoodsList" : cartGoodsList
  414. }
  415. jsonData = JSON.stringify(jsonObj);
  416. // 1. AJAX 정보(회원정보로드)
  417. custemerInfoSet();
  418. // 2021.07.06
  419. if (giftPackYn == "N") {
  420. $("#orderForm .container").removeClass("od_gift");
  421. }
  422. });
  423. window.onpageshow = function(event){
  424. if ( event.persisted || (event.originalEvent && event.originalEvent.persisted) || (window.performance && window.performance.navigation.type == 2) ){
  425. window.history.back();
  426. }
  427. };
  428. // 1. 함수기능 정의
  429. // 1.1 고객정보로드
  430. var custemerInfoSet = function() {
  431. $.ajax( {
  432. type : "POST",
  433. url : '/order/custemerInfo',
  434. data : JSON.stringify(jsonObj),
  435. dataType : 'html',
  436. beforeSend : function(xhr, settings) {
  437. xhr.setRequestHeader("AJAX" , "true");
  438. xhr.setRequestHeader('Accept' , 'application/json');
  439. xhr.setRequestHeader('Content-Type' , 'application/json');
  440. },
  441. success : function(result) {
  442. if (result != null) {
  443. $("#custemerInfo").css("display", "block");
  444. $("#custemerInfo").html(result);
  445. // 고객정보설정
  446. $("#orderAmtForm .custNm").text($("#orderForm input[name='custNm']").val());
  447. $("#orderAmtForm .email").text($("#orderForm input[name='email']").val());
  448. $("#orderAmtForm .cellPhnno").text($("#orderForm input[name='cellPhnno']").val());
  449. $("#orderAmtForm .sexGb").text($("#orderForm input[name='sexGb']").val());
  450. $("#orderAmtForm .birthYmd").text($("#orderForm input[name='birthYmd']").val());
  451. }
  452. // 1.2 개인통관부호 정보
  453. if (foreignBuyYn == "Y") {
  454. entryInfoSet();
  455. }
  456. // 1.3 주문제작상품동의여부
  457. if (orderMadeYn == "Y") {
  458. madeInfoSet();
  459. }
  460. // 1.4 선물하기여부체크
  461. if (giftPackYn == "Y") {
  462. // 1.4.1 선물하기정보로드
  463. orderGiftInfoSet(jsonObj, true);
  464. } else {
  465. // 1.4.2 배송정보로드
  466. deliveryAddrInfoSet(jsonObj, true);
  467. }
  468. }
  469. });
  470. }
  471. // 1.2 개인통관부호 정보
  472. var entryInfoSet = function() {
  473. $.ajax( {
  474. type : "POST",
  475. url : '/order/entryInfo',
  476. data : JSON.stringify(jsonObj),
  477. dataType : 'html',
  478. beforeSend : function(xhr, settings) {
  479. xhr.setRequestHeader("AJAX" , "true");
  480. xhr.setRequestHeader('Accept' , 'application/json');
  481. xhr.setRequestHeader('Content-Type' , 'application/json');
  482. },
  483. success : function(result) {
  484. $("#entryInfo").css("display", "block");
  485. $("#entryInfo").html(result);
  486. // 2021.07.06 값이 있으면 체크박스 활성화
  487. if ($("#orderForm input[name=entryNo]").val() != "") {
  488. if ($("#orderForm #chk-overs-agr").is(":checked") == false) {
  489. $("#orderForm #chk-overs-agr").trigger("click");
  490. }
  491. }
  492. // 2021.07.06 개인통관부호 입력완료
  493. $(".btn_entryNo").on("click", function(){
  494. if ($("#orderForm input[name=entryNo]").val() == null || $("#orderForm input[name=entryNo]").val() == '') {
  495. $("#orderForm .t_err").show();
  496. $("#orderForm input[name=entryNo]").addClass("err");
  497. mcxDialog.alert("개인통관고유부호를 입력해 주세요.");
  498. return false;
  499. } else if ($("#orderForm input[name=entryNo]").val().length > 0 && $("#orderForm input[name=entryNo]").val().length < 13) {
  500. $("#orderForm .t_err").show();
  501. $("#orderForm input[name=entryNo]").addClass("err");
  502. $("#orderForm .entryNo").text("");
  503. mcxDialog.alert("통관부호가 유효하지 않습니다. 다시 입력해주세요.");
  504. return false;
  505. } else if ($("#orderForm input[name=entryNo]").val().substr(0,1) != "P") {
  506. $("#orderForm .t_err").show();
  507. $("#orderForm input[name=entryNo]").addClass("err");
  508. $("#orderForm .entryNo").text("");
  509. mcxDialog.alert("통관부호가 유효하지 않습니다. 다시 입력해주세요.");
  510. return false;
  511. } else {
  512. $("#orderForm .entryNo").text($("#orderForm input[name=entryNo]").val());
  513. $("#orderForm input[name=entryNo]").removeClass("err");
  514. $("#orderForm .t_err").hide();
  515. mcxDialog.alert("통관부호가 정상입력되었습니다.");
  516. return false;
  517. }
  518. });
  519. }
  520. });
  521. }
  522. // 1.3 주문제작상품동의여부
  523. var madeInfoSet = function() {
  524. $.ajax( {
  525. type : "POST",
  526. url : '/order/madeInfo',
  527. data : JSON.stringify(jsonObj),
  528. dataType : 'html',
  529. beforeSend : function(xhr, settings) {
  530. xhr.setRequestHeader("AJAX" , "true");
  531. xhr.setRequestHeader('Accept' , 'application/json');
  532. xhr.setRequestHeader('Content-Type' , 'application/json');
  533. },
  534. success : function(result) {
  535. $("#madeInfo").css("display", "block");
  536. $("#madeInfo").html(result);
  537. }
  538. });
  539. }
  540. // 1.4.1 선물받기여부정보로드
  541. var orderGiftInfoSet = function() {
  542. $.ajax( {
  543. type : "POST",
  544. url : '/order/orderGiftInfo',
  545. data : JSON.stringify(jsonObj),
  546. dataType : 'html',
  547. beforeSend : function(xhr, settings) {
  548. xhr.setRequestHeader("AJAX" , "true");
  549. xhr.setRequestHeader('Accept' , 'application/json');
  550. xhr.setRequestHeader('Content-Type' , 'application/json');
  551. },
  552. success : function(result) {
  553. $("#orderGiftInfo").css("display", "block");
  554. $("#orderGiftInfo").html(result);
  555. // 직접입력 선택 버튼
  556. $("#orderGiftInfo .gift_tab .fold_cont ul li").on("click", function(){
  557. $(this).parent().find("li").removeClass("active");
  558. $(this).addClass("active");
  559. $(this).parent().parent().find("input[name=recipNm]").val("");
  560. $(this).parent().parent().find("input[name=recipPhnno]").val("");
  561. // 직접입력시 입력창 활성화
  562. if ($(this).find("span").text() == "직접입력") {
  563. $(this).parent().parent().find("input[name=recipNm]").attr("readOnly", false);
  564. $(this).parent().parent().find("input[name=recipPhnno]").attr("readOnly", false);
  565. } else {
  566. $(this).parent().parent().find("input[name=recipNm]").attr("readOnly", true);
  567. $(this).parent().parent().find("input[name=recipPhnno]").attr("readOnly", true);
  568. // 2021.06.03
  569. window.style24.getContact();
  570. }
  571. });
  572. // 주문목록정보로드
  573. orderListInfoSet(JSON.stringify(jsonObj), true);
  574. }
  575. });
  576. }
  577. // 2021.06.03 어플 callback 함수 호출
  578. function contactInfo(jsonString) {
  579. let jsonObj = JSON.parse(jsonString);
  580. var phnno = jsonObj.contact.phnno;
  581. phnno = phnno.replace(/[^0-9]/g, "").replace(/(^02|^0505|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3").replace("--", "-");
  582. $("#orderForm #orderGiftInfo input[name=recipNm]").val(jsonObj.contact.name);
  583. $("#orderForm #orderGiftInfo input[name=recipPhnno]").val(phnno);
  584. }
  585. // 1.4.2 배송정보로드
  586. var deliveryAddrInfoSet = function(delvObj, temp) {
  587. // 2021.04.29 AJAX 로드를 위한 변수 설정
  588. delvObj.foreignBuyYn = foreignBuyYn;
  589. delvObj.orderMadeYn = orderMadeYn;
  590. $.ajax( {
  591. type : "POST",
  592. url : '/order/deliveryAddrInfo',
  593. data : JSON.stringify(delvObj),
  594. dataType : 'html',
  595. beforeSend : function(xhr, settings) {
  596. xhr.setRequestHeader("AJAX" , "true");
  597. xhr.setRequestHeader('Accept' , 'application/json');
  598. xhr.setRequestHeader('Content-Type' , 'application/json');
  599. },
  600. success : function(result) {
  601. $("#deliveryAddrInfo").css("display", "block");
  602. $("#deliveryAddrInfo").html(result);
  603. // 2021.05.16 배송정보가 있으면 노출
  604. if ($("#orderForm input[name='recipZipcode']").val() != "00000") {
  605. $("#orderForm .ship_info.exist").show();
  606. $("#orderForm .ship_info.none").hide();
  607. } else {
  608. $("#orderForm .ship_info.exist").hide();
  609. $("#orderForm .ship_info.none").show();
  610. }
  611. // 배송정보설정
  612. $("#orderAmtForm .recipNm").text($("#orderForm input[name='recipNm']").val());
  613. $("#orderAmtForm .recipPhnno").text($("#orderForm input[name='recipPhnno']").val());
  614. $("#orderAmtForm .recipZipcode").text($("#orderForm input[name='recipZipcode']").val());
  615. $("#orderAmtForm .recipBaseAddr").text($("#orderForm input[name='recipBaseAddr']").val());
  616. $("#orderAmtForm .recipDtlAddr").text($("#orderForm input[name='recipDtlAddr']").val());
  617. $("#orderAmtForm .delvMemo").text($("#orderForm input[name='delvMemo']").val());
  618. // 2. 버튼기능구현
  619. // 2.1 회원 배송지변경 팝업열기
  620. $('#orderForm .btn_adrsChange_pop').on("click", function(){
  621. // 회원인경우
  622. if (isLogin == true) {
  623. $.ajax( {
  624. type : "POST",
  625. url : '/common/delvAddrChangePop',
  626. data : JSON.stringify(jsonObj),
  627. dataType : 'html',
  628. beforeSend : function(xhr, settings) {
  629. xhr.setRequestHeader("AJAX" , "true");
  630. xhr.setRequestHeader('Accept' , 'application/json');
  631. xhr.setRequestHeader('Content-Type' , 'application/json');
  632. },
  633. success : function(result) {
  634. $("#adrsChangePop .modal-dialog .modal-content").html(result);
  635. $("#adrsChangePop").modal("show");
  636. }
  637. });
  638. }
  639. // 비회원인경우
  640. else {
  641. $.ajax( {
  642. type : "POST",
  643. url : '/common/delvAddrAddPop',
  644. data : JSON.stringify(jsonObj),
  645. dataType : 'html',
  646. beforeSend : function(xhr, settings) {
  647. xhr.setRequestHeader("AJAX" , "true");
  648. xhr.setRequestHeader('Accept' , 'application/json');
  649. xhr.setRequestHeader('Content-Type' , 'application/json');
  650. },
  651. success : function(result) {
  652. $("#adrsAddPop .modal-dialog .modal-content").html(result);
  653. $("#adrsAddPop").modal("show");
  654. }
  655. });
  656. }
  657. });
  658. // 1.5 총알배송가능 지역, 총알배송 가능 시간 체크(초기로드정보)
  659. fnGetDailyDeliveryCheck(temp);
  660. }
  661. });
  662. }
  663. // 1.5 총알배송가능 지역, 총알배송 가능 시간 체크
  664. var fnGetDailyDeliveryCheck = function (temp) {
  665. jsonData = JSON.stringify(jsonObj);
  666. // 장바구니 총알배송 사용여부 체크 N
  667. if (shotDelvUseYn == "N") {
  668. // 초기에 한번 데이타 로드
  669. if (temp) {
  670. // 1.4 주문상품목록로드
  671. orderListInfoSet(jsonData, temp);
  672. }
  673. } else {
  674. // 배송지 우편번호 체크
  675. var zipcode = $("#orderForm input[name='recipZipcode']").val();
  676. // 총알배송여부 체크 배송지정보 존재여부 체크
  677. if (zipcode == null || zipcode == '') {
  678. //alert("배송지정보가 없습니다. 기본 총알배송 가능지역으로 설정 합니다.");
  679. zipcode = "04320"; // 기본 서울역 우편번호로 설정
  680. }
  681. // TODO
  682. var shotDelvObj = {"recipZipcode" : zipcode};
  683. gagajf.ajaxJsonSubmit(
  684. "/order/getDailyDeliveryCheck"
  685. , JSON.stringify(shotDelvObj)
  686. , function (result) {
  687. // 총알배송여부체크
  688. var tempShotDelvYn = "N";
  689. if (parseInt(result) > 0) {
  690. tempShotDelvYn = "Y";
  691. }
  692. // json 값 설정
  693. var orderListObj = {
  694. "cartSqArr" : cartSqArr
  695. , "shotDelvYn" : tempShotDelvYn
  696. , "giftPackYn" : giftPackYn
  697. , "cartGoodsList" : cartGoodsList
  698. };
  699. var orderListJsonData = JSON.stringify(orderListObj);
  700. if (temp) {
  701. // 1.6 주문상품목록로드
  702. orderListInfoSet(orderListJsonData, temp);
  703. } else {
  704. if (tempShotDelvYn != shotDelvYn) {
  705. orderListInfoSet(orderListJsonData, temp);
  706. }
  707. }
  708. shotDelvYn = tempShotDelvYn;
  709. }
  710. )
  711. }
  712. }
  713. // 1.6 주문상품목록로드
  714. var orderListInfoSet = function(orderListJsonData, temp) {
  715. $.ajax( {
  716. type : "POST",
  717. url : '/order/orderListInfo',
  718. data : orderListJsonData,
  719. dataType : 'html',
  720. beforeSend : function(xhr, settings) {
  721. xhr.setRequestHeader("AJAX" , "true");
  722. xhr.setRequestHeader('Accept' , 'application/json');
  723. xhr.setRequestHeader('Content-Type' , 'application/json');
  724. },
  725. success : function(result) {
  726. if (result != null) {
  727. $("#orderListInfo").css("display", "block");
  728. $("#orderListInfo").html(result);
  729. $("#delvFeeCdCnt").text($("#orderForm input[name=delvFeeCdCnt]").val());
  730. // 총알배송건수가 있으면 총알배송 태그 표시
  731. if (parseInt($("#orderForm input[name=shotCnt]").val()) > 0 ) {
  732. $("#orderForm .shotDelv").show();
  733. } else {
  734. $("#orderForm .shotDelv").hide();
  735. }
  736. }
  737. // 1.7 사은품정보로드
  738. if (temp) {
  739. freegiftInfoSet();
  740. }
  741. }
  742. });
  743. }
  744. // 1.7 사은품정보로드
  745. var freegiftInfoSet = function() {
  746. $.ajax( {
  747. type : "POST",
  748. url : '/order/freegiftInfo',
  749. data : JSON.stringify(jsonObj),
  750. dataType : 'html',
  751. beforeSend : function(xhr, settings) {
  752. xhr.setRequestHeader("AJAX" , "true");
  753. xhr.setRequestHeader('Accept' , 'application/json');
  754. xhr.setRequestHeader('Content-Type' , 'application/json');
  755. },
  756. success : function(result) {
  757. if (result != null) {
  758. $("#freegiftInfo").html(result);
  759. var total_gift = 0;
  760. var total_deduct = 0;
  761. // 2.2 사은품선택 라디오 버튼 기능
  762. $("#orderForm .freegiftRdo").on("click", function() {
  763. total_gift = 0;
  764. total_deduct = 0;
  765. // 2021.04.14 사은품 사용 포인트가 보유포인트보다 작아야 한다.
  766. var rmPntAmt = parseInt($("#orderForm input[name='rmPntAmt']").val());
  767. var freegiftUsePnt = parseInt($("#orderAmtForm .freegiftUsePnt").text());
  768. var usepoint = parseInt($(this).attr("usepoint"));
  769. rmPntAmt = rmPntAmt - freegiftUsePnt - usepoint;
  770. if (rmPntAmt < 0) {
  771. mcxDialog.alert("보유포인트가 부족합니다.");
  772. return false;
  773. }
  774. $("#orderForm .freegiftRdo").each(function(){
  775. // 라디오버튼 사은품 체크
  776. if ($(this).is(":checked")) {
  777. // 수령거부가 아닐때 체크
  778. if ($(this).val() != "noSel") {
  779. total_gift += 1;
  780. total_deduct += parseInt($(this).attr("usepoint"));
  781. }
  782. }
  783. });
  784. $("#orderForm .total_gift").text(total_gift); // 사은품총선택개수
  785. $("#orderForm .total_deduct").text(total_deduct.addComma()); // 사은품총사용포인트
  786. $("#orderAmtForm .freegiftUsePnt").text(total_deduct);
  787. // 2021.04.29 사은품기능 리셋
  788. var pntDcAmt = parseInt($("#orderAmtForm .pntDcSumAmt").text());
  789. if (pntDcAmt > 0) {
  790. mcxDialog.alert("적용된 할인/혜택이 초기화 됩니다.");
  791. pntDcAmtReset();
  792. }
  793. // 2021.05.07 금액계산실행
  794. custCpnSumAmtCal();
  795. });
  796. // 2021.07.05 선택사은품 무료가 2개일때 첫번째 무료만 선택
  797. var countArr = [];
  798. var temp = true;
  799. // 2021.04.29 무료사은품 기본선택
  800. $("#orderForm .gift_box .freegiftRdo").each(function(){
  801. var usepoint = parseInt($(this).attr("usepoint"));
  802. var count = parseInt($(this).attr("count"));
  803. temp = true;
  804. // 첫번째 무료 선택
  805. if (usepoint == 0 && count != 100) {
  806. for (i=0 ; i<countArr.length ; i++) {
  807. if (count == countArr[i]) {
  808. temp = false;
  809. }
  810. }
  811. if (temp) {
  812. countArr.push(count);
  813. $(this).trigger("click");
  814. // 2021.04.14 사은품 사용 포인트가 보유포인트보다 작아야 한다.
  815. var rmPntAmt = parseInt($("#orderForm input[name='rmPntAmt']").val());
  816. var freegiftUsePnt = parseInt($("#orderAmtForm .freegiftUsePnt").text());
  817. var usepoint = parseInt($(this).attr("usepoint"));
  818. rmPntAmt = rmPntAmt - freegiftUsePnt - usepoint;
  819. if (rmPntAmt < 0) {
  820. mcxDialog.alert("보유포인트가 부족합니다.");
  821. return false;
  822. }
  823. }
  824. }
  825. });
  826. // 2021.06.11 사은품 초기화 작업
  827. total_gift = 0;
  828. $("#orderForm .freegiftRdo").each(function(){
  829. if ($(this).attr("allYn") == "Y" ) {
  830. total_gift += 1;
  831. } else {
  832. // 라디오버튼 사은품 체크
  833. if ($(this).is(":checked")) {
  834. // 수령거부가 아닐때 체크
  835. if ($(this).val() != "noSel") {
  836. total_gift += 1;
  837. total_deduct += parseInt($(this).attr("usepoint"));
  838. }
  839. }
  840. }
  841. });
  842. $("#orderForm .total_gift").text(total_gift); // 사은품총선택개수
  843. $("#orderForm .total_deduct").text(total_deduct.addComma()); // 사은품총사용포인트
  844. $("#orderAmtForm .freegiftUsePnt").text(total_deduct);
  845. // 포인트초기화기능
  846. pntDcAmtReset();
  847. // 2021.04.29 사은품동의 체크 기능
  848. /*
  849. $("#orderForm #chk-agree_gift").on("click", function(){
  850. if ($(this).is(":checked") == false) {
  851. mcxDialog.alert("미동의시 사은품 지급이 되지 않습니다.");
  852. }
  853. });
  854. */
  855. }
  856. // 1.8 결제타입로드
  857. paymentInfoSet();
  858. }
  859. });
  860. }
  861. // 1.8 결제타입로드 (결제버튼기능구현)
  862. var paymentInfoSet = function() {
  863. $.ajax( {
  864. type : "POST",
  865. url : '/order/paymentInfo',
  866. data : JSON.stringify(jsonObj),
  867. dataType : 'html',
  868. beforeSend : function(xhr, settings) {
  869. xhr.setRequestHeader("AJAX" , "true");
  870. xhr.setRequestHeader('Accept' , 'application/json');
  871. xhr.setRequestHeader('Content-Type' , 'application/json');
  872. },
  873. success : function(result) {
  874. if (result != null) {
  875. $("#paymentInfo").css("display", "block");
  876. $("#paymentInfo").html(result);
  877. var payType = "";
  878. // 2021.07.05 결제타입초기값 체크
  879. if ($(".payTypeNm").text() != "선택없음") {
  880. if ($("#chk-agree_paymethod123").is(":checked") == false) {
  881. $("#chk-agree_paymethod123").trigger("click");
  882. }
  883. }
  884. // 결제타입명칭 설정
  885. $("#orderForm .area_paymethod .paymethod_box ul li").on("click", function(){
  886. payType = $(this).find(".payType").text();
  887. if ($(this).find("input[name=rdi-paynormal]").is(":checked")) {
  888. $(".payTypeNm").text(payType);
  889. }
  890. // 2021.04.29 수정
  891. if ($("#orderForm input[name=insuranceYn]").is(":checked")) {
  892. $("#orderForm input[name=insuranceYn]").trigger("click");
  893. }
  894. $("#orderForm .area_paymentinfo .agree1").hide();
  895. // 2021.04.25 실시간계좌이체, 무통장입금시 보증보험 신청 약관 노출
  896. if (payType == "실시간계좌이체" || payType == "무통장입금" ) {
  897. $("#orderForm .area_paymethod .agree_insurance").show();
  898. } else {
  899. $("#orderForm .area_paymethod .agree_insurance").hide();
  900. }
  901. if (delvCnt > 0) {
  902. $("#orderForm .area_paymentinfo .paymentinfo.agree2").show();
  903. } else {
  904. $("#orderForm .area_paymentinfo .paymentinfo.agree2").hide();
  905. }
  906. });
  907. // 2021.04.25 실시간계좌이체, 무통장입금시 보증보험 신청 약관 노출
  908. // 2021.05.16 동의박스체크시노출
  909. $("#orderForm input[name=insuranceYn]").on("click", function(){
  910. var displayTemp = true;
  911. if (payType == "실시간계좌이체" || payType == "무통장입금" ) {
  912. if ($(this).is(":checked")) {
  913. $("#orderForm .area_paymethod .agree_insurance").show();
  914. $("#orderForm .area_paymentinfo .paymentinfo").show();
  915. $("#orderForm .area_paymentinfo .agree1").show();
  916. } else {
  917. displayTemp = false;
  918. }
  919. } else {
  920. displayTemp = false;
  921. }
  922. if (displayTemp == false) {
  923. if (delvCnt > 0) {
  924. $("#orderForm .area_paymentinfo .paymentinfo.agree2").show();
  925. } else {
  926. $("#orderForm .area_paymentinfo .paymentinfo.agree2").hide();
  927. }
  928. $("#orderForm .area_paymentinfo .agree1").hide();
  929. }
  930. });
  931. // 2021.05.16 초기값설정
  932. $("#orderForm .area_paymethod .agree_insurance").hide();
  933. if (delvCnt > 0) {
  934. $("#orderForm .area_paymentinfo .paymentinfo.agree2").show();
  935. } else {
  936. $("#orderForm .area_paymentinfo .paymentinfo.agree2").hide();
  937. }
  938. $("#orderForm .area_paymentinfo .agree1").hide();
  939. // 결제하기
  940. $("#btn_payment").on("click", function(){
  941. // 사은품정보
  942. var prePntDcAmtYn = $("#orderForm input[name='rdi-beforpoint']:checked").val();
  943. var paynormal = $("#orderForm input[name='rdi-paynormal']:checked").val();
  944. var orderDetailList = [];
  945. var delvFeeCdList = [];
  946. var ordGoodsQty = 0;
  947. var goodsNm = "";
  948. var orgEntryNo = "";
  949. var entryNo = "";
  950. var giftMsg = "감사합니다.";
  951. var insuranceYn = "N";
  952. // 2021.04.25
  953. if ($("#orderForm input[name=insuranceYn]").is(":checked")) {
  954. insuranceYn = "Y";
  955. }
  956. // 배송주소등록
  957. if ($("#orderAmtForm .recipZipcode").text() == "00000") {
  958. mcxDialog.alert("배송정보를 등록해 주세요.");
  959. // 배송정보화면노출
  960. deliveryAddrInfoDispYn("Y");
  961. return false;
  962. }
  963. // 선물받기일때 배송지주소 받지않음
  964. if (giftPackYn == "N") {
  965. if ($("#orderAmtForm .recipZipcode").text() == "0000" || gagajf.isNull($("#orderAmtForm .recipZipcode").text())) {
  966. mcxDialog.alert("배송정보를 입력해주세요.");
  967. return false;
  968. }
  969. } else {
  970. if (gagajf.isNull($("#orderForm #orderGiftInfo input[name=recipNm]").val())) {
  971. mcxDialog.alert("선물받을분 이름을 입력해주세요.");
  972. $("#orderForm #orderGiftInfo input[name=recipNm]").focus();
  973. orderGiftInfoDispYn("Y");
  974. return false;
  975. }
  976. if (gagajf.isNull($("#orderForm #orderGiftInfo input[name=recipPhnno]").val())) {
  977. mcxDialog.alert("선물받을분 휴대폰번호를 입력해주세요.");
  978. $("#orderForm #orderGiftInfo input[name=recipPhnno]").focus();
  979. orderGiftInfoDispYn("Y");
  980. return false;
  981. }
  982. // 2021.07.05
  983. if ($("#orderForm #orderGiftInfo input[name=recipPhnno]").val().length < 12) {
  984. mcxDialog.alert("선물받을분 휴대폰번호를 정확히 입력해주세요.");
  985. $('#orderForm #orderGiftInfo input[name=recipPhnno]').focus();
  986. return false;
  987. }
  988. if ($("#orderForm #orderGiftInfo input[name=recipPhnno]").val().length > 13) {
  989. mcxDialog.alert("선물받을분 휴대폰번호를 정확히 입력해주세요.");
  990. $('#orderForm #orderGiftInfo input[name=recipPhnno]').focus();
  991. return false;
  992. }
  993. $("#orderAmtForm .recipNm").text($("#orderForm #orderGiftInfo input[name=recipNm]").val());
  994. $("#orderAmtForm .recipPhnno").text($("#orderForm #orderGiftInfo input[name=recipPhnno]").val());
  995. if (gagajf.isNull($("textarea#giftMsg").val())) {
  996. giftMsg = "감사합니다.";
  997. } else {
  998. giftMsg = $("textarea#giftMsg").val();
  999. }
  1000. }
  1001. // TODO 개인통관번호 동의 체크시 통관번호 등록
  1002. if (foreignBuyYn == "Y") {
  1003. if ($("#orderForm input[name=rdi-overseas]:checked").val() == "Y") {
  1004. if (gagajf.isNull($("#orderForm input[name=entryNo]").val())) {
  1005. mcxDialog.alert("개인통관고유부호를 입력해주세요.");
  1006. $('#orderForm input[name=entryNo]').focus();
  1007. // 배송정보화면노출
  1008. entryInfoDispYn("Y");
  1009. return false;
  1010. }
  1011. orgEntryNo = $("#orderForm input[name=entryNo]").val();
  1012. if (orgEntryNo.substr(0,1) != "P") {
  1013. mcxDialog.alert("개인통관고유부호가 유효하지 않습니다.");
  1014. $('#orderForm input[name=entryNo]').focus();
  1015. // 배송정보화면노출
  1016. deliveryAddrInfoDispYn("Y");
  1017. return false;
  1018. }
  1019. if (orgEntryNo.length < 13) {
  1020. mcxDialog.alert("개인통관고유부호가 유효하지 않습니다.");
  1021. $('#orderForm input[name=entryNo]').focus();
  1022. // 배송정보화면노출
  1023. entryInfoDispYn("Y");
  1024. return false;
  1025. }
  1026. if (!$("#orderForm #chk-overs-agr").is(":checked")) {
  1027. mcxDialog.alert("개인통관정보고유부호 정보 동의/저장항목을 체크해주세요.");
  1028. // 배송정보화면노출
  1029. entryInfoDispYn("Y");
  1030. return false;
  1031. }
  1032. }
  1033. }
  1034. // 주문제작상품일때 주문제작정보동의
  1035. if (orderMadeYn == "Y") {
  1036. if (!$("#orderForm #chk-custom-agr1").is(":checked")) {
  1037. mcxDialog.alert("주문제작상품에 대한 동의를 하지 않으실 경우 해당 상품을 쇼핑백에서 제외하신 후 다시 결제를 시도해주세요.");
  1038. // 배송정보화면노출
  1039. madeInfoDispYn("Y");
  1040. return false;
  1041. }
  1042. }
  1043. // 사은품지급할 경우 체크
  1044. if ($("#orderAmtForm .freegiftValArr").text().length > 0) {
  1045. if (!$("#orderForm #chk-agree_gift").is(":checked")) {
  1046. mcxDialog.alert("사은품 지급 정보 동의를 체크해주세요.");
  1047. // 배송정보화면노출
  1048. freegiftInfoDispYn("Y");
  1049. return false;
  1050. }
  1051. }
  1052. // 결재수단
  1053. if (gagajf.isNull(paynormal)) {
  1054. mcxDialog.alert("결제수단을 선택해 주세요.");
  1055. // 결제수단정보노출
  1056. paymentInfoDispYn("Y");
  1057. return false;
  1058. }
  1059. var paynormalArr = paynormal.split("|");
  1060. var pgGb = paynormalArr[0];
  1061. var payMeans = paynormalArr[1];
  1062. var custPayMeans = "N";
  1063. // 자주쓰는결제타입
  1064. if ($("#orderForm #chk-agree_paymethod").is(":checked") == true) {
  1065. custPayMeans = "Y";
  1066. }
  1067. // 주문상세데이타 생성
  1068. $("#orderDetailInfo .cartSq").each(function(){
  1069. // 주문상세단위 총알배송여부 변경
  1070. var orderDetailShotDelvYn = $(this).parent().find(".shotDelvYn").text();
  1071. if (orderDetailShotDelvYn == "Y") {
  1072. if (shotDelvYn == "N") {
  1073. orderDetailShotDelvYn = "N";
  1074. }
  1075. }
  1076. // 개인통관번호
  1077. if ($(this).parent().find(".foreignBuyYn").text() == "Y") {
  1078. entryNo = orgEntryNo;
  1079. } else {
  1080. entryNo = "";
  1081. }
  1082. var orderDetailData = {
  1083. "cartSq" : $(this).text()
  1084. ,"currPrice" : $(this).parent().find(".orgCurrPrice").text()
  1085. ,"optAddPrice" : $(this).parent().find(".optAddPrice").text()
  1086. ,"ordAmt" : $(this).parent().find(".ordAmt").text()
  1087. ,"cpn1CpnSq" : $(this).parent().find(".cpn1CpnSq").text()
  1088. ,"cpn1DcAmt" : $(this).parent().find(".cpn1DcAmt").text()
  1089. ,"goodsQty" : $(this).parent().find(".goodsQty").text()
  1090. ,"tmtb1Sq" : $(this).parent().find(".tmtb1Sq").text()
  1091. ,"tmtb1DcAmt" : $(this).parent().find(".tmtb1DcAmt").text()
  1092. ,"tmtb2Sq" : $(this).parent().find(".tmtb2Sq").text()
  1093. ,"tmtb2DcAmt" : $(this).parent().find(".tmtb2DcAmt").text()
  1094. ,"goodsCpnSq" : $(this).parent().find(".goodsCpnSq").text()
  1095. ,"goodsCpnDcAmt" : $(this).parent().find(".goodsCpnDcAmt").text()
  1096. ,"cartCpnSq" : $(this).parent().find(".cartCpnSq").text()
  1097. ,"cartCpnDcAmt" : $(this).parent().find(".cartCpnDcAmt").text()
  1098. ,"prePntDcAmt" : $(this).parent().find(".prePntDcAmt1").text()
  1099. ,"pntDcAmt" : $(this).parent().find(".pntDcAmt1").text()
  1100. ,"gfcdUseAmt" : $(this).parent().find(".gfcdUseAmt1").text()
  1101. ,"realOrdAmt" : $(this).parent().find(".realOrdAmt1").text()
  1102. ,"savePntAmt" : $(this).parent().find(".savePntAmt1").text()
  1103. ,"shotDelvYn" : orderDetailShotDelvYn
  1104. ,"foreignBuyYn" : $(this).parent().find(".foreignBuyYn").text()
  1105. ,"makeGoodsYn" : $(this).parent().find(".orderMadeYn").text()
  1106. ,"delvFeeCd" : $(this).parent().find(".delvFeeCd").text()
  1107. ,"goodsCd" : $(this).parent().find(".goodsCd").text()
  1108. ,"itemCdArr" : $(this).parent().find(".itemCd").text().split(",")
  1109. ,"optCdArr" : $(this).parent().find(".optCd").text().split(",")
  1110. ,"itemQtyArr" : $(this).parent().find(".itemQtyr").text().split(",")
  1111. ,"goodsType" : $(this).parent().find(".goodsType").text()
  1112. ,"entryNo" : entryNo
  1113. ,"giftPackYn" : giftPackYn
  1114. }
  1115. // 상품수
  1116. ordGoodsQty++;
  1117. orderDetailList.push(orderDetailData);
  1118. });
  1119. // 주문배송업체정보 생성
  1120. $("#delvFeeCdInfo .delvFeeCd").each(function(){
  1121. var delvFeeCdData = {
  1122. "delvFeeCd" : $(this).text()
  1123. ,"supplyCompCd" : $(this).parent().find(".supplyCompCd").text()
  1124. ,"delvFee" : $(this).parent().find(".delvFee").text()
  1125. ,"delvCpnSq" : $(this).parent().find(".delvCpnSq").text()
  1126. ,"delvCpnDcAmt" : $(this).parent().find(".delvCpnDcAmt").text()
  1127. }
  1128. delvFeeCdList.push(delvFeeCdData);
  1129. });
  1130. // 2021.04.29 상픈품 체크박스 미동의시 사은품 미지급
  1131. var freegiftValArr = $("#orderAmtForm .freegiftValArr").text().split(",");
  1132. var freegiftSqArr = $("#orderAmtForm .freegiftSqArr").text().split(",");
  1133. var freegiftGoodsArr = $("#orderAmtForm .freegiftGoodsArr").text().split(",");
  1134. var freegiftUsePointArr = $("#orderAmtForm .freegiftUsePointArr").text().split(",");
  1135. /*
  1136. if (!$("#orderForm #chk-agree_gift").is(":checked") == false) {
  1137. freegiftValArr = "";
  1138. freegiftSqArr = "";
  1139. freegiftGoodsArr = "";
  1140. freegiftUsePointArr = "";
  1141. }
  1142. */
  1143. // 주문데이타 생성
  1144. var orderData = {
  1145. "custNm" : $("#orderAmtForm .custNm").text()
  1146. ,"email" : $("#orderAmtForm .email").text()
  1147. ,"recipNm" : $("#orderAmtForm .recipNm").text()
  1148. ,"recipPhnno" : $("#orderAmtForm .recipPhnno").text()
  1149. ,"recipZipcode" : $("#orderAmtForm .recipZipcode").text()
  1150. ,"recipBaseAddr" : $("#orderAmtForm .recipBaseAddr").text()
  1151. ,"recipDtlAddr" : $("#orderAmtForm .recipDtlAddr").text()
  1152. ,"delvMemo" : $("#orderAmtForm .delvMemo").text()
  1153. ,"insuranceYn" : insuranceYn
  1154. ,"sexGb" : $("#orderAmtForm .sexGb").text()
  1155. ,"birthYmd" : $("#orderAmtForm .birthYmd").text()
  1156. ,"prePntDcAmtYn" : prePntDcAmtYn
  1157. ,"orderDetailList" : orderDetailList
  1158. ,"delvFeeCdList" : delvFeeCdList
  1159. ,"shotDelvYn" : shotDelvYn
  1160. ,"entryNo" : entryNo
  1161. ,"pgGb" : pgGb
  1162. ,"payMeans" : payMeans // 네이버페이, 카카오페이
  1163. ,"payAmt" : $("#orderAmtForm .realOrdSumAmt").text()
  1164. ,"ordNm" : $("#orderAmtForm .custNm").text()
  1165. ,"ordPhnno" : $("#orderAmtForm .cellPhnno").text()
  1166. ,"goodsNm" : $("#orderAmtForm .goodsNm").eq(0).text()
  1167. ,"ordGoodsQty" : ordGoodsQty
  1168. ,"freegiftValArr" : freegiftValArr
  1169. ,"freegiftSqArr" : freegiftSqArr
  1170. ,"freegiftGoodsArr" : freegiftGoodsArr
  1171. ,"freegiftUsePointArr" : freegiftUsePointArr
  1172. ,"giftMsg" : giftMsg
  1173. ,"custPayMeans" : custPayMeans
  1174. ,"cartSqArr" : cartSqArr
  1175. ,"orgGoodsSumAmt" : $("#orderAmtForm .orgGoodsSumAmt").text()
  1176. ,"cpn1DcSumAmt" : $("#orderAmtForm .cpn1DcSumAmt").text()
  1177. ,"tmtb1DcSumAmt" : $("#orderAmtForm .tmtb1DcSumAmt").text()
  1178. ,"tmtb2DcSumAmt" : $("#orderAmtForm .tmtb2DcSumAmt").text()
  1179. ,"goodsCpnDcSumAmt" : $("#orderAmtForm .goodsCpnDcSumAmt").text()
  1180. ,"cartCpnDcSumAmt" : $("#orderAmtForm .cartCpnDcSumAmt").text()
  1181. ,"prePntDcSumAmt" : $("#orderAmtForm .prePntDcSumAmt").text()
  1182. ,"pntDcSumAmt" : $("#orderAmtForm .pntDcSumAmt").text()
  1183. ,"gfcdUseSumAmt" : $("#orderAmtForm .gfcdUseSumAmt").text()
  1184. ,"realOrdSumAmt" : $("#orderAmtForm .realOrdSumAmt").text()
  1185. ,"delvSumAmt" : $("#orderAmtForm .delvSumAmt").text()
  1186. };
  1187. $.ajax( {
  1188. type : "POST",
  1189. url : '/order/create/preOrder',
  1190. data : JSON.stringify(orderData),
  1191. dataType : 'html',
  1192. beforeSend : function(xhr, settings) {
  1193. xhr.setRequestHeader("AJAX" , "true");
  1194. xhr.setRequestHeader('Accept' , 'application/json');
  1195. xhr.setRequestHeader('Content-Type' , 'application/json');
  1196. },
  1197. success : function(result) {
  1198. // 결재정보로드
  1199. $("#order_info").html(result);
  1200. var pgGb = $("#order_info input[name=pgGb]").val();
  1201. if (pgGb == "NAVER") {
  1202. fnNaverPaymentReady();
  1203. } else if (pgGb == "KAKAO") {
  1204. fnKakaoPaymentReady();
  1205. } else if (pgGb == "KCP" || pgGb == "PAYCO") {
  1206. // 2021.06.02 태팔요청
  1207. var protocol = location.protocol;
  1208. $("#order_info input[name=Ret_URL]").val(protocol + _frontUrl + "/order/pay/result/response");
  1209. kcp_AJAX();
  1210. }
  1211. }
  1212. });
  1213. });
  1214. // 1.9 할인영역 설정 (로그인여부일때 동작)
  1215. if (isLogin == true) {
  1216. dcAmtInfoSet();
  1217. } else {
  1218. // 금액계산초기화
  1219. custCpnSumAmtCal();
  1220. }
  1221. }
  1222. }
  1223. });
  1224. }
  1225. // 1.9.0 프로모션 쿠폰 적용 함수
  1226. var serialCpnApply = function(){
  1227. if (gagajf.isNull($("#serialCpnNm").val())) {
  1228. mcxDialog.alert("할인코드를 입력해주세요.");
  1229. $('#serialCpnNm').focus();
  1230. return false;
  1231. }
  1232. let data = {
  1233. rdCpnNm : $("#serialCpnNm").val()
  1234. }
  1235. $.ajax( {
  1236. type : "POST",
  1237. url : '/cart/list/serialCpnApply',
  1238. contentType : 'application/json',
  1239. dataType : 'json',
  1240. data : JSON.stringify(data),
  1241. success : function(result) {
  1242. // 프로모션쿠폰적용 후 할인영역 노출
  1243. jsonObj.dispYn = "Y";
  1244. // 성공일때는 쿠폰정보 및 포인트 정보 reset
  1245. if (result.serialCpnInfo.result == "SUCCESS") {
  1246. mcxDialog.alert("쿠폰 등록이 되었습니다.");
  1247. // 1.8 할인영역 재로드
  1248. dcAmtInfoSet(jsonData);
  1249. } else {
  1250. mcxDialog.alert(result.serialCpnInfo.result);
  1251. $("#serialCpnNm").val("");
  1252. }
  1253. }
  1254. });
  1255. }
  1256. // 1.9 할인영역 설정 (쿠폰, 선포인트, 포인트, 상품권)
  1257. var dcAmtInfoSet = function() {
  1258. // 1.8.1 할인정보로드
  1259. $.ajax( {
  1260. type : "POST",
  1261. url : '/order/dcAmtInfo',
  1262. data : JSON.stringify(jsonObj),
  1263. dataType : 'html',
  1264. beforeSend : function(xhr, settings) {
  1265. xhr.setRequestHeader("AJAX" , "true");
  1266. xhr.setRequestHeader('Accept' , 'application/json');
  1267. xhr.setRequestHeader('Content-Type' , 'application/json');
  1268. },
  1269. success : function(result) {
  1270. if (result != null) {
  1271. $("#dcAmtInfo").css("display", "block");
  1272. $("#dcAmtInfo").html(result);
  1273. // 상품쿠폰 팝업정보로드
  1274. $.ajax( {
  1275. type : "POST",
  1276. url : '/order/couponApplyPop',
  1277. data : JSON.stringify(jsonObj),
  1278. dataType : 'html',
  1279. beforeSend : function(xhr, settings) {
  1280. xhr.setRequestHeader("AJAX" , "true");
  1281. xhr.setRequestHeader('Accept' , 'application/json');
  1282. xhr.setRequestHeader('Content-Type' , 'application/json');
  1283. },
  1284. success : function(result) {
  1285. $("#couponModifyPop").html(result);
  1286. // 1.8.1 선포인트기능초기화
  1287. prePntDcAmtReset();
  1288. // 1.8.2 쿠폰적용초기화(할인율최고)(상품,장바구니)
  1289. custGoodsCpnInit();
  1290. var custCpnCnt = parseInt($("#orderForm input[name=custCpnCnt]").val());
  1291. var custDelvCpnCnt = parseInt($("#orderForm input[name=custDelvCpnCnt]").val());
  1292. var applyCpnCnt = custCpnCnt + custDelvCpnCnt;
  1293. // 2021.04.23 보유쿠폰이 없을때 적용
  1294. if (applyCpnCnt < 1) {
  1295. if ($("#orderForm #chk-maxdisc").is(":checked")) {
  1296. $("#orderForm #chk-maxdisc").trigger("click");
  1297. }
  1298. }
  1299. // 상품쿠폰, 장바구니쿠폰 팝업 열기
  1300. $("#btn_couponModify_pop").on("click", function(){
  1301. // 2021.04.23 보유쿠폰이 없을때 적용
  1302. if (custCpnCnt < 1) {
  1303. mcxDialog.alert("적용 가능한 쿠폰이 없습니다.");
  1304. return false;
  1305. }
  1306. $("#couponModifyPop").modal("show");
  1307. // 쿠폰적용초기화(할인율최고)(상품,장바구니)
  1308. custGoodsCpnInit();
  1309. return false;
  1310. });
  1311. // 1.8.3 상품상세쿠폰 팝업 열기
  1312. $("#couponModifyPop .area_item_coupon .form_field .select_custom").on("click", function() {
  1313. var index = parseInt($(this).attr("value"));
  1314. var obj = $(".couponSelectPop").eq(index);
  1315. obj.show().addClass("active");
  1316. $("body").css({"overflow":"hidden"});
  1317. });
  1318. // 1.8.4 쿠폰적용버튼
  1319. $("#btn_coupon_apply").on("click", function(){
  1320. // 상품쿠폰적용
  1321. $('#couponApplyForm .couponSelectPop ul li.selected').each(function(index){
  1322. custCpnApply($(this), index, "goodsCpn");
  1323. });
  1324. // 장바구니쿠폰적용
  1325. $('#couponApplyForm .cartCpn').each(function(index){
  1326. if ($(this).find("input[name=rdi-cart-coupon]").is(":checked")) {
  1327. custCpnApply($(this), index, "cartCpn");
  1328. }
  1329. });
  1330. // 최대할인혜택적용 체크해제
  1331. if ($("#chk-maxdisc").is(":checked")) {
  1332. $("#chk-maxdisc").trigger("click");
  1333. }
  1334. $("#couponModifyPop .close-modal").trigger("click"); // 팝업닫기
  1335. });
  1336. // 1.8.5 쿠폰 최대할인금액 초기화 버튼 설정
  1337. $("#orderForm #chk-maxdisc").on("click", function(){
  1338. // 2021.04.23 보유쿠폰이 없을때 적용
  1339. if (applyCpnCnt < 1) {
  1340. mcxDialog.alert("적용 가능한 쿠폰이 없습니다.");
  1341. return false;
  1342. }
  1343. if ($(this).is(":checked")) {
  1344. // 2021.04.23
  1345. mcxDialog.alert("선택한 쿠폰이 아닌 보유한 쿠폰을 통해 최대할인 혜택을 받을 수 있도록 쿠폰이 자동 적용됩니다.");
  1346. // 상품&장바구니쿠폰 초기환
  1347. custGoodsCpnInit();
  1348. // 배송비쿠폰 초기환
  1349. custDelvCpnInit();
  1350. }
  1351. });
  1352. }
  1353. });
  1354. // 배송비쿠폰 팝업정보로드
  1355. $.ajax( {
  1356. type : "POST",
  1357. url : '/order/delvCouponApplyPop',
  1358. data : JSON.stringify(jsonObj),
  1359. dataType : 'html',
  1360. beforeSend : function(xhr, settings) {
  1361. xhr.setRequestHeader("AJAX" , "true");
  1362. xhr.setRequestHeader('Accept' , 'application/json');
  1363. xhr.setRequestHeader('Content-Type' , 'application/json');
  1364. },
  1365. success : function(result) {
  1366. $("#couponSelectPop02").html(result);
  1367. // 1.8.3 쿠폰적용초기화(할인율최고)(배송비)
  1368. custDelvCpnInit();
  1369. }
  1370. });
  1371. // 배송비상세쿠폰 팝업 열기
  1372. $(".od .area_seldiscount .dlvr_fee_box .select_custom").on("click", function() {
  1373. $('#couponSelectPop02').show().addClass("active");
  1374. $("body").css({"overflow":"hidden"});
  1375. });
  1376. // 2021.07.05 alert 문구 추가
  1377. $("#orderForm input[name=pointNotApply]").on("click", function(){
  1378. mcxDialog.alert("3만원 이상 결제시에만 포인트 사용이 가능합니다.");
  1379. return false;
  1380. });
  1381. $("#btn_point_not_apply").on("click", function(){
  1382. mcxDialog.alert("3만원 이상 결제시에만 포인트 사용이 가능합니다.");
  1383. return false;
  1384. });
  1385. // 1.8.7 포인트 적용버튼 기능
  1386. $("#btn_point_apply").on("click", function(){
  1387. var rmPntAmt = parseInt($("#orderForm input[name='rmPntAmt']").val());
  1388. var freegiftUsePnt = parseInt($("#orderAmtForm .freegiftUsePnt").text());
  1389. var pntDcAmt = parseInt(uncomma($("#orderForm input[name='pntDcAmtStr']").val()));
  1390. var realOrdAmt = parseInt($("#orderAmtForm .realOrdSumAmt").text());
  1391. var pointUseMaxLimit = parseInt($("#orderForm input[name='pointUseMaxLimit']").val());
  1392. var applyPntDcAmt = (realOrdAmt * pointUseMaxLimit) / 100;
  1393. rmPntAmt = rmPntAmt - freegiftUsePnt;
  1394. if (gagajf.isNull($("#orderForm input[name=pntDcAmtStr]").val())) {
  1395. mcxDialog.alert("포인트를 입력하신 후 다시 시도해주세요.");
  1396. $('#orderForm input[name=pntDcAmtStr]').focus();
  1397. return false;
  1398. }
  1399. // 입력여부체크
  1400. if (pntDcAmt < 1) {
  1401. mcxDialog.alert("포인트를 입력한 후 다시 시도해주세요.");
  1402. // 포인트리셋기능
  1403. pntDcAmtReset();
  1404. return false;
  1405. }
  1406. // 10원단위부터 입력가능
  1407. if (pntDcAmt % 10 > 0) {
  1408. mcxDialog.alert("포인트는 10P단위로 사용이 가능합니다.");
  1409. // 포인트리셋기능
  1410. pntDcAmtReset();
  1411. return false;
  1412. }
  1413. // 결제금액을 초과 할 수 없습니다.
  1414. if (pntDcAmt > realOrdAmt) {
  1415. mcxDialog.alert("입력한 포인트가 결제 금액보다 많습니다.");
  1416. // 포인트리셋기능
  1417. pntDcAmtReset();
  1418. return false;
  1419. }
  1420. // 보유포인트보다 초과 사용 불가
  1421. if (pntDcAmt > rmPntAmt) {
  1422. mcxDialog.alert("입력한 포인트가 보유한 포인트보다 많습니다.");
  1423. // 포인트리셋기능
  1424. pntDcAmtReset();
  1425. return false;
  1426. }
  1427. // TODO 포인트 사용금액 1000P 이상 사용
  1428. if (pntDcAmt < 1000) {
  1429. mcxDialog.alert("포인트는 최소 1,000P이상 사용해야 합니다.");
  1430. // 포인트리셋기능
  1431. pntDcAmtReset();
  1432. return false;
  1433. }
  1434. // 실결제금액보다 크게 적용 되었을때 적용 불가능
  1435. if (pntDcAmt > applyPntDcAmt) {
  1436. mcxDialog.alert("결제금액의 최대 " + pointUseMaxLimit +"%를 초과 사용 할 수 없습니다.");
  1437. // 포인트리셋기능
  1438. pntDcAmtReset();
  1439. return false;
  1440. }
  1441. // 2021.04.23 추가
  1442. mcxDialog.alert("총 " + getZeroMinusDelAmt(pntDcAmt) + " P를 차감 결제 합니다.");
  1443. // 포인트 적용
  1444. $("#orderAmtForm .pntDcSumAmt").text(pntDcAmt);
  1445. $("#pntDcAmt").text(getZeroMinusDelAmt(pntDcAmt));
  1446. // 상품권리렛기능
  1447. gfcdUseAmtReset();
  1448. });
  1449. // 1.8.8 상품권 적용버튼 기능
  1450. $("#btn_gfcd_apply").on("click", function(){
  1451. var rmGfcdAmt = parseInt($("#orderForm input[name='rmGfcdAmt']").val());
  1452. var gfcdUseAmt = parseInt(uncomma($("#orderForm input[name='gfcdUseAmtStr']").val()));
  1453. var realOrdAmt = parseInt($("#orderAmtForm .realOrdSumAmt").text());
  1454. if (gagajf.isNull($("#orderForm input[name=gfcdUseAmtStr]").val())) {
  1455. mcxDialog.alert("금액을 입력한 후 다시 시도해주세요.");
  1456. $('#orderForm input[name=gfcdUseAmtStr]').focus();
  1457. return false;
  1458. }
  1459. // 입력여부체크
  1460. if (gfcdUseAmt < 1 || $("#orderForm input[name='gfcdUseAmtStr']").val() == "") {
  1461. mcxDialog.alert("금액을 입력한 후 다시 시도해주세요.");
  1462. // 상품권리셋기능
  1463. gfcdUseAmtReset();
  1464. return false;
  1465. }
  1466. // 결제금액을 초과 할 수 없습니다.
  1467. if (gfcdUseAmt > realOrdAmt) {
  1468. mcxDialog.alert("입력한 금액이 결제할 금액보다 많습니다.");
  1469. // 포인트리셋기능
  1470. gfcdUseAmtReset();
  1471. return false;
  1472. }
  1473. // 보유금액보다 초과 사용 불가
  1474. if (gfcdUseAmt > rmGfcdAmt) {
  1475. mcxDialog.alert("보유금액 보다 초과 사용 할 수 없습니다.");
  1476. // 상품권리셋기능
  1477. gfcdUseAmtReset();
  1478. return false;
  1479. }
  1480. // 보유금액보다 초과 사용 불가
  1481. if (gfcdUseAmt > rmGfcdAmt) {
  1482. mcxDialog.alert("보유금액 보다 초과 사용 할 수 없습니다.");
  1483. // 상품권리셋기능
  1484. gfcdUseAmtReset();
  1485. return false;
  1486. }
  1487. // TODO 포인트 사용금액 1000원 이상 사용
  1488. if (gfcdUseAmt < 1000) {
  1489. mcxDialog.alert("상품권 사용금액은 최소 1,000원 이상 사용해야 합니다.");
  1490. // 상품권리셋기능
  1491. gfcdUseAmtReset();
  1492. return false;
  1493. }
  1494. // 2021.04.23 추가
  1495. mcxDialog.alert("총 " + gfcdUseAmt.addComma() + " 원을 상품권 금액에서 차감 결제 합니다.");
  1496. // 상품권 적용
  1497. $("#orderAmtForm .gfcdUseSumAmt").text(gfcdUseAmt);
  1498. $("#gfcdUseAmt").text(getZeroMinusDelAmt(gfcdUseAmt));
  1499. // 금액전체계산
  1500. custCpnSumAmtCal();
  1501. });
  1502. // 금액계산초기화
  1503. custCpnSumAmtCal();
  1504. }
  1505. }
  1506. });
  1507. }
  1508. // 1.10.1 상품쿠폰초기화
  1509. var custGoodsCpnInit = function() {
  1510. // 쿠폰최대할인 적용
  1511. $("#chk-maxdisc").attr("checked", true);
  1512. $("#chk-maxdisc01").attr("checked", true);
  1513. // 쿠폰초기화
  1514. $("#couponModifyPop .goodsCpn").each(function(index){
  1515. // select box 쿠폰 적용
  1516. var cpnCartSq = $(this).find("input[name='cpnCartSq']").val();
  1517. // 장바구니시퀀스 체크
  1518. $("#orderAmtForm .cartSq").each(function(){
  1519. if (cpnCartSq == $(this).text()) {
  1520. $(this).parent().find(".goodsCpnSq").text("0"); // 상품쿠폰시퀀스
  1521. $(this).parent().find(".goodsCpnDcAmt").text("0"); // 상품쿠폰할인금액
  1522. }
  1523. });
  1524. $(this).find("input[name='custCpnSq']").val("0");
  1525. $(this).find("input[name='cpnDcAmt']").val("0");
  1526. // 적용안함 적용
  1527. var index = parseInt($(this).attr("value"));
  1528. var cpnObj = $(".couponSelectPop").eq(index);
  1529. var emptyHtml = cpnObj.find("ul li:last-child").html();
  1530. // 선택기능
  1531. $(this).find("ul li").removeClass("selected");
  1532. cpnObj.find("ul li:last-child").addClass("selected");
  1533. $(this).find(".select .item_coupon").html(emptyHtml);
  1534. });
  1535. // 상품쿠폰 최대할인율 쿠폰적용
  1536. $('#couponModifyPop .goodsCpn').each(function(idx){
  1537. cpnApplyTemp = false;
  1538. // select box 적용
  1539. $("#couponModifyPop .couponSelectPop").eq(idx).find("ul li").each(function(){
  1540. // 쿠폰적용안되었으면실행
  1541. if (cpnApplyTemp == false) {
  1542. // 쿠폰중복적용체크
  1543. if (custCpnDuplicationCheck($(this).attr("value"), idx)) {
  1544. // 쿠폰적용
  1545. custCpnApply($(this), idx, "goodsCpn");
  1546. // 쿠폰할인적용
  1547. cpnApplyTemp = true;
  1548. }
  1549. }
  1550. // 쿠폰 select 버튼기능
  1551. $(this).on("click", function(){
  1552. if (custCpnDuplicationCheck($(this).attr("value"), idx)) {
  1553. // 2021.04.19 주문서 쿠폰 선택오류 수정
  1554. // 전체선택해제
  1555. $(this).parent().find("li").removeClass("selected");
  1556. // 본인선택기능
  1557. $(this).addClass("selected");
  1558. // 쿠폰적용(임시)
  1559. custCpnApplyTemp($(this), idx, "goodsCpn");
  1560. } else {
  1561. custCpnNotApply($(this), idx);
  1562. }
  1563. });
  1564. });
  1565. });
  1566. // 장바구니쿠폰초기화
  1567. custCartCpnInit();
  1568. }
  1569. // 1.10.2 장바구니쿠폰초기화
  1570. var custCartCpnInit = function() {
  1571. // 장바구니쿠폰 초기화 적용
  1572. $("#couponModifyPop .cartCpn").each(function(index) {
  1573. if (index == 0) {
  1574. custCpnApply($(this), index, "cartCpn"); // 쿠폰적용
  1575. }
  1576. // 쿠폰 select 버튼기능
  1577. $(this).on("click", function(){
  1578. custCpnApplyTemp($(this), index, "cartCpn"); // 쿠폰적용
  1579. // 최대할인혜택적용 체크해제
  1580. if ($("#chk-maxdisc01").is(":checked")) {
  1581. $("#chk-maxdisc01").attr("checked", false);
  1582. $("#chk-maxdisc").attr("checked", false);
  1583. }
  1584. });
  1585. });
  1586. // 포인트기능 리셋
  1587. pntDcAmtReset();
  1588. }
  1589. // 1.10.3 배송비쿠폰초기화
  1590. var custDelvCpnInit = function() {
  1591. // 배송비쿠폰 초기화 적용
  1592. $("#couponSelectPop02 .delvCpn").each(function(index) {
  1593. if (index == 0) {
  1594. // 쿠폰적용
  1595. custCpnApply($(this), index, "delvCpn");
  1596. }
  1597. // 쿠폰 select 버튼기능
  1598. $(this).on("click", function(){
  1599. // 쿠폰적용
  1600. custCpnApply($(this), index, "delvCpn");
  1601. // 최대할인혜택적용 체크해제
  1602. if ($("#chk-maxdisc").is(":checked")) {
  1603. $("#chk-maxdisc").trigger("click");
  1604. }
  1605. });
  1606. });
  1607. }
  1608. // 1.10.4 쿠폰중복사용체크
  1609. var custCpnDuplicationCheck = function(custCpnSq, index) {
  1610. var selCustSq = 0;
  1611. var cnt = 0;
  1612. // 쿠폰적용가능
  1613. if (custCpnSq == 0) {
  1614. return true;
  1615. }
  1616. // 쿠폰중본사용체크
  1617. $("#couponModifyPop .goodsCpn input[name='custCpnSq']").each(function(i){
  1618. if (index != i) {
  1619. selCustSq = $(this).val();
  1620. if (selCustSq == custCpnSq) {
  1621. cnt++;
  1622. }
  1623. }
  1624. });
  1625. // 쿠폰적용불가
  1626. if (cnt > 0) {
  1627. return false;
  1628. }
  1629. // 쿠폰적용가능
  1630. else {
  1631. return true;
  1632. }
  1633. }
  1634. // 1.10.5 임시로 쿠폰적용
  1635. var custCpnApplyTemp = function(obj, idx, cpnType) {
  1636. // 상품쿠폰적용
  1637. if (cpnType == "goodsCpn") {
  1638. var itemHtml = obj.find(".dlvr_coupon").html();
  1639. $("#couponModifyPop .goodsCpn .select .item_coupon").eq(idx).html(itemHtml);
  1640. $("#couponModifyPop .goodsCpn input[name='cpnDcAmt']").eq(idx).val(obj.attr("data"));
  1641. $("#couponModifyPop .goodsCpn input[name='custCpnSq']").eq(idx).val(obj.attr("value"));
  1642. // 장바구니쿠폰 초기화 적용
  1643. $("#couponModifyPop .cartCpn").each(function(index) {
  1644. if (index == 0) {
  1645. custCpnApplyTemp($(this), 0, "cartCpn"); // 쿠폰적용
  1646. }
  1647. });
  1648. // 상품쿠폰 선택불가 처리
  1649. custCpnSqLiDisabled();
  1650. // 상품상세쿠폰 팝업 닫기
  1651. $("#couponModifyPop .lap .popup_close").eq(idx).trigger("click");
  1652. }
  1653. // 장바구니쿠폰적용
  1654. else if (cpnType == "cartCpn") {
  1655. var dcWay = obj.find("input[name='dcWay']").val();
  1656. var dcVal = obj.find("input[name='dcVal']").val();
  1657. var maxDcAmt = obj.find("input[name='maxDcAmt']").val();
  1658. var buyLimitAmt = obj.find("input[name='buyLimitAmt']").val();
  1659. var cartCpnDcSumAmt = 0;
  1660. var tempSumAmt = 0;
  1661. var cartSqLen = $(".cartSq").length;
  1662. var leftAmt = 0;
  1663. var index = 1;
  1664. // 장바구니쿠폰 해당 장바구니상품들 할인가 적용
  1665. obj.find("input[name='cartCpnCartSq']").each(function(){
  1666. var cartCpnCartSq = $(this).val();
  1667. var cartCpnDcAmt = 0;
  1668. // 장바구니시퀀스 체크
  1669. $("#orderAmtForm .cartSq").each(function(){
  1670. if (cartCpnCartSq == $(this).text()) {
  1671. var orgCurrPrice = parseInt($(this).parent().find(".orgCurrPrice").text());
  1672. var cpn1DcAmt = parseInt($(this).parent().find(".cpn1DcAmt").text());
  1673. var goodsQty = parseInt($(this).parent().find(".goodsQty").text());
  1674. var tmtb1DcAmt = parseInt($(this).parent().find(".tmtb1DcAmt").text());
  1675. var tmtb2DcAmt = parseInt($(this).parent().find(".tmtb2DcAmt").text());
  1676. var goodsCpnDcAmt = 0;
  1677. $("#couponModifyPop .goodsCpn input[name=cpnCartSq]").each(function(){
  1678. if ($(this).val() == cartCpnCartSq) {
  1679. goodsCpnDcAmt = parseInt($(this).parent().find("input[name=cpnDcAmt]").val());
  1680. }
  1681. });
  1682. var tempAmt = ((orgCurrPrice - cpn1DcAmt) * goodsQty) - tmtb1DcAmt - tmtb2DcAmt - goodsCpnDcAmt;
  1683. tempSumAmt = tempSumAmt + tempAmt;
  1684. // 할인율일때 할인금액
  1685. if (dcWay == "G240_11") {
  1686. cartCpnDcAmt = (tempAmt * dcVal) / 100;
  1687. cartCpnDcSumAmt = cartCpnDcSumAmt + cartCpnDcAmt;
  1688. }
  1689. }
  1690. });
  1691. });
  1692. // 금액일때 할인금액 적용
  1693. if (dcWay == "G240_10") {
  1694. cartCpnDcSumAmt = dcVal;
  1695. }
  1696. // 2021.04.19 최대금액 체크
  1697. if (maxDcAmt > cartCpnDcSumAmt || maxDcAmt == 0) {
  1698. cartCpnDcSumAmt = cartCpnDcSumAmt;
  1699. } else {
  1700. cartCpnDcSumAmt = maxDcAmt;
  1701. }
  1702. obj.find("input[name=rdi-cart-coupon]").prop("checked", true);
  1703. obj.parent().find("input[name=cpnDcAmt]").val(cartCpnDcSumAmt);
  1704. obj.parent().find("input[name=custCpnSq]").val(obj.attr("value"));
  1705. }
  1706. var cpnDcSumAmt = 0;
  1707. var cpnApplyCnt = 0;
  1708. var goodsCartCpnSumAmt = 0;
  1709. var cpnType = "";
  1710. $("#couponModifyPop input[name='cpnDcAmt']").each(function(index){
  1711. cpnType = $(this).parent().find("input[name=cpnType]").val();
  1712. // 상품, 장바구니쿠폰 할인 금액만 합계 적용
  1713. if (cpnType == "goodsCpn" || cpnType == "cartCpn") {
  1714. goodsCartCpnSumAmt = goodsCartCpnSumAmt + parseInt($(this).val());
  1715. }
  1716. });
  1717. // 상품, 장바구니쿠폰 할인 금액만 합계 적용
  1718. $("#couponModifyPop .modal-footer .goodsCartCpnSumAmt").text(getZeroMinusDelAmt(goodsCartCpnSumAmt));
  1719. }
  1720. // 1.10.6 쿠폰중복체크 후 적용가능
  1721. var custCpnApply = function(obj, idx, cpnType) {
  1722. // 상품쿠폰적용
  1723. if (cpnType == "goodsCpn") {
  1724. var itemHtml = obj.find(".dlvr_coupon").html();
  1725. $("#couponModifyPop .goodsCpn .select .item_coupon").eq(idx).html(itemHtml);
  1726. $("#couponModifyPop .goodsCpn input[name='cpnDcAmt']").eq(idx).val(obj.attr("data"));
  1727. $("#couponModifyPop .goodsCpn input[name='custCpnSq']").eq(idx).val(obj.attr("value"));
  1728. var cpnCartSq = $("#couponModifyPop .goodsCpn input[name='cpnCartSq']").eq(idx).val();
  1729. // 장바구니시퀀스 체크
  1730. $("#orderAmtForm .cartSq").each(function(){
  1731. if (cpnCartSq == $(this).text()) {
  1732. $(this).parent().find(".goodsCpnSq").text(obj.attr("value")); // 상품쿠폰시퀀스
  1733. $(this).parent().find(".goodsCpnDcAmt").text(obj.attr("data")); // 상품쿠폰할인금액
  1734. }
  1735. });
  1736. // selected 클래스 처리
  1737. $("#couponModifyPop .couponSelectPop").eq(idx).find("ul li").removeClass("selected");
  1738. obj.addClass("selected");
  1739. // 상품쿠폰 선택불가 처리
  1740. custCpnSqLiDisabled();
  1741. }
  1742. // 장바구니쿠폰적용
  1743. else if (cpnType == "cartCpn") {
  1744. var dcWay = obj.find("input[name='dcWay']").val();
  1745. var dcVal = obj.find("input[name='dcVal']").val();
  1746. var maxDcAmt = obj.find("input[name='maxDcAmt']").val();
  1747. var buyLimitAmt = obj.find("input[name='buyLimitAmt']").val();
  1748. var cartCpnDcSumAmt = 0;
  1749. var tempSumAmt = 0;
  1750. var cartSqLen = $("#orderAmtForm .cartSq").length;
  1751. var leftAmt = 0;
  1752. var index = 1;
  1753. // 2021.04.19 장바구니시퀀스 값 초기화
  1754. $("#orderAmtForm .cartSq").each(function(){
  1755. $(this).parent().find(".cartCpnSq").text(0);
  1756. $(this).parent().find(".cartCpnDcAmt").text(0);
  1757. });
  1758. // 장바구니쿠폰 해당 장바구니상품들 할인가 적용
  1759. obj.find("input[name='cartCpnCartSq']").each(function(){
  1760. var cartCpnCartSq = $(this).val();
  1761. var cartCpnDcAmt = 0;
  1762. // 장바구니시퀀스 체크
  1763. $("#orderAmtForm .cartSq").each(function(){
  1764. if (cartCpnCartSq == $(this).text()) {
  1765. var orgCurrPrice = parseInt($(this).parent().find(".orgCurrPrice").text());
  1766. var cpn1DcAmt = parseInt($(this).parent().find(".cpn1DcAmt").text());
  1767. var goodsQty = parseInt($(this).parent().find(".goodsQty").text());
  1768. var tmtb1DcAmt = parseInt($(this).parent().find(".tmtb1DcAmt").text());
  1769. var tmtb2DcAmt = parseInt($(this).parent().find(".tmtb2DcAmt").text());
  1770. var goodsCpnDcAmt = parseInt($(this).parent().find(".goodsCpnDcAmt").text());
  1771. var tempAmt = ((orgCurrPrice - cpn1DcAmt) * goodsQty) - tmtb1DcAmt - tmtb2DcAmt - goodsCpnDcAmt;
  1772. tempSumAmt = tempSumAmt + tempAmt;
  1773. // 할인율일때 할인금액
  1774. if (dcWay == "G240_11") {
  1775. cartCpnDcAmt = parseInt((tempAmt * dcVal) / 100);
  1776. cartCpnDcSumAmt = cartCpnDcSumAmt + cartCpnDcAmt;
  1777. $(this).parent().find(".cartCpnSq").text(obj.attr("value"));
  1778. $(this).parent().find(".cartCpnDcAmt").text(cartCpnDcAmt);
  1779. }
  1780. }
  1781. });
  1782. });
  1783. // 장바구니쿠폰 결제가능수단목록조회
  1784. if (obj.find("input[name='payTypeArr']").length > 0) {
  1785. $("#orderForm input[name=rdi-paynormal]").attr("disabled", true);
  1786. $("#orderForm input[name=rdi-paynormal]").attr("checked", false);
  1787. obj.find("input[name='payTypeArr']").each(function(i){
  1788. var payType = $(this).val();
  1789. $('#orderForm .'+payType).attr("disabled", false);
  1790. });
  1791. // 선택안함
  1792. $("#orderForm .payTypeNm").text("선택없음");
  1793. // 2021.06.18 장바구니쿠폰 PG 제어가 있으면 초기화하고 결제타입 펼침
  1794. paymentInfoDispYn("Y");
  1795. } else {
  1796. $("#orderForm input[name=rdi-paynormal]").attr("disabled", false);
  1797. }
  1798. // 2021.04.19 최대금액 체크
  1799. if (maxDcAmt > cartCpnDcSumAmt || maxDcAmt == 0) {
  1800. cartCpnDcSumAmt = cartCpnDcSumAmt;
  1801. } else {
  1802. // 최대값 적용 일때는 금액할인 방식을 적용
  1803. cartCpnDcSumAmt = maxDcAmt;
  1804. dcVal = cartCpnDcSumAmt;
  1805. dcWay = "G240_10";
  1806. }
  1807. // 금액일때 할인금액 적용
  1808. if (dcWay == "G240_10") {
  1809. cartCpnDcSumAmt = dcVal;
  1810. leftAmt = dcVal;
  1811. index = 1;
  1812. // 장바구니쿠폰 해당 장바구니상품들 할인가 적용
  1813. obj.find("input[name='cartCpnCartSq']").each(function(){
  1814. var cartCpnCartSq = $(this).val();
  1815. var cartCpnDcAmt = 0;
  1816. // 장바구니시퀀스 체크
  1817. $("#orderAmtForm .cartSq").each(function(){
  1818. if (cartCpnCartSq == $(this).text()) {
  1819. var orgCurrPrice = parseInt($(this).parent().find(".orgCurrPrice").text());
  1820. var cpn1DcAmt = parseInt($(this).parent().find(".cpn1DcAmt").text());
  1821. var goodsQty = parseInt($(this).parent().find(".goodsQty").text());
  1822. var tmtb1DcAmt = parseInt($(this).parent().find(".tmtb1DcAmt").text());
  1823. var tmtb2DcAmt = parseInt($(this).parent().find(".tmtb2DcAmt").text());
  1824. var goodsCpnDcAmt = parseInt($(this).parent().find(".goodsCpnDcAmt").text());
  1825. var tempAmt = ((orgCurrPrice - cpn1DcAmt) * goodsQty) - tmtb1DcAmt - tmtb2DcAmt - goodsCpnDcAmt;
  1826. var tempDiv = parseInt((tempAmt / tempSumAmt) * 100);
  1827. var cartCpnDcAmt = 0;
  1828. if (index == cartSqLen) {
  1829. cartCpnDcAmt = leftAmt;
  1830. } else {
  1831. cartCpnDcAmt = parseInt((cartCpnDcSumAmt * tempDiv) / 100);
  1832. leftAmt = leftAmt - cartCpnDcAmt;
  1833. }
  1834. $(this).parent().find(".cartCpnSq").text(obj.attr("value"));
  1835. $(this).parent().find(".cartCpnDcAmt").text(cartCpnDcAmt);
  1836. index++;
  1837. }
  1838. });
  1839. });
  1840. }
  1841. obj.find("input[name=rdi-cart-coupon]").attr("checked", true);
  1842. obj.find("input[name=rdi-cart-coupon]").trigger("click");
  1843. obj.parent().find("input[name=cpnDcAmt]").val(cartCpnDcSumAmt);
  1844. obj.parent().find("input[name=custCpnSq]").val(obj.attr("value"));
  1845. }
  1846. // 배송비쿠폰적용
  1847. else if (cpnType == "delvCpn") {
  1848. // 적용안함 적용
  1849. var itemHtml = obj.find(".dlvr_coupon").html();
  1850. $("#orderForm .dlvr_fee_box .dlvr_coupon").html(itemHtml);
  1851. obj.parent().find("input[name='cpnDcAmt']").val(obj.attr("data"));
  1852. obj.parent().find("input[name='custCpnSq']").val(obj.attr("value"));
  1853. obj.parent().find("input[name='delvFeeCd']").val(obj.attr("delvfeecd"));
  1854. var delvFeeCd = obj.attr("delvfeecd");
  1855. // 배송비쿠폰 테이블 적용
  1856. $("#orderAmtForm .delvFeeCd").each(function(){
  1857. // 배송비쿠폰적용
  1858. if ($(this).text() == delvFeeCd) {
  1859. $(this).parent().find(".delvCpnSq").text(obj.attr("value"));
  1860. $(this).parent().find(".delvCpnDcAmt").text(obj.attr("data"));
  1861. }
  1862. // 배송비쿠폰적용안함
  1863. else if (delvFeeCd == 0) {
  1864. $(this).parent().find(".delvCpnSq").text(obj.attr("value"));
  1865. $(this).parent().find(".delvCpnDcAmt").text(obj.attr("data"));
  1866. }
  1867. });
  1868. // 배송비팝업닫기
  1869. $('#couponSelectPop02 .popup_close').trigger("click");
  1870. }
  1871. // 포인트기능 리렛
  1872. pntDcAmtReset();
  1873. }
  1874. // 1.11.1 상품쿠폰 선택불가 처리
  1875. var custCpnSqLiDisabled = function() {
  1876. // 상품쿠폰 선택불가 처리
  1877. $("#couponModifyPop .couponSelectPop ul li").each(function(){
  1878. var custCpnSq = $(this).attr("value");
  1879. var liObj = $(this);
  1880. liObj.attr("aria-disabled", false);
  1881. // 선택된 li 제외 (2021.04.08 수정)
  1882. if ($(this).hasClass("selected") == false) {
  1883. // 적용안함 제외
  1884. if (custCpnSq > 0) {
  1885. // 선택된 custCpnSq li와 같으면 선택불가처리
  1886. $("#couponModifyPop .goodsCpn input[name=custCpnSq]").each(function(){
  1887. var inputCustCpSq = $(this).val();
  1888. if (custCpnSq == inputCustCpSq) {
  1889. // 선택불가처리
  1890. liObj.attr("aria-disabled", true);
  1891. }
  1892. });
  1893. }
  1894. }
  1895. });
  1896. }
  1897. // 1.12 쿠폰중복체크 후 적용불가
  1898. var custCpnNotApply = function(obj, idx) {
  1899. /*
  1900. // 이전에 등록된 쿠폰시퀀스
  1901. var custCpnSq = obj.parent().find("input[name='custCpnSq']").val();
  1902. // 이전에 등록된 쿠폰시퀀스 비교후 데이타 원복
  1903. obj.parent().find("li").each(function(){
  1904. if ($(this).attr("value") == custCpnSq) {
  1905. var itemHtml = $(this).find(".item_coupon").html();
  1906. obj.parent().parent().find(".select .item_coupon").html(itemHtml);
  1907. }
  1908. });
  1909. // 포인트기능 리렛
  1910. pntDcAmtReset();
  1911. */
  1912. }
  1913. // 1.14 선포인트리셋기능 (사용안함)
  1914. var prePntDcAmtReset = function() {
  1915. // 2021.04.29 수정
  1916. var rmPrePntAmt = parseInt($("#orderForm input[name='rmPrePntAmt']").val());
  1917. if (rmPrePntAmt > 0) {
  1918. rmPrePntAmt = parseInt($("#orderForm input[name='rmPrePntAmt']").val());
  1919. $("#orderForm input[name='prePntDcAmt']").val(rmPrePntAmt);
  1920. } else {
  1921. rmPrePntAmt = 0;
  1922. }
  1923. // 선포인트사용여부 체크 후 적용
  1924. $("#orderForm input[name='rdi-beforpoint']").each(function(){
  1925. // 선포인트 초기 설정 사용함
  1926. if ($(this).val() == "Y") {
  1927. $(this).attr("checked", true);
  1928. }
  1929. // 버튼기능 구현
  1930. $(this).on("click", function(){
  1931. var rmPrePntAmt = parseInt($("#orderForm input[name='rmPrePntAmt']").val());
  1932. // 선포인트적용
  1933. if ($(this).val() == "Y") {
  1934. $("#prePntDcAmt").text(getZeroMinusDelAmt(rmPrePntAmt)+"원");
  1935. } else {
  1936. $("#prePntDcAmt").text("0원");
  1937. }
  1938. // 쿠폰할인금액 SUM
  1939. custCpnSumAmtCal();
  1940. });
  1941. });
  1942. $("#prePntDcAmt").text(getZeroMinusDelAmt(rmPrePntAmt)+"원");
  1943. // 포인트기능 리렛
  1944. pntDcAmtReset();
  1945. }
  1946. // 1.15 포인트리셋기능
  1947. var pntDcAmtReset = function() {
  1948. $("#orderAmtForm .pntDcSumAmt").text("0");
  1949. $("#orderForm input[name='pntDcAmtStr']").val("");
  1950. $("#pntDcAmt").text("0");
  1951. // 상품권리셋기능
  1952. gfcdUseAmtReset();
  1953. }
  1954. // 1.16 상품권리셋기능
  1955. var gfcdUseAmtReset = function() {
  1956. $("#orderAmtForm .gfcdUseSumAmt").text("0");
  1957. $("#orderForm input[name='gfcdUseAmtStr']").val("");
  1958. $("#gfcdUseAmt").text("0");
  1959. // 금액전체계산
  1960. custCpnSumAmtCal();
  1961. }
  1962. // 1.17 쿠폰할인금액합계설정(금액전체계산)
  1963. var custCpnSumAmtCal = function() {
  1964. var cpnDcSumAmt = 0;
  1965. var cpnApplyCnt = 0;
  1966. var goodsCartCpnSumAmt = 0;
  1967. var cpnType = "";
  1968. // 상품쿠폰, 장바구니쿠폰 할인금액 합계
  1969. $("#couponModifyPop input[name='cpnDcAmt']").each(function(){
  1970. cpnType = $(this).parent().find("input[name=cpnType]").val();
  1971. cpnDcSumAmt = cpnDcSumAmt + parseInt($(this).val());
  1972. // 적용된 쿠폰 수량
  1973. if (parseInt($(this).val()) > 0) {
  1974. cpnApplyCnt++;
  1975. }
  1976. // 상품, 장바구니 쿠폰할인금액 저장
  1977. // 상품, 장바구니쿠폰 할인 금액만 합계 적용
  1978. if (cpnType == "goodsCpn" || cpnType == "cartCpn") {
  1979. goodsCartCpnSumAmt = goodsCartCpnSumAmt + parseInt($(this).val());
  1980. }
  1981. });
  1982. // 배송비쿠폰 할인금액 합계
  1983. $("#couponSelectPop02 input[name='cpnDcAmt']").each(function(){
  1984. cpnDcSumAmt = cpnDcSumAmt + parseInt($(this).val());
  1985. });
  1986. // 상품, 장바구니쿠폰 할인 금액만 합계 적용
  1987. $(".maxdisc_amount .goodsCartCpnDcAmt").text(getZeroMinusDelAmt(goodsCartCpnSumAmt)); // 쿠폰할인금액합계
  1988. $("#couponModifyPop .modal-footer .goodsCartCpnSumAmt").text(getZeroMinusDelAmt(goodsCartCpnSumAmt));
  1989. // 전체쿠폰 할인 금액 합계 적용
  1990. $(".maxdisc_amount .cpnDcAmt").text(getZeroMinusDelAmt(cpnDcSumAmt)); // 쿠폰할인금액합계
  1991. $("#couponDcSumAmt").text(getZeroMinusDelAmt(goodsCartCpnSumAmt)); // 쿠폰할인금액합계
  1992. $("#orderAmtForm .cpnDcSumAmt").text(cpnDcSumAmt);
  1993. var delvSumAmt = orgSumDelvFee;
  1994. // 배송비할인적용
  1995. $("input[name='cpnType']").each(function(){
  1996. if ($(this).val() == "delvCpn") {
  1997. delvSumAmt = parseInt(orgSumDelvFee) - parseInt($(this).parent().find("input[name='cpnDcAmt']").val());
  1998. }
  1999. });
  2000. // 최종배송비
  2001. $("#delvSumAmt").text(delvSumAmt.addComma());
  2002. $("#orderAmtForm .delvSumAmt").text(delvSumAmt);
  2003. $("#orderForm .delvSumAmt").text(delvSumAmt.addComma());
  2004. // 2021.03.06 주문상세 테이블 적용
  2005. // 포인트금액 상품상세에 포인트금액 분배 작업
  2006. var prePntDcAmtYn = $("#orderForm input[name='rdi-beforpoint']:checked").val();
  2007. var leftPntAmt = parseInt($("#orderAmtForm .pntDcSumAmt").text());
  2008. var leftGfcdAmt = parseInt($("#orderAmtForm .gfcdUseSumAmt").text());
  2009. var cartSqLenght = $("#orderAmtForm .cartSq").length;
  2010. var index = 1;
  2011. var orgGoodsSumAmt = 0;
  2012. var cpn1DcSumAmt = 0;
  2013. var ordSumAmt = 0;
  2014. var tmtb1DcSumAmt = 0;
  2015. var tmtb2DcSumAmt = 0;
  2016. var tmtbDcSumAmt = 0;
  2017. var goodsCpnDcSumAmt = 0;
  2018. var cartCpnDcSumAmt = 0;
  2019. var delvCpnDcSumAmt = 0;
  2020. var cpnDcSumAmt = 0;
  2021. var prePntDcSumAmt = 0;
  2022. var pntDcSumAmt = parseInt($("#orderAmtForm .pntDcSumAmt").text());
  2023. var gfcdUseSumAmt = parseInt($("#orderAmtForm .gfcdUseSumAmt").text());
  2024. var realOrdSumAmt = 0;
  2025. var savePntSumAmt = 0;
  2026. var totDcSumAmt = 0;
  2027. $("#orderAmtForm .cartSq").each(function(){
  2028. var orgCurrPrice = parseInt($(this).parent().find(".orgCurrPrice").text());
  2029. var cpn1DcAmt = parseInt($(this).parent().find(".cpn1DcAmt").text());
  2030. var optAddPrice = parseInt($(this).parent().find(".optAddPrice").text());
  2031. var goodsQty = parseInt($(this).parent().find(".goodsQty").text());
  2032. var tmtb1DcAmt = parseInt($(this).parent().find(".tmtb1DcAmt").text());
  2033. var tmtb2DcAmt = parseInt($(this).parent().find(".tmtb2DcAmt").text());
  2034. var goodsCpnDcAmt = parseInt($(this).parent().find(".goodsCpnDcAmt").text());
  2035. var cartCpnDcAmt = parseInt($(this).parent().find(".cartCpnDcAmt").text());
  2036. var prePntDcAmt1 = parseInt($(this).parent().find(".prePntDcAmt1").text());
  2037. var dcSumAmt = 0;
  2038. // 주문금액 = ((판매가 - 즉시할인가) + 옵션추가금액) * 장바구니수량
  2039. orgGoodsSumAmt = orgGoodsSumAmt + (orgCurrPrice + optAddPrice) * goodsQty;
  2040. //orgGoodsSumAmt = orgGoodsSumAmt + orgCurrPrice;
  2041. cpn1DcSumAmt = cpn1DcSumAmt + (cpn1DcAmt * goodsQty);
  2042. tmtb1DcSumAmt = tmtb1DcSumAmt + tmtb1DcAmt;
  2043. tmtb2DcSumAmt = tmtb2DcSumAmt + tmtb2DcAmt;
  2044. tmtbDcSumAmt = tmtbDcSumAmt + (tmtb1DcAmt + tmtb2DcAmt);
  2045. goodsCpnDcSumAmt = goodsCpnDcSumAmt + goodsCpnDcAmt;
  2046. cartCpnDcSumAmt = cartCpnDcSumAmt + cartCpnDcAmt;
  2047. cpnDcSumAmt = cpnDcSumAmt + (goodsCpnDcAmt + cartCpnDcAmt);
  2048. prePntDcSumAmt = prePntDcSumAmt + prePntDcAmt1;
  2049. var ordAmt = ((orgCurrPrice - cpn1DcAmt) + optAddPrice) * goodsQty;
  2050. ordSumAmt = ordSumAmt + ordAmt;
  2051. // 선포인트사용여부
  2052. // 할인금액합계 = 다다익선수량금액 + 다다익선금액금액 + 상품쿠폰금액 + 장바구니금액 + 선포인트금액
  2053. if (prePntDcAmtYn == "Y") {
  2054. dcSumAmt = tmtb1DcAmt + tmtb2DcAmt + goodsCpnDcAmt + cartCpnDcAmt + prePntDcAmt1;
  2055. } else {
  2056. dcSumAmt = tmtb1DcAmt + tmtb2DcAmt + goodsCpnDcAmt + cartCpnDcAmt;
  2057. }
  2058. totDcSumAmt = totDcSumAmt + dcSumAmt;
  2059. // 주문금액설정
  2060. $(this).parent().find(".ordAmt").text(ordAmt);
  2061. $(this).parent().find(".dcSumAmt").text(dcSumAmt);
  2062. });
  2063. // 포인트, 상품권 금액 분배
  2064. $("#orderAmtForm .cartSq").each(function(){
  2065. var cartSq = $(this).text();
  2066. var pntPrate = parseInt($(this).parent().find(".pntPrate").text());
  2067. var pntMrate = parseInt($(this).parent().find(".pntMrate").text());
  2068. var ordAmt = parseInt($(this).parent().find(".ordAmt").text());
  2069. var dcSumAmt = parseInt($(this).parent().find(".dcSumAmt").text());
  2070. var prePntDcAmt1 = parseInt($(this).parent().find(".prePntDcAmt1").text());
  2071. var tempDiv = parseInt((ordAmt / ordSumAmt) * 100);
  2072. var pntDcAmt1 = 0;
  2073. var gfcdUseAmt1 = 0;
  2074. var savePntAmt1 = 0;
  2075. if (index == cartSqLenght) {
  2076. pntDcAmt1 = leftPntAmt;
  2077. gfcdUseAmt1 = leftGfcdAmt;
  2078. } else {
  2079. pntDcAmt1 = parseInt((pntDcSumAmt * tempDiv) / 100);
  2080. gfcdUseAmt1 = parseInt((gfcdUseSumAmt * tempDiv) / 100);
  2081. leftPntAmt = leftPntAmt - pntDcAmt1;
  2082. leftGfcdAmt = leftGfcdAmt - gfcdUseAmt1;
  2083. }
  2084. // 2021.07.08 할인금액 포인트사용, 상품권사용금액 적용
  2085. totDcSumAmt = totDcSumAmt + pntDcAmt1 + gfcdUseAmt1;
  2086. var realOrdAmt1 = ordAmt - dcSumAmt - pntDcAmt1 - gfcdUseAmt1;
  2087. var realOrdAmt2 = ordAmt - dcSumAmt - pntDcAmt1;
  2088. realOrdSumAmt = realOrdSumAmt + realOrdAmt1;
  2089. // 2021.05.11 최종할인금액으로 적립포인트 적용
  2090. if (frontGb == 'P') {
  2091. savePntAmt1 = parseInt(realOrdAmt2 * (pntPrate/100));
  2092. } else {
  2093. savePntAmt1 = parseInt(realOrdAmt2 * (pntMrate/100));
  2094. }
  2095. // 2021.05.27 적립포인트 설정
  2096. $("#orderForm #orderListInfo .orderListSavePntDcAmt").each(function(){
  2097. var orderListCartSq = $(this).parent().find("input[name=cartSq]").val();
  2098. if (orderListCartSq == cartSq) {
  2099. $(this).text(savePntAmt1.addComma());
  2100. }
  2101. });
  2102. // 선포인트사용여부
  2103. if (prePntDcAmtYn == "Y") {
  2104. if (prePntDcAmt1 < 1) {
  2105. savePntSumAmt = savePntSumAmt + savePntAmt1;
  2106. }
  2107. } else {
  2108. savePntSumAmt = savePntSumAmt + savePntAmt1;
  2109. }
  2110. $(this).parent().find(".pntDcAmt1").text(pntDcAmt1);
  2111. $(this).parent().find(".gfcdUseAmt1").text(gfcdUseAmt1);
  2112. $(this).parent().find(".realOrdAmt1").text(realOrdAmt1);
  2113. $(this).parent().find(".savePntAmt1").text(savePntAmt1);
  2114. index++;
  2115. });
  2116. realOrdSumAmt = realOrdSumAmt + delvSumAmt;
  2117. $("#orderAmtForm .orgGoodsSumAmt").text(orgGoodsSumAmt);
  2118. $("#orderAmtForm .cpn1DcSumAmt").text(cpn1DcSumAmt);
  2119. $("#orderAmtForm .ordSumAmt").text(ordSumAmt);
  2120. $("#orderAmtForm .tmtb1DcSumAmt").text(tmtb1DcSumAmt);
  2121. $("#orderAmtForm .tmtb2DcSumAmt").text(tmtb2DcSumAmt);
  2122. $("#orderAmtForm .tmtbDcSumAmt").text(tmtbDcSumAmt);
  2123. $("#orderAmtForm .goodsCpnDcSumAmt").text(goodsCpnDcSumAmt);
  2124. $("#orderAmtForm .cartCpnDcSumAmt").text(cartCpnDcSumAmt);
  2125. $("#orderAmtForm .cpnDcSumAmt").text(cpnDcSumAmt);
  2126. $("#orderAmtForm .prePntDcSumAmt").text(prePntDcSumAmt);
  2127. $("#orderAmtForm .realOrdSumAmt").text(realOrdSumAmt);
  2128. $("#orderAmtForm .savePntSumAmt").text(savePntSumAmt);
  2129. $("#realOrdAmt").text(realOrdSumAmt.addComma()); // 총 결제 예정 금액
  2130. $("#orderForm .realOrdAmt").text(realOrdSumAmt.addComma()); // 총 결제 예정 금액
  2131. $("#orderForm .orgGoodsSumAmt").text(orgGoodsSumAmt.addComma());
  2132. $("#orderForm #btn_payment span").text(realOrdSumAmt.addComma()); // 총 결제 예정 금액
  2133. $("#orderForm .dcSumAmt").text(getZeroMinusDelAmt(totDcSumAmt)); // 할인금액합계
  2134. var tempSavePnt = savePntSumAmt - prePntDcAmt;
  2135. // 사은품사용 후 보유포인트
  2136. var rmPntAmt = parseInt($("#orderForm input[name='rmPntAmt']").val());
  2137. var freegiftUsePnt = parseInt($("#orderAmtForm .freegiftUsePnt").text());
  2138. rmPntAmt = rmPntAmt - freegiftUsePnt;
  2139. $("#orderForm .rmPntAmt").text(rmPntAmt.addComma());
  2140. // 2021.04.29 적립포인트금액 선포인트 사용시 사용금액제외
  2141. $("#orderForm #savePntSumAmt").text(savePntSumAmt.addComma() + " P");
  2142. // 사은품정보 설정
  2143. var freegiftValArr = [];
  2144. var freegiftUsePointArr = [];
  2145. $(".gift_box").each(function(){
  2146. $(this).find(".freegiftRdo").each(function(){
  2147. // 사은품필수
  2148. if ($(this).attr("allYn") == "Y" ) {
  2149. freegiftValArr.push($(this).val());
  2150. freegiftUsePointArr.push($(this).attr("usepoint"));
  2151. } else {
  2152. // 라디오버튼 선택 사은품 체크
  2153. if ($(this).is(":checked")) {
  2154. // 수령거부가 아닐때 체크
  2155. if ($(this).val() != "noSel") {
  2156. freegiftValArr.push($(this).val());
  2157. freegiftUsePointArr.push($(this).attr("usepoint"));
  2158. }
  2159. }
  2160. }
  2161. });
  2162. });
  2163. $("#orderAmtForm .freegiftValArr").text(freegiftValArr); // 사은품시퀀스배열
  2164. $("#orderAmtForm .freegiftUsePointArr").text(freegiftUsePointArr); // 사은품사용포인트배열
  2165. };
  2166. // 1.18 배송지정보 설정
  2167. var delvAddrSet = function(delvObj) {
  2168. var rtnStr = "";
  2169. rtnStr += "| recipNm ::: " + delvObj.recipNm;
  2170. rtnStr += "| recipPhnno ::: " + delvObj.recipPhnno;
  2171. rtnStr += "| recipZipcode ::: " + delvObj.recipZipcode;
  2172. rtnStr += "| recipBaseAddr ::: " + delvObj.recipBaseAddr;
  2173. rtnStr += "| recipDtlAddr ::: " + delvObj.recipDtlAddr;
  2174. rtnStr += "| delvMemo ::: " + delvObj.delvMemo;
  2175. // 배송지정보로드실행
  2176. deliveryAddrInfoSet(delvObj, false);
  2177. }
  2178. // 1.19 배송메모설정
  2179. var delvMemoSet = function(delvMemoObj) {
  2180. var rtnStr = "";
  2181. rtnStr += "| delvMemo ::: " + delvMemoObj.delvMemo;
  2182. $("#orderForm input[name=delvMemo]").val(delvMemoObj.delvMemo); // input 값에 설정
  2183. $("#delvMemo").text(delvMemoObj.delvMemo); // 메모 text 설정
  2184. $("#orderAmtForm .delvMemo").text(delvMemoObj.delvMemo); // 메모 text 설정
  2185. }
  2186. </script>
  2187. <script th:inline="javascript">
  2188. $(document).ready( function() {
  2189. //해외배송 입력
  2190. $(document).on('change','.odPayment .area_overseas #rdi-overs1',function(e){
  2191. $('.info_box.overs2').hide();
  2192. $('.info_box.overs1').show();
  2193. return false;
  2194. }).on('change','.odPayment .area_overseas #rdi-overs2',function(e){
  2195. $('.info_box.overs1').hide();
  2196. $('.info_box.overs2').show();
  2197. return false;
  2198. });
  2199. //할인쿠폰 확인
  2200. $(document).on('click','.odPayment .area_seldiscount .btn_coupon_toggle',function(e){
  2201. $('.coupon_list').toggle();
  2202. $(this).toggleClass('on');
  2203. return false;
  2204. });
  2205. //결제수단 선택
  2206. /*
  2207. $(document).on('change','.odPayment .area_paymethod .paymethod_radio input',function(e){
  2208. $('.radio_blk').removeClass('on');
  2209. $(this).parents('.radio_blk').addClass('on');
  2210. $(this).parents('.radio_blk').find('.paymethod_box').show();
  2211. $(this).parents('.radio_blk').siblings('div').find('.paymethod_box').hide();
  2212. var paymethodlabel = $(this).prop('labels');
  2213. $(this).parents('li').find('.fold_head .data span').text($(paymethodlabel).text());
  2214. //간편결제 카드추가 슬라이드
  2215. var swiper = new Swiper('.paymethod_box .card_quickpay .list_card.swiper-container', {
  2216. slidesPerView: 'auto',
  2217. spaceBetween: 160,
  2218. centeredSlides: true,
  2219. navigation: {
  2220. nextEl: '.list_card .swiper-button-next',
  2221. prevEl: '.list_card .swiper-button-prev',
  2222. },
  2223. });
  2224. return false;
  2225. });
  2226. */
  2227. //STYLE24 간편결제 배너닫기
  2228. $(document).on('click','.odPayment .area_paymethod .quickpay_bnr .btn_close_bnr',function(e){
  2229. $('.quickpay_bnr').hide();
  2230. });
  2231. //결제수단 선택 > 즐겨찾기 추가시
  2232. $(document).on('click','.odPayment .area_paymethod .paymethod_box .card .etc .btn_favorcard',function(e){
  2233. $(this).toggleClass('active');
  2234. return false;
  2235. });
  2236. //결제수단 > 일반결제> 실시간계좌이체 선택시
  2237. /*
  2238. $(document).on('change','.odPayment input:radio[name=rdi-paynormal]',function(e){
  2239. var paynormalValue = $(this).attr('id');
  2240. if (paynormalValue == 'rdi-paynormal2') {
  2241. $('.area_paymethod .agree_insurance').show();
  2242. } else {
  2243. $('.area_paymethod .agree_insurance').hide();
  2244. }
  2245. return false;
  2246. });
  2247. */
  2248. //구매조건 확인 및 결제대행 서비스 약관 동의 클릭시
  2249. $(document).on('click','.area_paymentinfo .payinfo_blk_wrap a',function(e){
  2250. e.preventDefault();
  2251. $(this).parent('.payinfo_blk_wrap').toggleClass('on');
  2252. $(this).siblings('.payinfo_blk_parent').toggle();
  2253. var privacyToggle = $(this).find('span');
  2254. $(privacyToggle).text($(privacyToggle).text() == '보기' ? '닫기' : '보기');
  2255. return false;
  2256. });
  2257. //개인정보동의 열고닫기
  2258. $(document).on('click','.area_paymentinfo .payinfo_blk a',function(e){
  2259. e.preventDefault();
  2260. $(this).parents('.payinfo_blk').toggleClass('on');
  2261. var privacyToggle = $(this).find('span');
  2262. $(privacyToggle).text($(privacyToggle).text() == '보기' ? '닫기' : '보기');
  2263. return false;
  2264. });
  2265. //배송지수정 팝업열기
  2266. $(document).on('click','#btn_addrModify_pop',function(e){
  2267. $("#adrsModifyPop").modal("show");
  2268. return false;
  2269. });
  2270. //배송요청사항 팝업열기
  2271. $(document).on('click','#btn_rqstModify_pop',function(e){
  2272. $("#rqstModifyPop").modal("show");
  2273. return false;
  2274. });
  2275. //사은품지급안내 팝업열기
  2276. $(document).on('click','#btn_infoGift_pop',function(e){
  2277. $("#infoGiftPop").modal("show");
  2278. return false;
  2279. });
  2280. //간편결제등록 > STEP1.이용약관 팝업열기
  2281. $(document).on('click','.btn_addcard',function(e){
  2282. $("#qPayAgree_pop").modal("show");
  2283. return false;
  2284. });
  2285. //간편결제등록 > STEP1.이용약관 체크
  2286. $(document).on('click','.area_QpayCk .agr_select button',function(e){
  2287. $(this).parents('.area_QpayCk').find('.info_agrQpay').toggle();
  2288. var payagrToggle = $(this).find('span');
  2289. $(payagrToggle).text($(payagrToggle).text() == '약관열기' ? '약관닫기' : '약관열기');
  2290. return false;
  2291. });
  2292. //간편결제등록 > STEP1.이용약관 체크박스 전체선택
  2293. $(document).on('click','#chk-Qpay-agrAll',function(e){
  2294. $(this).parents(".qPayAgree_pop").find('.agree_Qpay input').prop("checked", $(this).is(":checked"));
  2295. });
  2296. //간편결제등록 > STEP1.이용약관 체크박스 개별선택
  2297. $(document).on("click", ".agree_Qpay input",function(e){
  2298. var is_checked = true;
  2299. $(".agree_Qpay input").each(function(){
  2300. is_checked = is_checked && $(this).is(":checked");
  2301. });
  2302. $("#chk-Qpay-agrAll").prop("checked", is_checked);
  2303. });
  2304. //간편결제등록 > 본인인증 팝업열기
  2305. $(document).on('click','#btn_qPayidConfirm_pop',function(e){
  2306. $("#qPayidConfirm_pop").modal("show");
  2307. return false;
  2308. });
  2309. });
  2310. // PG 카카오페이 결제준비 처리
  2311. var fnKakaoPaymentReady = function() {
  2312. let nextRedirectUrl = $('#order_info input[name=nextRedirectMobileUrl]').val();
  2313. window.location.href = nextRedirectUrl;
  2314. }
  2315. // PG 카카오페이 결제 승인 요청
  2316. var fnKakaoPaymentRequest = function(pgToken) {
  2317. // Token 값 설정
  2318. $('#order_info input[name=pgToken]').val(pgToken);
  2319. // Form Submit
  2320. document.order_info.submit();
  2321. return true;
  2322. }
  2323. // PG 네이버페이 결제준비 처리
  2324. var fnNaverPaymentReady = function() {
  2325. let naverPayUrl = 'https://' + [[${@environment.getProperty('naverPay.payUrl.mob')}]];
  2326. let reserveId = $('#order_info input[name=reserveId]').val();
  2327. let url = naverPayUrl + '/payments/' + reserveId;
  2328. window.location.href = url;
  2329. }
  2330. // PG 네이버페이 결제 승인 요청
  2331. var fnNaverPaymentRequest = function(paymentId) {
  2332. // TID 설정
  2333. $('#order_info input[name=pgTid]').val(paymentId);
  2334. // Form Submit
  2335. document.order_info.submit();
  2336. return true;
  2337. }
  2338. // 0원이하이면 '-' 처리 삭제 함수
  2339. var getZeroMinusDelAmt = function(tempAmt) {
  2340. var rtnAmtStr = "";
  2341. if (tempAmt > 0) {
  2342. rtnAmtStr = "-" + tempAmt.addComma();
  2343. } else {
  2344. rtnAmtStr = tempAmt.addComma();
  2345. }
  2346. return rtnAmtStr;
  2347. }
  2348. // START ::: 2021.04.09 숫자입려 천단위 찍기
  2349. var inputNumberFormat = function(obj) {
  2350. obj.value = comma(uncomma(obj.value));
  2351. }
  2352. var comma = function(str) {
  2353. str = String(str);
  2354. return str.replace(/(\d)(?=(?:\d{3})+(?!\d))/g, '$1,');
  2355. }
  2356. var uncomma = function(str) {
  2357. str = String(str);
  2358. return str.replace(/[^\d]+/g, '');
  2359. }
  2360. // 2021.04.09 숫자입려 천단위 찍기 ::: END
  2361. </script>
  2362. </th:block>
  2363. </body>
  2364. </html>