checkout.blade.php 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  1. @extends('views.layouts.master')
  2. <link rel="stylesheet" href="{{ csset('/themes/pro/modunawa/resources/css/checkout.css') }}">
  3. @section('content')
  4. <!--=====================================
  5. BANNER PART START
  6. =======================================-->
  7. <section class="inner-section single-banner">
  8. <div class="container">
  9. <h2>결제하기</h2>
  10. <ol class="breadcrumb">
  11. <li class="breadcrumb-item"><a href="/">Home</a></li>
  12. <!--<li class="breadcrumb-item"><a href="shop-4column.html">shop grid</a></li>-->
  13. <li class="breadcrumb-item active" aria-current="page">결제하기</li>
  14. </ol>
  15. </div>
  16. </section>
  17. <!--=====================================
  18. BANNER PART END
  19. =======================================-->
  20. <!--=====================================
  21. CHECKOUT PART START
  22. =======================================-->
  23. <section class="inner-section checkout-part">
  24. <form class="container" id="checkout-form" action="{{ route('checkout.store') }}" method="POST">
  25. <input type="hidden" name="ship_fee" value="{{ $checkoutCharge['charge_amt'] }}">
  26. @csrf
  27. <div class="row">
  28. <!--
  29. <div class="col-lg-12">
  30. <div class="alert-info">
  31. <p>Returning customer? <a href="login.html">Click here to login</a></p>
  32. </div>
  33. </div>
  34. -->
  35. <div class="col-lg-12 order">
  36. <div class="account-card">
  37. <div class="account-title">
  38. <h4>Your order</h4>
  39. </div>
  40. <div class="account-content">
  41. <div class="table-scroll table-responsive">
  42. <table class="table-list" id="cart-table">
  43. <thead>
  44. <tr>
  45. <th scope="col">
  46. <input type="checkbox" class="all-check" tabindex="-1" onchange="change_cart_all_checkbox(this)"
  47. onclick="checkbox_all_checked(this, 'bd-cud-check')" @if ($allCartChecked) checked @endif>
  48. </th>
  49. <th scope="col">Serial</th>
  50. <th scope="col">Product</th>
  51. <th scope="col">Name</th>
  52. <th scope="col">Price</th>
  53. <th scope="col">brand</th>
  54. <th scope="col">quantity</th>
  55. <th scope="col">action</th>
  56. </tr>
  57. </thead>
  58. <tbody>
  59. @forelse ($listType1Book['Book'][2]['Page'] ?? [] as $index => $cart)
  60. <tr>
  61. <input type="hidden" class="cart_id" value="{{ $cart['Id'] }}">
  62. <td>
  63. <input type="checkbox" class="cart-check" name="bd-cud-check" value="1" tabindex="-1" @if($cart['C9'] === '1') checked @endif
  64. onchange="change_cart_checkbox(this)">
  65. </td>
  66. <td class="table-serial"><h6>{{ $cart['C3'] }}</h6></td>
  67. <td class="table-image"><img src="{{ env('MEDIA_URL') . $cart['C2'] }}" alt="product"></td>
  68. <td class="table-name"><a href="{{ route('item-details', $cart['C10'] ?: $cart['C1']) }}"><h6>{{ $cart['C4'] }}</h6></a></td>
  69. <td class="table-price"><h6>{{ number_format($cart['C6']) }} 원<!--<small>/kilo</small>--></h6></td>
  70. <td class="table-brand"><h6>{{ $cart['C5'] }}</h6></td>
  71. <td class="table-quantity">
  72. <h6>
  73. <div class="product-action">
  74. <button type="button" class="action-minus" title="Quantity Minus"><i class="icofont-minus"></i></button>
  75. <input class="action-input" title="Quantity Number" onchange="cart_qty_update(this, {{ $cart['Id'] }})"
  76. type="text" min="1" value="{{ (int)$cart['C7'] }}">
  77. <button type="button" class="action-plus" title="Quantity Plus"><i class="icofont-plus"></i></button>
  78. </div>
  79. </h6>
  80. </td>
  81. <td class="table-action">
  82. {{-- <a class="view" href="#" title="Quick View" data-bs-toggle="modal" data-bs-target="#product-view"><i class="fas fa-eye"></i></a>--}}
  83. <button type="button" class="trash" onclick="cart_delete({{ $cart['Id'] }})" title="Remove Wishlist">
  84. <i class="icofont-trash"></i>
  85. </button>
  86. </td>
  87. </tr>
  88. @empty
  89. <tr>
  90. <td class="text-center" colspan="7">쇼핑카트가 비어있습니다</td>
  91. </tr>
  92. @endforelse
  93. </tbody>
  94. </table>
  95. </div>
  96. <div class="chekout-coupon">
  97. {{-- <button type="button" class="coupon-btn">쿠폰 코드가 있습니까?</button>--}}
  98. {{-- <form class="coupon-form">--}}
  99. {{-- <input type="text" placeholder="Enter your coupon code">--}}
  100. {{-- <button type="submit"><span>확인</span></button>--}}
  101. {{-- </form>--}}
  102. </div>
  103. <div class="checkout-charge">
  104. <ul>
  105. <li>
  106. <span>Sub total</span>
  107. <span>{{ number_format($checkoutCharge['sub_total']) }} 원</span>
  108. </li>
  109. <li>
  110. <span>배송료</span>
  111. <span>{{ number_format($checkoutCharge['charge_amt']) }} 원</span>
  112. </li>
  113. <li>
  114. <span>할인</span>
  115. <span>0 원</span>
  116. </li>
  117. <li>
  118. <span>Total<small>(VAT 포함)</small></span>
  119. <span>{{ number_format($checkoutCharge['total']) }} 원</span>
  120. </li>
  121. </ul>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. {{-- <div class="col-lg-12">--}}
  127. {{-- <div class="account-card">--}}
  128. {{-- <div class="account-title">--}}
  129. {{-- <h4>배송일정</h4>--}}
  130. {{-- </div>--}}
  131. {{-- <div class="account-content">--}}
  132. {{-- <div class="row">--}}
  133. {{-- <div class="col-md-6 col-lg-4 alert fade show">--}}
  134. {{-- <div class="profile-card schedule">--}}
  135. {{-- <h6>express</h6>--}}
  136. {{-- <p>90 min express delivery</p>--}}
  137. {{-- </div>--}}
  138. {{-- </div>--}}
  139. {{-- <div class="col-md-6 col-lg-4 alert fade show">--}}
  140. {{-- <div class="profile-card schedule">--}}
  141. {{-- <h6>8am-10pm</h6>--}}
  142. {{-- <p>8.00 AM - 10.00 PM</p>--}}
  143. {{-- </div>--}}
  144. {{-- </div>--}}
  145. {{-- <div class="col-md-6 col-lg-4 alert fade show">--}}
  146. {{-- <div class="profile-card schedule">--}}
  147. {{-- <h6>Next day</h6>--}}
  148. {{-- <p>Next day or Tomorrow</p>--}}
  149. {{-- </div>--}}
  150. {{-- </div>--}}
  151. {{-- </div>--}}
  152. {{-- </div>--}}
  153. {{-- </div>--}}
  154. {{-- </div>--}}
  155. <div class="col-lg-12">
  156. <div class="account-card">
  157. <div class="account-title">
  158. <h4>연락처</h4>
  159. <button id="contact-btn" type="button" class="medium-btn" data-attr="{{ route('contact.index', [ 'seq_no' => $listType1Book['Book'][0]['Page'] ? (int)$listType1Book['Book'][0]['Page'][count($listType1Book['Book'][0]['Page']) - 1]['C1'] + 1 : 0 ]) }}">
  160. 연락처 추가
  161. </button>
  162. </div>
  163. <div class="account-content">
  164. <div class="row" id="company-contact-bd-div">
  165. @forelse ($listType1Book['Book'][0]['Page'] ?? [] as $contact)
  166. <div class="col-md-6 col-lg-4 alert fade show">
  167. <div class="profile-card contact">
  168. <h6>(<span class="sort-txt">{{ DataConverter::execute($contact['C2'], "sort('company-contact-bd')") }}</span>) <span class="ship-contact-txt">{{ $contact['C3'] }}</span></h6>
  169. <p class="ship-mobile-txt">{{ $contact['C4'] }}</p>
  170. <ul>
  171. <li><button type="button" class="edit icofont-edit medium-btn" title="Edit This" data-attr="{{ route('contact.show', $contact['Id']) }}"></button></li>
  172. <li><button type="button" class="trash icofont-ui-delete destroy-btn save-prev-scroll-submits" title="Remove This" data-attr="{{ route('contact.destroy', $contact['Id']) }}"></button></li>
  173. </ul>
  174. </div>
  175. </div>
  176. @empty
  177. <div class="col">
  178. 비어있습니다
  179. </div>
  180. @endforelse
  181. </div>
  182. </div>
  183. </div>
  184. </div>
  185. <div class="col-lg-12">
  186. <div class="account-card">
  187. <div class="account-title">
  188. <h4>배송지</h4>
  189. <button type="button" id="address-btn" class="medium-btn" data-attr="{{ route('address.index', [ 'seq_no' => $listType1Book['Book'][1]['Page'] ? (int)$listType1Book['Book'][1]['Page'][count($listType1Book['Book'][1]['Page']) - 1]['C1'] + 1 : 0 ]) }}">주소 추가</button>
  190. </div>
  191. <div class="account-content">
  192. <div class="row" id="company-destina-bd-div">
  193. @forelse ($listType1Book['Book'][1]['Page'] ?? [] as $index => $address)
  194. <div class="col-md-6 col-lg-4 alert fade show">
  195. <div class="profile-card address">
  196. <h6 class="sort">{{ DataConverter::execute($address['C2'], "sort('company-destina-bd')") }}</h6>
  197. <p>(<span class="ship-zip-code-txt">{{ $address['C3'] }}</span>) <span class="ship-addr1-txt">{{ $address['C4'] }}</span> <span class="ship-addr2-txt">{{ $address['C5'] }}</span></p>
  198. <ul class="user-action">
  199. <li><button type="button" class="edit icofont-edit medium-btn" title="Edit This" data-attr="{{ route('address.show', $address['Id']) }}"></button></li>
  200. <li><button type="button" class="trash icofont-ui-delete destroy-btn save-prev-scroll-submits" title="Remove This" data-attr="{{ route('address.destroy', $address['Id']) }}"></button></li>
  201. </ul>
  202. </div>
  203. </div>
  204. @empty
  205. <div class="col">
  206. 비어있습니다
  207. </div>
  208. @endforelse
  209. </div>
  210. </div>
  211. </div>
  212. </div>
  213. <div class="col-lg-12">
  214. <div class="account-card page-pc">
  215. <div class="account-title">
  216. <h4>결제방법</h4>
  217. <button type="button" class="medium-btn" id="crypto1-send-transaction-btn"
  218. style="display: none;" data-attr="{{ route('wallet-send.index', ['msqxpAmount' => $checkoutCharge['point_payrate']['crypto1']['msqxp'], 'p2upAmount' => $checkoutCharge['point_payrate']['crypto1']['p2up']]) }}">
  219. </button>
  220. <button type="button" class="medium-btn" id="crypto2-send-transaction-btn"
  221. style="display: none;" data-attr="{{ route('wallet-send.index', [ 'msqxpAmount' => 0, 'p2upAmount' => $checkoutCharge['point_payrate']['crypto2']['p2up'] ]) }}">
  222. </button>
  223. {{-- <button type="button" class="medium-btn qrcode-scan" style="display: none;" data-attr="{{ route('wallet-balance.index') }}">--}}
  224. {{-- 내 자산 QR 코드 스캔--}}
  225. {{-- </button>--}}
  226. </div>
  227. <div class="account-content" id="paymethod-div">
  228. <div class="d-flex align-items-center">
  229. @php
  230. $shopPayMethodSetup = json_decode($listType1Book['Book'][6]['Page'][0]['C1'], true);
  231. @endphp
  232. @forelse ($codeTitle['paymethod']['sorder'] ?? [] as $key => $paymethod)
  233. @php
  234. $key = 'Is' . $paymethod['Code'];
  235. @endphp
  236. @if (array_key_exists( $key, $shopPayMethodSetup) && $shopPayMethodSetup[$key])
  237. <div class="paymethod-div">
  238. <input type="radio" value="{{ $paymethod['Code'] }}" name="paymethod" id="paymethod-radio-{{ $paymethod['Code'] }}" onclick="checkBox(this)">
  239. <label for="paymethod-radio-{{ $paymethod['Code'] }}" class="form-label">{{ $paymethod['Title'] }}</label>
  240. </div>
  241. @endif
  242. @empty
  243. <div class="col">
  244. 비어있습니다
  245. </div>
  246. @endforelse
  247. </div>
  248. <div id="paymethod-Remit" class="divcont virtual-account-payment pay-type-content">
  249. @include('views.shop.checkout.paymethod-remit', [ 'parentClass' => '#paymethod-Remit' ])
  250. </div>
  251. <div id="paymethod-CrCard" class="divcont virtual-account-payment pay-type-content">
  252. </div>
  253. <div id="paymethod-Crypto1" class="divcont virtual-account-payment pay-type-content">
  254. <p class="validate-message" style="display: none;"></p>
  255. <ul class="pay-type-sections msqxp-group">
  256. <li class="payBox-section pay-type-section mt-2">
  257. @php
  258. if ($checkoutCharge['total'] > 0) {
  259. $crypto1P2upPercent = number_format($checkoutCharge['point_payrate']['crypto1']['p2up'] / $checkoutCharge['total'] * 100, 2);
  260. } else {
  261. $crypto1P2upPercent = 0;
  262. }
  263. @endphp
  264. <label class="line-title d-block">P2UP 결제* (최대 {{ $crypto1P2upPercent }}% 까지)</label>
  265. <input type="text" class="form-control decimal p2up-txt"
  266. data-point="0"
  267. onchange="change_p2up(this, 'crypto1', '#paymethod-Crypto1 #msqxp-txt')"
  268. value="{{ number_format($checkoutCharge['point_payrate']['crypto1']['p2up']) }}">
  269. </li>
  270. <li class="payBox-section pay-type-section mt-2">
  271. <label class="line-title d-block">MSQXP 결제 (잔액결제)</label>
  272. <input type="text" id="msqxp-txt" class="form-control" value="{{ number_format($checkoutCharge['point_payrate']['crypto1']['msqxp']) }}" readonly>
  273. </li>
  274. {{-- <li class="payBox-section pay-type-section mt-2">--}}
  275. {{-- <label class="line-title d-block">MSQ XP 현잔액</label>--}}
  276. {{-- <input type="text" class="form-control" id="msqxp-balance-txt" readonly>--}}
  277. {{-- </li>--}}
  278. {{-- <li class="payBox-section pay-type-section mt-2 avail possible" style="display: none;">--}}
  279. {{-- 결제가능--}}
  280. {{-- <strong class="text-primary"><i class="far fa-circle"></i></strong>--}}
  281. {{-- </li>--}}
  282. {{-- <li class="payBox-section pay-type-section mt-2 avail impossible">--}}
  283. {{-- 결제불가--}}
  284. {{-- <strong class="text-danger"><i class="fas fa-times"></i></strong>--}}
  285. {{-- </li>--}}
  286. </ul>
  287. {{-- <ul class="pay-type-sections pay-cypto p2up-group">--}}
  288. {{-- <li class="payBox-section pay-type-section mt-2">--}}
  289. {{-- <label class="line-title d-block">P2U 결제 (50%)</label>--}}
  290. {{-- <input type="text" class="form-control" name="" id="txt" value="{{ number_format($checkoutCharge['half_total']) }}" readonly>--}}
  291. {{-- </li>--}}
  292. {{-- <li class="payBox-section pay-type-section mt-2">--}}
  293. {{-- <label class="line-title d-block">P2U 현잔액</label>--}}
  294. {{-- <input type="text" class="form-control" id="p2up-balance-txt" readonly>--}}
  295. {{-- </li>--}}
  296. {{-- <li class="payBox-section pay-type-section mt-2 avail possible" style="display: none;">--}}
  297. {{-- 결제가능--}}
  298. {{-- <strong class="text-primary"><i class="far fa-circle"></i></strong>--}}
  299. {{-- </li>--}}
  300. {{-- <li class="payBox-section pay-type-section mt-2 avail impossible">--}}
  301. {{-- 결제불가--}}
  302. {{-- <strong class="text-danger"><i class="fas fa-times"></i></strong>--}}
  303. {{-- </li>--}}
  304. {{-- </ul>--}}
  305. </div>
  306. <div id="paymethod-Crypto2" class="divcont virtual-account-payment pay-type-content">
  307. <div>
  308. <p class="validate-message" style="display: none;"></p>
  309. <ul class="pay-type-sections msqxp-group">
  310. <li class="payBox-section pay-type-section mt-2">
  311. @php
  312. if ($checkoutCharge['total'] > 0) {
  313. $crypto2P2upPercent = number_format($checkoutCharge['point_payrate']['crypto2']['p2up'] / $checkoutCharge['total'] * 100, 2);
  314. } else {
  315. $crypto2P2upPercent = 0;
  316. }
  317. @endphp
  318. <label class="line-title d-block">P2UP 결제* (최대 {{ $crypto2P2upPercent }}% 까지)</label>
  319. <input type="text" class="form-control decimal p2up-txt"
  320. data-point="0"
  321. onchange="change_p2up(this, 'crypto2', '#paymethod-Crypto2 #cash-txt')"
  322. value="{{ number_format($checkoutCharge['point_payrate']['crypto2']['p2up']) }}">
  323. </li>
  324. <li class="payBox-section pay-type-section mt-2">
  325. <label class="line-title d-block">원화 결제 (잔액결제)</label>
  326. <input type="text" id="cash-txt" class="form-control" value="{{ number_format($checkoutCharge['point_payrate']['crypto2']['cash']) }}" readonly>
  327. </li>
  328. {{-- <li class="payBox-section pay-type-section mt-2">--}}
  329. {{-- <label class="line-title d-block">현금 결제</label>--}}
  330. {{-- <input type="text" class="form-control" value="{{ number_format($checkoutCharge['point_payrate']['cash']) }}" readonly>--}}
  331. {{-- </li>--}}
  332. </ul>
  333. </div>
  334. <div>
  335. @include('views.shop.checkout.paymethod-remit', [ 'parentClass' => '#paymethod-Crypto2' ])
  336. </div>
  337. </div>
  338. {{-- <div id="paymethod-Crypto2" class="divcont virtual-account-payment pay-type-content">--}}
  339. {{-- <p class="validate-message" style="display: none;"></p>--}}
  340. {{-- <ul class="pay-type-sections pay-cypto">--}}
  341. {{-- <li class="payBox-section pay-type-section mt-2">--}}
  342. {{-- <label class="line-title d-block">세번째 레이어MSQ XP 결제 (50%)</label>--}}
  343. {{-- <input type="text" class="form-control" id="" readonly>--}}
  344. {{-- </li>--}}
  345. {{-- <li class="payBox-section pay-type-section mt-2">--}}
  346. {{-- <label class="line-title d-block">MSQXP 현잔액</label>--}}
  347. {{-- <input type="text" class="form-control" id="" readonly>--}}
  348. {{-- </li>--}}
  349. {{-- <li class="payBox-section pay-type-section mt-2 avail">--}}
  350. {{-- 결제가능--}}
  351. {{-- <strong class="text-primary"><i class="far fa-circle"></i></strong>--}}
  352. {{-- </li>--}}
  353. {{-- </ul>--}}
  354. {{-- <ul class="pay-type-sections pay-cypto">--}}
  355. {{-- <li class="payBox-section pay-type-section mt-2">--}}
  356. {{-- <label class="line-title d-block">P2U 결제 (50%)</label>--}}
  357. {{-- <input type="text" class="form-control" name="" id="" readonly>--}}
  358. {{-- </li>--}}
  359. {{-- <li class="payBox-section pay-type-section mt-2">--}}
  360. {{-- <label class="line-title d-block">P2U 현잔액</label>--}}
  361. {{-- <input type="text" class="form-control" id="" readonly>--}}
  362. {{-- </li>--}}
  363. {{-- <li class="payBox-section pay-type-section mt-2 avail">--}}
  364. {{-- 결제가능--}}
  365. {{-- <strong class="text-danger"><i class="fas fa-times"></i></strong>--}}
  366. {{-- </li>--}}
  367. {{-- </ul>--}}
  368. {{-- </div>--}}
  369. </div>
  370. </div>
  371. </div>
  372. <div class="col-lg-12">
  373. <div class="account-card mb-0">
  374. <div class="account-title">
  375. <h4>결제하기</h4>
  376. {{-- <button data-bs-toggle="modal" data-bs-target="#payment-add">지갑 추가</button>--}}
  377. </div>
  378. {{-- <div class="account-content">--}}
  379. {{-- <div>--}}
  380. {{-- <label class="line-title d-block">입금자명</label>--}}
  381. {{-- <input type="text" class="form-text" name="remit_name" id="remit-name-txt" required>--}}
  382. {{-- </div>--}}
  383. {{-- </div>--}}
  384. <div class="checkout-check">
  385. <input type="checkbox" id="checkout-check">
  386. <label for="checkout-check">약관동의 <a href="{{ route('policy.index') }}" target="_blank">약관보기</a></label>
  387. </div>
  388. <div class="checkout-proced">
  389. {{-- <a href="/checkout-ok" class="btn btn-inline">결제하기</a>--}}
  390. <button type="submit" id="checkout-btn" class="btn btn-inline button-prevent-multiple-submits">
  391. <i class="spinner fa fa-spinner fa-spin"></i>
  392. 결제하기
  393. </button>
  394. </div>
  395. </div>
  396. </div>
  397. </div>
  398. </form>
  399. </section>
  400. <!--=====================================
  401. CHECKOUT PART END
  402. =======================================-->
  403. <!--=====================================
  404. MODAL ADD FORM START
  405. =======================================-->
  406. @endsection
  407. @push('modal')
  408. @include('views.modals.medium')
  409. @endpush
  410. @push('js')
  411. {{--<script type="text/javascript" src="https://cdn.iamport.kr/js/iamport.payment-1.2.0.js"></script>--}}
  412. <script>
  413. $(document).ready(function() {
  414. const first_paymethod = $('.paymethod-div').first().find('input')
  415. first_paymethod.prop('checked', true)
  416. checkBox('#' + first_paymethod.attr('id'))
  417. // IMP.init(import_pg_setup['MerchantId']);
  418. });
  419. function change_p2up($this, type, dom_val) {
  420. const checkout_charge = @json($checkoutCharge);
  421. const p2up_max_val = checkout_charge['point_payrate'][type]['p2up']
  422. const p2up_val = minusComma( $($this).val() )
  423. if (p2up_val < 0 || p2up_val > p2up_max_val) {
  424. $($this).val( format_decimal( p2up_max_val, 0) )
  425. switch (type) {
  426. case 'crypto1':
  427. $(dom_val).val( format_decimal( checkout_charge['point_payrate'][type]['msqxp'], 0 ) )
  428. break;
  429. case 'crypto2':
  430. $(dom_val).val( format_decimal( checkout_charge['point_payrate'][type]['cash'], 0 ) )
  431. break;
  432. }
  433. return iziToast.info({ title: 'Info', message: 'P2UP 최대 결제금액을 초과했습니다' })
  434. }
  435. const second_val = format_decimal(checkout_charge['total'] - p2up_val, 0)
  436. $(dom_val).val(second_val)
  437. }
  438. {{--function request_pay() {--}}
  439. {{-- const checkout_form = $('#checkout-form')--}}
  440. {{-- const amount = @json($checkoutCharge['total']);--}}
  441. {{-- const item_name = @json($checkoutCharge['item_name']);--}}
  442. {{-- // IMP.request_pay(param, callback) 결제창 호출--}}
  443. {{-- IMP.request_pay({ // param--}}
  444. {{-- pg: import_pg_setup['PG'],--}}
  445. {{-- pay_method: "card",--}}
  446. {{-- // merchant_uid: "",--}}
  447. {{-- name: item_name,--}}
  448. {{-- amount: Number(amount),--}}
  449. {{-- buyer_email: window.Member['Email'],--}}
  450. {{-- buyer_name: $(checkout_form).find('input[name="ship_contact"]').val(),--}}
  451. {{-- buyer_tel: $(checkout_form).find('input[name="ship_mobile"]').val(),--}}
  452. {{-- buyer_addr: $(checkout_form).find('input[name="ship_addr1"]').val(),--}}
  453. {{-- buyer_postcode: $(checkout_form).find('input[name="ship_zip_code"]').val()--}}
  454. {{-- }, function (rsp) { // callback--}}
  455. {{-- if (rsp.success) {--}}
  456. {{-- success_external_payment_callback(checkout_form)--}}
  457. {{-- $(checkout_form).trigger('submit', true)--}}
  458. {{-- } else {--}}
  459. {{-- failed_external_payment_callback(checkout_form)--}}
  460. {{-- }--}}
  461. {{-- });--}}
  462. {{--}--}}
  463. async function change_cart_all_checkbox($this) {
  464. const page = []
  465. $('#cart-table > tbody > tr').each(function () {
  466. page.push( {
  467. Id: Number($(this).find('.cart_id').val()),
  468. Checked: $($this).is(':checked') ? '1' : '0'
  469. } )
  470. })
  471. await cart_act_parameter(page)
  472. }
  473. async function change_cart_checkbox($this) {
  474. await cart_act_parameter([
  475. {
  476. Id: Number($($this).closest('tr').find('.cart_id').val()),
  477. Checked: $($this).prop('checked') ? '1' : '0'
  478. }
  479. ])
  480. }
  481. async function cart_act_parameter(page) {
  482. const response = await get_api_data('cart-act', {
  483. Page : page
  484. })
  485. show_iziToast_msg(response.data.Page, function () {
  486. location.reload()
  487. })
  488. }
  489. function failed_external_payment_callback(checkout_form) {
  490. $(checkout_form).append($('<input>', { 'type': 'hidden', 'class': 'dynamic_add_data', 'name': 'status', 'value': 'F' }))
  491. $(checkout_form).append($('<input>', { 'type': 'hidden', 'class': 'dynamic_add_data', 'name': 'situation', 'value': 'FF' }))
  492. $(checkout_form).append($('<input>', { 'type': 'hidden', 'class': 'dynamic_add_data', 'name': 'situation_title', 'value': format_conver_for('FF', "situation('sorder')") }))
  493. }
  494. function success_external_payment_callback(checkout_form) {
  495. $(checkout_form).append($('<input>', { 'type': 'hidden', 'class': 'dynamic_add_data', 'name': 'status', 'value': '1' }))
  496. $(checkout_form).append($('<input>', { 'type': 'hidden', 'class': 'dynamic_add_data', 'name': 'ok_success', 'value': true }))
  497. $(checkout_form).append($('<input>', { 'type': 'hidden', 'class': 'dynamic_add_data', 'name': 'ok_paid', 'value': true }))
  498. }
  499. function completed_wallet_send(data) {
  500. const checkout_form = $('#checkout-form')
  501. // if ('error' !== 'success') {
  502. if (data['transaction']['status'] !== 'success') {
  503. failed_external_payment_callback(checkout_form)
  504. } else {
  505. success_external_payment_callback(checkout_form)
  506. }
  507. $(checkout_form).trigger('submit', true)
  508. }
  509. function fn_move(dom_val){
  510. // $(dom_val).focus()
  511. const offset = $(dom_val).offset()
  512. $('html, body').animate({scrollTop : offset.top - 250}, 400)
  513. }
  514. {{--function check_balance_possible(dom_val, balance, half_total) {--}}
  515. {{-- if (balance >= half_total) {--}}
  516. {{-- $(dom_val).find('.possible').show()--}}
  517. {{-- $(dom_val).find('.impossible').hide()--}}
  518. {{-- } else {--}}
  519. {{-- $(dom_val).find('.possible').hide()--}}
  520. {{-- $(dom_val).find('.impossible').show()--}}
  521. {{-- }--}}
  522. {{--}--}}
  523. {{--function update_balance_ui(data) {--}}
  524. {{-- const checkout_form = $('#checkout-form')--}}
  525. {{-- const msq_bal = data['wallet']['balance']['MSQXP']--}}
  526. {{-- const p2u_bal = data['wallet']['balance']['P2U']--}}
  527. {{-- const half_total = @json($checkoutCharge['half_total']);--}}
  528. {{-- $(checkout_form).find('#msqxp-balance-txt').val(format_decimal( msq_bal, 0 ))--}}
  529. {{-- $(checkout_form).find('#p2up-balance-txt').val(format_decimal( p2u_bal, 0 ))--}}
  530. {{-- check_balance_possible('.msqxp-group', msq_bal, half_total)--}}
  531. {{-- check_balance_possible('.p2up-group', p2u_bal, half_total)--}}
  532. {{--}--}}
  533. // 결제방법 탭 변경 이벤트
  534. // $('input[name=paymethod]').on('change', function() {
  535. // $('.page-pc').find('.qrcode-scan').hide()
  536. //
  537. // switch ($(this).val()) {
  538. // case 'Remit':
  539. // break
  540. // case 'Crypto1':
  541. // $('.page-pc').find('.qrcode-scan').show()
  542. // break
  543. // }
  544. // });
  545. function check_remit_error(dom_val) {
  546. const deposit_bank_select = `${dom_val} #deposit-bank-select option:selected`
  547. if (isEmpty($(dom_val).find('#remit-name-txt').val())) {
  548. fn_move(`${dom_val} #remit-name-txt`)
  549. return { error: true, msg: '입금자명을 입력하세요' }
  550. } else if (isEmpty($(deposit_bank_select).val())) {
  551. fn_move(`${dom_val} #deposit-bank-select`)
  552. return { error: true, msg: '무통장입금 계좌를 선택하세요' }
  553. }
  554. return { error: false, data: [] }
  555. }
  556. // 결제방법 에따른 체크 메시지
  557. function check_paymethod_radio() {
  558. const paymethod = $('input[name=paymethod]:checked').val()
  559. const checkout_charge = @json($checkoutCharge);
  560. // console.log(paymethod)
  561. switch (paymethod) {
  562. case 'Remit':
  563. return check_remit_error('#paymethod-Remit')
  564. case 'Crypto1':
  565. const crypto1_p2up = Number( minusComma( $('#paymethod-Crypto1').find('.p2up-txt').val() ) )
  566. const crypto1_total = crypto1_p2up + Number( minusComma( $('#paymethod-Crypto1').find('#msqxp-txt').val() ) )
  567. const crypto1_p2up_max_val = checkout_charge['point_payrate']['crypto1']['p2up']
  568. if (checkout_charge['total'] !== crypto1_total) {
  569. return { error: true, msg: '결제 금액을 다시 확인하세요' }
  570. } else if (crypto1_p2up < 0 || crypto1_p2up > crypto1_p2up_max_val) {
  571. return { error: true, msg: 'P2UP 최대 결제금액을 초과했습니다' }
  572. }
  573. return { error: false, data: [] }
  574. case 'Crypto2':
  575. const crypto2_p2up = Number( minusComma( $('#paymethod-Crypto2').find('.p2up-txt').val() ))
  576. const crypto2_total = crypto2_p2up + Number( minusComma( $('#paymethod-Crypto2').find('#cash-txt').val() ) )
  577. const crypto2_p2up_max_val = checkout_charge['point_payrate']['crypto2']['p2up']
  578. if (checkout_charge['total'] !== crypto2_total) {
  579. return { error: true, msg: '결제 금액을 다시 확인하세요' }
  580. } else if (crypto2_p2up < 0 || crypto2_p2up > crypto2_p2up_max_val) {
  581. return { error: true, msg: 'P2UP 최대 결제금액을 초과했습니다' }
  582. }
  583. return check_remit_error('#paymethod-Crypto2')
  584. default:
  585. return { error: false, data: [] }
  586. }
  587. }
  588. function make_remit_form_data(form, dom_val) {
  589. const deposit_bank_select = `${dom_val} #deposit-bank-select option:selected`
  590. const remit_account = $(deposit_bank_select).text() + ' ' + $(dom_val).find('#account-no-txt').val() + ' ' + $(dom_val).find('#holder-name-txt').val()
  591. const remit_name = $(dom_val).find('#remit-name-txt').val()
  592. $(form).append($('<input>', { 'type': 'hidden', 'class': 'dynamic_add_data', 'name': 'remit_account', 'value': remit_account }))
  593. $(form).append($('<input>', { 'type': 'hidden', 'class': 'dynamic_add_data', 'name': 'remit_name', 'value': remit_name }))
  594. }
  595. // 결제방법에 따른 폼데이터 추가
  596. function create_add_form_data($this) {
  597. // 동적으로 추가한 폼데이터 삭제
  598. $($this).find('.dynamic_add_data').remove()
  599. const paymethod = $('input[name=paymethod]:checked').val()
  600. const checkout_charge = @json($checkoutCharge);
  601. switch (paymethod) {
  602. case 'Remit':
  603. make_remit_form_data($this, '#paymethod-Remit')
  604. $($this).append($('<input>', { 'type': 'hidden', 'class': 'dynamic_add_data', 'name': 'cash_amt', 'value': checkout_charge['total'] }))
  605. $($this).append($('<input>', { 'type': 'hidden', 'class': 'dynamic_add_data', 'name': 'ok_success', 'value': true }))
  606. return { error: false, data: [] }
  607. case 'Crypto1':
  608. const crypto1_p2up = minusComma( $('#paymethod-Crypto1').find('.p2up-txt').val() )
  609. const crypto1_msqxp = minusComma( $('#paymethod-Crypto1').find('#msqxp-txt').val() )
  610. $($this).append($('<input>', { 'type': 'hidden', 'class': 'dynamic_add_data', 'name': 'x1_pay_amt', 'value': crypto1_p2up }))
  611. $($this).append($('<input>', { 'type': 'hidden', 'class': 'dynamic_add_data', 'name': 'x2_pay_amt', 'value': crypto1_msqxp }))
  612. const crypto1_url = $('#crypto1-send-transaction-btn').attr('data-attr').split('?')
  613. const crypto1_params = new URLSearchParams(crypto1_url[1])
  614. crypto1_params.set('p2upAmount', crypto1_p2up)
  615. crypto1_params.set('msqxpAmount', crypto1_msqxp)
  616. $('#crypto1-send-transaction-btn').attr('data-attr', crypto1_url[0] + '?' + crypto1_params.toString())
  617. $('#crypto1-send-transaction-btn').trigger('click')
  618. return { error: true, msg: '' }
  619. case 'Crypto2':
  620. const crypto2_p2up = minusComma( $('#paymethod-Crypto2').find('.p2up-txt').val() )
  621. const crypto2_cash = minusComma( $('#paymethod-Crypto2').find('#cash-txt').val() )
  622. make_remit_form_data($this, '#paymethod-Crypto2')
  623. $($this).append($('<input>', { 'type': 'hidden', 'class': 'dynamic_add_data', 'name': 'x1_pay_amt', 'value': crypto2_p2up }))
  624. $($this).append($('<input>', { 'type': 'hidden', 'class': 'dynamic_add_data', 'name': 'cash_amt', 'value': crypto2_cash }))
  625. $($this).append($('<input>', { 'type': 'hidden', 'class': 'dynamic_add_data', 'name': 'ok_success', 'value': true }))
  626. // p2u가 0일 떄 qr코드 스킵
  627. if (Number(crypto2_p2up) === 0) {
  628. return { error: false, data: [] }
  629. }
  630. const crypto2_url = $('#crypto2-send-transaction-btn').attr('data-attr').split('?')
  631. const crypto2_params = new URLSearchParams(crypto2_url[1])
  632. crypto2_params.set('p2upAmount', crypto2_p2up)
  633. $('#crypto2-send-transaction-btn').attr('data-attr', crypto2_url[0] + '?' + crypto2_params.toString())
  634. $('#crypto2-send-transaction-btn').trigger('click')
  635. return { error: true, msg: '' }
  636. case 'CrCard':
  637. // request_pay()
  638. return { error: true, msg: '' }
  639. }
  640. }
  641. $('#checkout-form').on('submit', function (event, direct_submit) {
  642. event.preventDefault()
  643. // 바로 submit
  644. if (direct_submit) {
  645. return this.submit()
  646. }
  647. const sub_total = @json($checkoutCharge['sub_total']);
  648. if (sub_total <= 0) {
  649. return iziToast.info({ title: 'Info', message: '쇼핑카트가 비어있습니다' })
  650. }
  651. const result = check_paymethod_radio()
  652. if (result['error']) {
  653. return iziToast.info({ title: 'Info', message: result['msg'] })
  654. }
  655. const company_contact_bd_div = '#company-contact-bd-div .profile-card'
  656. const company_destina_bd_div = '#company-destina-bd-div .profile-card'
  657. if (! $(company_contact_bd_div).hasClass('active')) {
  658. fn_move('#contact-btn')
  659. return iziToast.info({ title: 'Info', message: '연락처를 선택하세요' })
  660. }
  661. if (! $(company_destina_bd_div).hasClass('active')) {
  662. fn_move('#address-btn')
  663. return iziToast.info({ title: 'Info', message: '배송지를 선택하세요' })
  664. }
  665. if (! $('#checkout-check').prop('checked')) {
  666. fn_move('#checkout-check')
  667. return iziToast.info({ title: 'Info', message: '약관을 확인하세요' })
  668. }
  669. click_submit_btn(this)
  670. const ship_contact = $(company_contact_bd_div + '.active').find('.ship-contact-txt').text()
  671. const ship_mobile = $(company_contact_bd_div + '.active').find('.ship-mobile-txt').text()
  672. const ship_zip_code = $(company_destina_bd_div + '.active').find('.ship-zip-code-txt').text()
  673. const ship_addr1 = $(company_destina_bd_div + '.active').find('.ship-addr1-txt').text()
  674. const ship_addr2 = $(company_destina_bd_div + '.active').find('.ship-addr2-txt').text()
  675. $(this).append($('<input>', { 'type': 'hidden', 'name': 'ship_contact', 'value': ship_contact }))
  676. $(this).append($('<input>', { 'type': 'hidden', 'name': 'ship_mobile', 'value': ship_mobile }))
  677. $(this).append($('<input>', { 'type': 'hidden', 'name': 'ship_zip_code', 'value': ship_zip_code }))
  678. $(this).append($('<input>', { 'type': 'hidden', 'name': 'ship_addr1', 'value': ship_addr1 }))
  679. $(this).append($('<input>', { 'type': 'hidden', 'name': 'ship_addr2', 'value': ship_addr2 }))
  680. if (create_add_form_data(this)['error']) {
  681. return click_submit_btn(this, false)
  682. }
  683. this.submit()
  684. });
  685. function change_remit_account($this, closet_val) {
  686. $(closet_val).find('#account-no-txt').val($($this).val())
  687. $(closet_val).find('#holder-name-txt').val($($this).find('option:selected').data('holder-name'))
  688. }
  689. function checkBox($this) {
  690. const payMethod = document.getElementsByName('paymethod'); //체크박스 name
  691. $(payMethod).each(function () {
  692. const disign = $('#paymethod-' + $(this).val())// 보여질내용
  693. if($(this).val() === $($this).val()) {
  694. disign.show()
  695. } else{
  696. disign.hide()
  697. }
  698. });
  699. }
  700. const import_pg_setup = @json($importPgSetup);
  701. </script>
  702. @endpush