Spaces:
No application file

Shop / checkout.html
Parkcas's picture
Upload 3 files
acfcded verified
Raw History Blame Contribute Delete
3.69 kB
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>๊ฒฐ์ œ ํŽ˜์ด์ง€</title>
<style>
:root {
--main-color: #6cdce4; /* ๋ฏผํŠธ */
--secondary-color: #447790; /* ๋ณด์กฐ์ƒ‰ */
}
body {
margin: 0;
font-family: 'Noto Sans KR', sans-serif;
background-color: #f9f9f9;
color: #333;
}
header {
background-color: var(--secondary-color);
color: var(--main-color);
padding: 15px 30px;
text-align: center;
font-size: 24px;
}
.container {
max-width: 600px;
margin: 30px auto;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
h2 {
color: var(--secondary-color);
margin-bottom: 15px;
}
.cart-summary {
margin-bottom: 20px;
}
.cart-summary div {
display: flex;
justify-content: space-between;
margin-bottom: 5px;
}
label {
display: block;
margin: 10px 0 5px;
}
input {
width: 100%;
padding: 8px;
font-size: 14px;
border-radius: 5px;
border: 1px solid #ccc;
margin-bottom: 10px;
}
button {
width: 100%;
padding: 10px;
background-color: var(--main-color);
color: #fff;
font-size: 16px;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: var(--secondary-color);
}
</style>
</head>
<body>
<header>๊ฒฐ์ œ ํŽ˜์ด์ง€</header>
<div class="container">
<h2>์žฅ๋ฐ”๊ตฌ๋‹ˆ ํ™•์ธ</h2>
<div class="cart-summary" id="cart-summary">
<!-- ์žฅ๋ฐ”๊ตฌ๋‹ˆ ์ƒํ’ˆ ๋ชฉ๋ก ํ‘œ์‹œ -->
</div>
<h2>๊ฒฐ์ œ ์ •๋ณด ์ž…๋ ฅ</h2>
<form id="payment-form">
<label for="name">์ด๋ฆ„</label>
<input type="text" id="name" required placeholder="ํ™๊ธธ๋™">
<label for="card">์นด๋“œ ๋ฒˆํ˜ธ</label>
<input type="text" id="card" required placeholder="0000-0000-0000-0000">
<label for="expiry">์œ ํšจ๊ธฐ๊ฐ„</label>
<input type="text" id="expiry" required placeholder="MM/YY">
<button type="submit">๊ฒฐ์ œ ์™„๋ฃŒ</button>
</form>
</div>
<script>
// localStorage์—์„œ ์žฅ๋ฐ”๊ตฌ๋‹ˆ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ
let cart = JSON.parse(localStorage.getItem('cartData')) || [];
const cartSummary = document.getElementById('cart-summary');
function renderCartSummary(){
cartSummary.innerHTML = '';
let total = 0;
cart.forEach(item => {
total += item.price;
const div = document.createElement('div');
div.innerHTML = `<span>${item.name}</span><span>โ‚ฉ${item.price}</span>`;
cartSummary.appendChild(div);
});
const totalDiv = document.createElement('div');
totalDiv.style.fontWeight = 'bold';
totalDiv.innerHTML = `<span>ํ•ฉ๊ณ„</span><span>โ‚ฉ${total}</span>`;
cartSummary.appendChild(totalDiv);
}
renderCartSummary();
const form = document.getElementById('payment-form');
form.addEventListener('submit', function(e){
e.preventDefault();
alert('๊ฒฐ์ œ๊ฐ€ ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค!');
localStorage.removeItem('cartData'); // ๊ฒฐ์ œ ํ›„ ์žฅ๋ฐ”๊ตฌ๋‹ˆ ์ดˆ๊ธฐํ™”
window.location.href = 'index.html'; // ๋ฉ”์ธ ํŽ˜์ด์ง€๋กœ ์ด๋™
});
</script>
</body>
</html>