OrderFormMob.html 94 KB

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