OrderFormMob.html 95 KB

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