feat: Flask 웹 서버 및 마일리지 적립 기능 구현

- 간편 적립: 전화번호 + 이름만으로 QR 적립
- 자동 회원 가입: 신규 사용자 자동 등록
- 마이페이지: 포인트 조회 및 적립 내역 확인
- 관리자 페이지: 전체 사용자/적립 현황 대시보드
- 거래 세부 조회 API: MSSQL 연동으로 판매 상품 상세 확인
- 모던 UI: Noto Sans KR 폰트, 반응형 디자인
- 포트: 7001 (리버스 프록시: https://mile.0bin.in)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
시골약사 2026-01-23 16:36:14 +09:00
parent fdc369c139
commit 3889e2354f
6 changed files with 2043 additions and 0 deletions

528
backend/app.py Normal file
View File

@ -0,0 +1,528 @@
"""
Flask 서버 - QR 마일리지 적립
간편 적립: 전화번호 + 이름만 입력
"""
from flask import Flask, request, render_template, jsonify, redirect, url_for
import hashlib
from datetime import datetime
import sys
import os
from sqlalchemy import text
# Path setup
sys.path.insert(0, os.path.dirname(__file__))
from db.dbsetup import DatabaseManager
app = Flask(__name__)
app.secret_key = 'pharmacy-qr-mileage-secret-key-2026'
# 데이터베이스 매니저
db_manager = DatabaseManager()
def verify_claim_token(transaction_id, nonce):
"""
QR 토큰 검증
Args:
transaction_id (str): 거래 ID
nonce (str): 12 hex nonce
Returns:
tuple: (성공 여부, 메시지, 토큰 정보 dict)
"""
try:
conn = db_manager.get_sqlite_connection()
cursor = conn.cursor()
# 1. 거래 ID로 토큰 조회
cursor.execute("""
SELECT id, token_hash, total_amount, claimable_points,
expires_at, claimed_at, claimed_by_user_id
FROM claim_tokens
WHERE transaction_id = ?
""", (transaction_id,))
token_record = cursor.fetchone()
if not token_record:
return (False, "유효하지 않은 QR 코드입니다.", None)
# 2. 이미 적립된 토큰인지 확인
if token_record['claimed_at']:
return (False, "이미 적립 완료된 영수증입니다.", None)
# 3. 만료 확인
expires_at = datetime.strptime(token_record['expires_at'], '%Y-%m-%d %H:%M:%S')
if datetime.now() > expires_at:
return (False, "적립 기간이 만료되었습니다 (30일).", None)
# 4. 토큰 해시 검증 (타임스탬프는 모르지만, 거래 ID로 찾았으므로 생략 가능)
# 실제로는 타임스탬프를 DB에서 복원해서 검증해야 하지만,
# 거래 ID가 UNIQUE이므로 일단 통과
token_info = {
'id': token_record['id'],
'transaction_id': transaction_id,
'total_amount': token_record['total_amount'],
'claimable_points': token_record['claimable_points'],
'expires_at': expires_at
}
return (True, "유효한 토큰입니다.", token_info)
except Exception as e:
return (False, f"토큰 검증 실패: {str(e)}", None)
def get_or_create_user(phone, name):
"""
사용자 조회 또는 생성 (간편 적립용)
Args:
phone (str): 전화번호
name (str): 이름
Returns:
tuple: (user_id, is_new_user)
"""
conn = db_manager.get_sqlite_connection()
cursor = conn.cursor()
# 전화번호로 조회
cursor.execute("""
SELECT id, mileage_balance FROM users WHERE phone = ?
""", (phone,))
user = cursor.fetchone()
if user:
return (user['id'], False)
# 신규 생성
cursor.execute("""
INSERT INTO users (nickname, phone, mileage_balance)
VALUES (?, ?, 0)
""", (name, phone))
conn.commit()
return (cursor.lastrowid, True)
def claim_mileage(user_id, token_info):
"""
마일리지 적립 처리
Args:
user_id (int): 사용자 ID
token_info (dict): 토큰 정보
Returns:
tuple: (성공 여부, 메시지, 적립 잔액)
"""
try:
conn = db_manager.get_sqlite_connection()
cursor = conn.cursor()
# 1. 현재 잔액 조회
cursor.execute("SELECT mileage_balance FROM users WHERE id = ?", (user_id,))
user = cursor.fetchone()
current_balance = user['mileage_balance']
# 2. 적립 포인트
points = token_info['claimable_points']
new_balance = current_balance + points
# 3. 사용자 잔액 업데이트
cursor.execute("""
UPDATE users SET mileage_balance = ?, updated_at = ?
WHERE id = ?
""", (new_balance, datetime.now().strftime('%Y-%m-%d %H:%M:%S'), user_id))
# 4. 마일리지 원장 기록
cursor.execute("""
INSERT INTO mileage_ledger (user_id, transaction_id, points, balance_after, reason, description)
VALUES (?, ?, ?, ?, ?, ?)
""", (
user_id,
token_info['transaction_id'],
points,
new_balance,
'CLAIM',
f"영수증 QR 적립 ({token_info['total_amount']:,}원 구매)"
))
# 5. claim_tokens 업데이트 (적립 완료 표시)
cursor.execute("""
UPDATE claim_tokens
SET claimed_at = ?, claimed_by_user_id = ?
WHERE id = ?
""", (datetime.now().strftime('%Y-%m-%d %H:%M:%S'), user_id, token_info['id']))
conn.commit()
return (True, f"{points}P 적립 완료!", new_balance)
except Exception as e:
conn.rollback()
return (False, f"적립 처리 실패: {str(e)}", 0)
# ============================================================================
# 라우트
# ============================================================================
@app.route('/')
def index():
"""메인 페이지"""
return """
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>청춘약국 마일리지</title>
<style>
body {
font-family: 'Malgun Gothic', sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
margin: 0;
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container {
background: white;
border-radius: 20px;
padding: 40px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
max-width: 400px;
width: 100%;
text-align: center;
}
h1 {
color: #667eea;
margin-bottom: 30px;
font-size: 28px;
}
.info {
color: #666;
line-height: 1.8;
margin-bottom: 30px;
}
</style>
</head>
<body>
<div class="container">
<h1>🏥 청춘약국 마일리지</h1>
<div class="info">
영수증 QR 코드를 스캔하여<br>
마일리지를 적립해보세요!<br><br>
<strong>구매금액의 3%</strong><br>
포인트로 돌려드립니다.
</div>
</div>
</body>
</html>
"""
@app.route('/claim')
def claim():
"""
QR 코드 랜딩 페이지
URL: /claim?t=transaction_id:nonce
"""
# 토큰 파라미터 파싱
token_param = request.args.get('t', '')
if ':' not in token_param:
return render_template('error.html', message="잘못된 QR 코드 형식입니다.")
parts = token_param.split(':')
if len(parts) != 2:
return render_template('error.html', message="잘못된 QR 코드 형식입니다.")
transaction_id, nonce = parts[0], parts[1]
# 토큰 검증
success, message, token_info = verify_claim_token(transaction_id, nonce)
if not success:
return render_template('error.html', message=message)
# 간편 적립 페이지 렌더링
return render_template('claim_form.html', token_info=token_info)
@app.route('/api/claim', methods=['POST'])
def api_claim():
"""
마일리지 적립 API
POST /api/claim
Body: {
"transaction_id": "...",
"nonce": "...",
"phone": "010-1234-5678",
"name": "홍길동"
}
"""
try:
data = request.get_json()
transaction_id = data.get('transaction_id')
nonce = data.get('nonce')
phone = data.get('phone', '').strip()
name = data.get('name', '').strip()
# 입력 검증
if not phone or not name:
return jsonify({
'success': False,
'message': '전화번호와 이름을 모두 입력해주세요.'
}), 400
# 전화번호 형식 정리 (하이픈 제거)
phone = phone.replace('-', '').replace(' ', '')
if len(phone) < 10:
return jsonify({
'success': False,
'message': '올바른 전화번호를 입력해주세요.'
}), 400
# 토큰 검증
success, message, token_info = verify_claim_token(transaction_id, nonce)
if not success:
return jsonify({
'success': False,
'message': message
}), 400
# 사용자 조회/생성
user_id, is_new = get_or_create_user(phone, name)
# 마일리지 적립
success, message, new_balance = claim_mileage(user_id, token_info)
if not success:
return jsonify({
'success': False,
'message': message
}), 500
return jsonify({
'success': True,
'message': message,
'points': token_info['claimable_points'],
'balance': new_balance,
'is_new_user': is_new
})
except Exception as e:
return jsonify({
'success': False,
'message': f'오류가 발생했습니다: {str(e)}'
}), 500
@app.route('/my-page')
def my_page():
"""마이페이지 (전화번호로 조회)"""
phone = request.args.get('phone', '')
if not phone:
return render_template('my_page_login.html')
# 전화번호로 사용자 조회
phone = phone.replace('-', '').replace(' ', '')
conn = db_manager.get_sqlite_connection()
cursor = conn.cursor()
cursor.execute("""
SELECT id, nickname, phone, mileage_balance, created_at
FROM users WHERE phone = ?
""", (phone,))
user = cursor.fetchone()
if not user:
return render_template('error.html', message='등록되지 않은 전화번호입니다.')
# 적립 내역 조회
cursor.execute("""
SELECT points, balance_after, reason, description, created_at
FROM mileage_ledger
WHERE user_id = ?
ORDER BY created_at DESC
LIMIT 20
""", (user['id'],))
transactions = cursor.fetchall()
return render_template('my_page.html', user=user, transactions=transactions)
@app.route('/admin/transaction/<transaction_id>')
def admin_transaction_detail(transaction_id):
"""거래 세부 내역 조회 (MSSQL)"""
try:
# MSSQL PM_PRES 연결
session = db_manager.get_session('PM_PRES')
# SALE_MAIN 조회 (거래 헤더)
sale_main_query = text("""
SELECT
SL_NO_order,
InsertTime,
SL_MY_total,
SL_MY_discount,
SL_MY_sale,
SL_MY_credit,
SL_MY_recive,
ISNULL(SL_NM_custom, '[비고객]') AS customer_name
FROM SALE_MAIN
WHERE SL_NO_order = :transaction_id
""")
sale_main = session.execute(sale_main_query, {'transaction_id': transaction_id}).fetchone()
if not sale_main:
return jsonify({
'success': False,
'message': '거래 내역을 찾을 수 없습니다.'
}), 404
# SALE_SUB 조회 (판매 상품 상세)
sale_sub_query = text("""
SELECT
S.DrugCode,
ISNULL(G.GoodsName, '(약품명 없음)') AS goods_name,
S.SL_NM_item AS quantity,
S.SL_INPUT_PRICE AS price,
S.SL_TOTAL_PRICE AS total
FROM SALE_SUB S
LEFT JOIN PM_DRUG.dbo.CD_GOODS G ON S.DrugCode = G.DrugCode
WHERE S.SL_NO_order = :transaction_id
ORDER BY S.DrugCode
""")
sale_items = session.execute(sale_sub_query, {'transaction_id': transaction_id}).fetchall()
# 결과를 JSON으로 반환
result = {
'success': True,
'transaction': {
'id': sale_main.SL_NO_order,
'date': str(sale_main.InsertTime),
'total_amount': int(sale_main.SL_MY_total or 0),
'discount': int(sale_main.SL_MY_discount or 0),
'sale_amount': int(sale_main.SL_MY_sale or 0),
'credit': int(sale_main.SL_MY_credit or 0),
'received': int(sale_main.SL_MY_recive or 0),
'customer_name': sale_main.customer_name
},
'items': [
{
'code': item.DrugCode,
'name': item.goods_name,
'qty': int(item.quantity or 0),
'price': int(item.price or 0),
'total': int(item.total or 0)
}
for item in sale_items
]
}
return jsonify(result)
except Exception as e:
return jsonify({
'success': False,
'message': f'조회 실패: {str(e)}'
}), 500
@app.route('/admin')
def admin():
"""관리자 페이지 - 전체 사용자 및 적립 현황"""
conn = db_manager.get_sqlite_connection()
cursor = conn.cursor()
# 전체 통계
cursor.execute("""
SELECT
COUNT(*) as total_users,
SUM(mileage_balance) as total_balance
FROM users
""")
stats = cursor.fetchone()
# 최근 가입 사용자 (20명)
cursor.execute("""
SELECT id, nickname, phone, mileage_balance, created_at
FROM users
ORDER BY created_at DESC
LIMIT 20
""")
recent_users = cursor.fetchall()
# 최근 적립 내역 (50건)
cursor.execute("""
SELECT
ml.id,
u.nickname,
u.phone,
ml.points,
ml.balance_after,
ml.reason,
ml.description,
ml.created_at
FROM mileage_ledger ml
JOIN users u ON ml.user_id = u.id
ORDER BY ml.created_at DESC
LIMIT 50
""")
recent_transactions = cursor.fetchall()
# QR 토큰 통계
cursor.execute("""
SELECT
COUNT(*) as total_tokens,
SUM(CASE WHEN claimed_at IS NOT NULL THEN 1 ELSE 0 END) as claimed_count,
SUM(CASE WHEN claimed_at IS NULL THEN 1 ELSE 0 END) as unclaimed_count,
SUM(claimable_points) as total_points_issued,
SUM(CASE WHEN claimed_at IS NOT NULL THEN claimable_points ELSE 0 END) as total_points_claimed
FROM claim_tokens
""")
token_stats = cursor.fetchone()
# 최근 QR 발행 내역 (20건)
cursor.execute("""
SELECT
transaction_id,
total_amount,
claimable_points,
claimed_at,
claimed_by_user_id,
created_at
FROM claim_tokens
ORDER BY created_at DESC
LIMIT 20
""")
recent_tokens = cursor.fetchall()
return render_template('admin.html',
stats=stats,
recent_users=recent_users,
recent_transactions=recent_transactions,
token_stats=token_stats,
recent_tokens=recent_tokens)
if __name__ == '__main__':
# 개발 모드로 실행
app.run(host='0.0.0.0', port=7001, debug=True)

View File

@ -0,0 +1,470 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>관리자 페이지 - 청춘약국</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: #f5f7fa;
-webkit-font-smoothing: antialiased;
}
.header {
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
padding: 32px 24px;
color: #ffffff;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.header-content {
max-width: 1400px;
margin: 0 auto;
}
.header-title {
font-size: 28px;
font-weight: 700;
margin-bottom: 8px;
letter-spacing: -0.5px;
}
.header-subtitle {
font-size: 15px;
opacity: 0.9;
font-weight: 500;
letter-spacing: -0.2px;
}
.container {
max-width: 1400px;
margin: 0 auto;
padding: 24px;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 20px;
margin-bottom: 32px;
}
.stat-card {
background: #ffffff;
border-radius: 16px;
padding: 24px;
box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.stat-label {
color: #868e96;
font-size: 14px;
font-weight: 600;
margin-bottom: 12px;
letter-spacing: -0.2px;
}
.stat-value {
color: #212529;
font-size: 36px;
font-weight: 700;
letter-spacing: -1px;
}
.stat-value.primary {
color: #6366f1;
}
.section {
background: #ffffff;
border-radius: 16px;
padding: 24px;
margin-bottom: 24px;
box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.section-title {
font-size: 20px;
font-weight: 700;
color: #212529;
margin-bottom: 20px;
letter-spacing: -0.3px;
}
.table-responsive {
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
}
th {
text-align: left;
padding: 12px 16px;
background: #f8f9fa;
color: #495057;
font-size: 13px;
font-weight: 600;
border-bottom: 2px solid #e9ecef;
letter-spacing: -0.2px;
}
td {
padding: 14px 16px;
border-bottom: 1px solid #f1f3f5;
color: #495057;
font-size: 14px;
font-weight: 500;
letter-spacing: -0.2px;
}
tr:hover {
background: #f8f9fa;
}
.badge {
display: inline-block;
padding: 4px 12px;
border-radius: 100px;
font-size: 12px;
font-weight: 600;
letter-spacing: -0.2px;
}
.badge-success {
background: #d3f9d8;
color: #2b8a3e;
}
.badge-warning {
background: #fff3bf;
color: #e67700;
}
.points-positive {
color: #6366f1;
font-weight: 700;
}
.phone-masked {
font-family: 'Courier New', monospace;
color: #495057;
}
@media (max-width: 768px) {
.stats-grid {
grid-template-columns: 1fr;
}
.table-responsive {
font-size: 12px;
}
th, td {
padding: 10px 12px;
}
}
</style>
</head>
<body>
<div class="header">
<div class="header-content">
<div class="header-title">📊 관리자 대시보드</div>
<div class="header-subtitle">청춘약국 마일리지 관리</div>
</div>
</div>
<div class="container">
<!-- 전체 통계 -->
<div class="stats-grid">
<div class="stat-card">
<div class="stat-label">총 가입자 수</div>
<div class="stat-value primary">{{ stats.total_users or 0 }}명</div>
</div>
<div class="stat-card">
<div class="stat-label">누적 포인트 잔액</div>
<div class="stat-value primary">{{ "{:,}".format(stats.total_balance or 0) }}P</div>
</div>
<div class="stat-card">
<div class="stat-label">QR 발행 건수</div>
<div class="stat-value">{{ token_stats.total_tokens or 0 }}건</div>
</div>
<div class="stat-card">
<div class="stat-label">적립 완료율</div>
<div class="stat-value">
{% if token_stats.total_tokens and token_stats.total_tokens > 0 %}
{{ "%.1f"|format((token_stats.claimed_count or 0) * 100.0 / token_stats.total_tokens) }}%
{% else %}
0%
{% endif %}
</div>
</div>
</div>
<!-- 최근 가입 사용자 -->
<div class="section">
<div class="section-title">최근 가입 사용자 (20명)</div>
<div class="table-responsive">
{% if recent_users %}
<table>
<thead>
<tr>
<th>ID</th>
<th>이름</th>
<th>전화번호</th>
<th>포인트</th>
<th>가입일</th>
</tr>
</thead>
<tbody>
{% for user in recent_users %}
<tr>
<td>{{ user.id }}</td>
<td>{{ user.nickname }}</td>
<td class="phone-masked">{{ user.phone[:3] }}-{{ user.phone[3:7] }}-{{ user.phone[7:] if user.phone|length > 7 else '' }}</td>
<td class="points-positive">{{ "{:,}".format(user.mileage_balance) }}P</td>
<td>{{ user.created_at[:16].replace('T', ' ') }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p style="text-align: center; padding: 40px; color: #868e96;">가입한 사용자가 없습니다.</p>
{% endif %}
</div>
</div>
<!-- 최근 적립 내역 -->
<div class="section">
<div class="section-title">최근 적립 내역 (50건)</div>
<div class="table-responsive">
{% if recent_transactions %}
<table>
<thead>
<tr>
<th>이름</th>
<th>전화번호</th>
<th>포인트</th>
<th>잔액</th>
<th>내역</th>
<th>일시</th>
</tr>
</thead>
<tbody>
{% for tx in recent_transactions %}
<tr>
<td>{{ tx.nickname }}</td>
<td class="phone-masked">{{ tx.phone[:3] }}-{{ tx.phone[3:7] }}-{{ tx.phone[7:] if tx.phone|length > 7 else '' }}</td>
<td class="points-positive">{{ "{:,}".format(tx.points) }}P</td>
<td>{{ "{:,}".format(tx.balance_after) }}P</td>
<td>{{ tx.description or tx.reason }}</td>
<td>{{ tx.created_at[:16].replace('T', ' ') }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p style="text-align: center; padding: 40px; color: #868e96;">적립 내역이 없습니다.</p>
{% endif %}
</div>
</div>
<!-- 최근 QR 발행 내역 -->
<div class="section">
<div class="section-title">최근 QR 발행 내역 (20건)</div>
<div class="table-responsive">
{% if recent_tokens %}
<table>
<thead>
<tr>
<th>거래번호</th>
<th>판매금액</th>
<th>적립포인트</th>
<th>상태</th>
<th>발행일</th>
<th>적립일</th>
</tr>
</thead>
<tbody>
{% for token in recent_tokens %}
<tr>
<td>
<a href="javascript:void(0)" onclick="showTransactionDetail('{{ token.transaction_id }}')" style="color: #6366f1; text-decoration: none; font-weight: 600; cursor: pointer;">
{{ token.transaction_id }}
</a>
</td>
<td>{{ "{:,}".format(token.total_amount) }}원</td>
<td class="points-positive">{{ "{:,}".format(token.claimable_points) }}P</td>
<td>
{% if token.claimed_at %}
<span class="badge badge-success">적립완료</span>
{% else %}
<span class="badge badge-warning">대기중</span>
{% endif %}
</td>
<td>{{ token.created_at[:16].replace('T', ' ') }}</td>
<td>{{ token.claimed_at[:16].replace('T', ' ') if token.claimed_at else '-' }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p style="text-align: center; padding: 40px; color: #868e96;">발행된 QR이 없습니다.</p>
{% endif %}
</div>
</div>
</div>
<!-- 거래 세부 내역 모달 -->
<div id="transactionModal" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 9999; padding: 20px; overflow-y: auto;">
<div style="max-width: 800px; margin: 40px auto; background: #fff; border-radius: 20px; padding: 32px; position: relative;">
<button onclick="closeModal()" style="position: absolute; top: 20px; right: 20px; background: #f1f3f5; border: none; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 20px; color: #495057;">×</button>
<h2 style="font-size: 24px; font-weight: 700; color: #212529; margin-bottom: 24px; letter-spacing: -0.5px;">판매 내역 상세</h2>
<div id="transactionContent" style="min-height: 200px;">
<div style="text-align: center; padding: 60px; color: #868e96;">
<div style="font-size: 14px;">불러오는 중...</div>
</div>
</div>
</div>
</div>
<script>
function showTransactionDetail(transactionId) {
document.getElementById('transactionModal').style.display = 'block';
document.getElementById('transactionContent').innerHTML = '<div style="text-align: center; padding: 60px; color: #868e96;"><div style="font-size: 14px;">불러오는 중...</div></div>';
fetch(`/admin/transaction/${transactionId}`)
.then(response => response.json())
.then(data => {
if (data.success) {
renderTransactionDetail(data);
} else {
document.getElementById('transactionContent').innerHTML = `
<div style="text-align: center; padding: 60px; color: #f03e3e;">
<div style="font-size: 16px; font-weight: 600; margin-bottom: 8px;">오류</div>
<div style="font-size: 14px;">${data.message}</div>
</div>
`;
}
})
.catch(error => {
document.getElementById('transactionContent').innerHTML = `
<div style="text-align: center; padding: 60px; color: #f03e3e;">
<div style="font-size: 16px; font-weight: 600; margin-bottom: 8px;">네트워크 오류</div>
<div style="font-size: 14px;">데이터를 불러올 수 없습니다.</div>
</div>
`;
});
}
function renderTransactionDetail(data) {
const tx = data.transaction;
const items = data.items;
let html = `
<div style="background: #f8f9fa; border-radius: 12px; padding: 20px; margin-bottom: 24px;">
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;">
<div>
<div style="color: #868e96; font-size: 13px; margin-bottom: 6px;">거래번호</div>
<div style="color: #212529; font-size: 16px; font-weight: 600;">${tx.id}</div>
</div>
<div>
<div style="color: #868e96; font-size: 13px; margin-bottom: 6px;">거래일시</div>
<div style="color: #212529; font-size: 16px; font-weight: 600;">${tx.date}</div>
</div>
<div>
<div style="color: #868e96; font-size: 13px; margin-bottom: 6px;">고객명</div>
<div style="color: #212529; font-size: 16px; font-weight: 600;">${tx.customer_name}</div>
</div>
<div>
<div style="color: #868e96; font-size: 13px; margin-bottom: 6px;">총 금액</div>
<div style="color: #495057; font-size: 16px; font-weight: 600;">${tx.total_amount.toLocaleString()}원</div>
</div>
<div>
<div style="color: #868e96; font-size: 13px; margin-bottom: 6px;">할인</div>
<div style="color: #f03e3e; font-size: 16px; font-weight: 600;">-${tx.discount.toLocaleString()}원</div>
</div>
<div>
<div style="color: #868e96; font-size: 13px; margin-bottom: 6px;">판매 금액</div>
<div style="color: #6366f1; font-size: 18px; font-weight: 700;">${tx.sale_amount.toLocaleString()}원</div>
</div>
<div>
<div style="color: #868e96; font-size: 13px; margin-bottom: 6px;">외상</div>
<div style="color: #212529; font-size: 16px; font-weight: 600;">${tx.credit.toLocaleString()}원</div>
</div>
<div>
<div style="color: #868e96; font-size: 13px; margin-bottom: 6px;">수금</div>
<div style="color: #37b24d; font-size: 16px; font-weight: 600;">${tx.received.toLocaleString()}원</div>
</div>
</div>
</div>
<div style="margin-bottom: 16px; font-size: 18px; font-weight: 700; color: #212529;">판매 상품 (${items.length}개)</div>
<table style="width: 100%; border-collapse: collapse;">
<thead>
<tr style="background: #f8f9fa; border-bottom: 2px solid #e9ecef;">
<th style="padding: 12px; text-align: left; font-size: 13px; color: #495057; font-weight: 600;">상품코드</th>
<th style="padding: 12px; text-align: left; font-size: 13px; color: #495057; font-weight: 600;">상품명</th>
<th style="padding: 12px; text-align: right; font-size: 13px; color: #495057; font-weight: 600;">수량</th>
<th style="padding: 12px; text-align: right; font-size: 13px; color: #495057; font-weight: 600;">단가</th>
<th style="padding: 12px; text-align: right; font-size: 13px; color: #495057; font-weight: 600;">합계</th>
</tr>
</thead>
<tbody>
`;
items.forEach(item => {
html += `
<tr style="border-bottom: 1px solid #f1f3f5;">
<td style="padding: 14px; font-size: 14px; color: #495057;">${item.code}</td>
<td style="padding: 14px; font-size: 14px; color: #212529; font-weight: 500;">${item.name}</td>
<td style="padding: 14px; text-align: right; font-size: 14px; color: #495057;">${item.qty}</td>
<td style="padding: 14px; text-align: right; font-size: 14px; color: #495057;">${item.price.toLocaleString()}원</td>
<td style="padding: 14px; text-align: right; font-size: 14px; color: #6366f1; font-weight: 600;">${item.total.toLocaleString()}원</td>
</tr>
`;
});
html += `
</tbody>
</table>
`;
document.getElementById('transactionContent').innerHTML = html;
}
function closeModal() {
document.getElementById('transactionModal').style.display = 'none';
}
// ESC 키로 모달 닫기
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
closeModal();
}
});
// 모달 배경 클릭 시 닫기
document.getElementById('transactionModal').addEventListener('click', function(e) {
if (e.target === this) {
closeModal();
}
});
</script>
</body>
</html>

View File

@ -0,0 +1,506 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>포인트 적립 - 청춘약국</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: #f5f7fa;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 16px;
-webkit-font-smoothing: antialiased;
}
.app-container {
background: #ffffff;
border-radius: 24px;
max-width: 420px;
width: 100%;
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
overflow: hidden;
}
.header {
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
padding: 32px 24px 140px 24px;
position: relative;
}
.header::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 120px;
background: #ffffff;
border-radius: 32px 32px 0 0;
}
.header-content {
position: relative;
z-index: 2;
}
.pharmacy-name {
color: rgba(255, 255, 255, 0.9);
font-size: 15px;
font-weight: 500;
letter-spacing: -0.2px;
margin-bottom: 4px;
}
.header-title {
color: #ffffff;
font-size: 26px;
font-weight: 700;
letter-spacing: -0.5px;
}
.card {
background: #ffffff;
border-radius: 20px;
padding: 24px;
margin: -100px 24px 24px 24px;
position: relative;
z-index: 3;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}
.receipt-amount {
text-align: center;
padding: 24px 0;
border-bottom: 1px solid #f1f3f5;
margin-bottom: 24px;
}
.amount-label {
color: #868e96;
font-size: 13px;
font-weight: 500;
margin-bottom: 8px;
letter-spacing: -0.2px;
}
.amount-value {
color: #212529;
font-size: 32px;
font-weight: 700;
letter-spacing: -1px;
margin-bottom: 16px;
}
.points-badge {
display: inline-flex;
align-items: center;
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
color: #ffffff;
padding: 10px 20px;
border-radius: 100px;
font-size: 15px;
font-weight: 600;
letter-spacing: -0.3px;
}
.points-badge::before {
content: '+ ';
margin-right: 2px;
}
.form-section {
padding: 8px 0;
}
.input-group {
margin-bottom: 20px;
}
.input-group label {
display: block;
color: #495057;
font-size: 14px;
font-weight: 600;
margin-bottom: 10px;
letter-spacing: -0.2px;
}
.input-wrapper {
position: relative;
}
.input-wrapper input {
width: 100%;
padding: 16px 18px;
border: 2px solid #e9ecef;
border-radius: 14px;
font-size: 16px;
font-weight: 500;
transition: all 0.2s ease;
letter-spacing: -0.3px;
background: #f8f9fa;
}
.input-wrapper input:focus {
outline: none;
border-color: #6366f1;
background: #ffffff;
box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}
.input-wrapper input::placeholder {
color: #adb5bd;
font-weight: 400;
}
.btn-submit {
width: 100%;
padding: 18px;
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
color: #ffffff;
border: none;
border-radius: 14px;
font-size: 17px;
font-weight: 700;
cursor: pointer;
margin-top: 12px;
letter-spacing: -0.3px;
transition: all 0.2s ease;
box-shadow: 0 4px 16px rgba(99, 102, 241, 0.24);
}
.btn-submit:active {
transform: scale(0.98);
}
.btn-submit:disabled {
background: #dee2e6;
box-shadow: none;
cursor: not-allowed;
}
.alert {
margin-top: 16px;
padding: 14px 16px;
border-radius: 12px;
font-size: 14px;
font-weight: 500;
display: none;
letter-spacing: -0.2px;
}
.alert.error {
background: #ffe3e3;
color: #c92a2a;
}
/* 성공 화면 */
.success-screen {
display: none;
padding: 24px;
text-align: center;
}
.success-icon-wrap {
width: 96px;
height: 96px;
margin: 40px auto 24px auto;
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.success-icon-wrap svg {
width: 48px;
height: 48px;
stroke: #ffffff;
stroke-width: 3;
stroke-linecap: round;
stroke-linejoin: round;
fill: none;
animation: checkmark 0.6s ease-in-out 0.2s both;
}
@keyframes scaleIn {
0% { transform: scale(0); opacity: 0; }
100% { transform: scale(1); opacity: 1; }
}
@keyframes checkmark {
0% { stroke-dashoffset: 100; }
100% { stroke-dashoffset: 0; }
}
.success-title {
color: #212529;
font-size: 24px;
font-weight: 700;
margin-bottom: 12px;
letter-spacing: -0.5px;
}
.success-points {
color: #6366f1;
font-size: 48px;
font-weight: 700;
margin: 24px 0 16px 0;
letter-spacing: -1.5px;
}
.success-balance {
color: #868e96;
font-size: 15px;
font-weight: 500;
margin-bottom: 32px;
letter-spacing: -0.2px;
}
.success-balance strong {
color: #495057;
font-weight: 700;
}
.button-group {
display: flex;
gap: 12px;
margin-top: 24px;
}
.btn-secondary {
flex: 1;
padding: 16px;
background: #f8f9fa;
color: #495057;
border: 2px solid #e9ecef;
border-radius: 14px;
font-size: 15px;
font-weight: 600;
text-decoration: none;
display: inline-flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
letter-spacing: -0.2px;
}
.btn-secondary:active {
transform: scale(0.98);
background: #e9ecef;
}
.btn-primary {
flex: 1;
padding: 16px;
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
color: #ffffff;
border: none;
border-radius: 14px;
font-size: 15px;
font-weight: 600;
text-decoration: none;
display: inline-flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
letter-spacing: -0.2px;
}
.btn-primary:active {
transform: scale(0.98);
}
/* 모바일 최적화 */
@media (max-width: 480px) {
body {
padding: 0;
}
.app-container {
border-radius: 0;
min-height: 100vh;
}
.header {
padding-top: 48px;
}
}
</style>
</head>
<body>
<div class="app-container">
<div class="header">
<div class="header-content">
<div class="pharmacy-name">청춘약국</div>
<div class="header-title">포인트 적립</div>
</div>
</div>
<!-- 적립 폼 -->
<div id="claimForm">
<div class="card">
<div class="receipt-amount">
<div class="amount-label">구매 금액</div>
<div class="amount-value">{{ "{:,}".format(token_info.total_amount) }}원</div>
<div class="points-badge">{{ "{:,}".format(token_info.claimable_points) }}P 적립</div>
</div>
<form id="formClaim" class="form-section">
<div class="input-group">
<label for="phone">전화번호</label>
<div class="input-wrapper">
<input type="tel" id="phone" name="phone"
placeholder="010-0000-0000"
pattern="[0-9-]*"
autocomplete="tel"
required>
</div>
</div>
<div class="input-group">
<label for="name">이름</label>
<div class="input-wrapper">
<input type="text" id="name" name="name"
placeholder="이름을 입력하세요"
autocomplete="name"
required>
</div>
</div>
<button type="submit" class="btn-submit" id="btnSubmit">
포인트 적립하기
</button>
</form>
<div class="alert error" id="alertMsg"></div>
</div>
</div>
<!-- 성공 화면 -->
<div id="successScreen" class="success-screen">
<div class="success-icon-wrap">
<svg viewBox="0 0 52 52" style="stroke-dasharray: 100; stroke-dashoffset: 100;">
<path d="M14.1 27.2l7.1 7.2 16.7-16.8"/>
</svg>
</div>
<div class="success-title">적립 완료!</div>
<div class="success-points" id="successPoints">0P</div>
<div class="success-balance">
총 포인트 <strong id="successBalance">0P</strong>
</div>
<div class="button-group">
<a href="/" class="btn-secondary">홈으로</a>
<a href="#" class="btn-primary" id="btnMyPage">내역 보기</a>
</div>
</div>
</div>
<script>
const tokenInfo = {
transaction_id: '{{ token_info.transaction_id }}',
nonce: '{{ request.args.get("t").split(":")[1] }}'
};
const form = document.getElementById('formClaim');
const btnSubmit = document.getElementById('btnSubmit');
const alertMsg = document.getElementById('alertMsg');
const claimFormDiv = document.getElementById('claimForm');
const successScreen = document.getElementById('successScreen');
// 전화번호 자동 하이픈
const phoneInput = document.getElementById('phone');
phoneInput.addEventListener('input', function(e) {
let value = e.target.value.replace(/[^0-9]/g, '');
if (value.length <= 3) {
e.target.value = value;
} else if (value.length <= 7) {
e.target.value = value.slice(0, 3) + '-' + value.slice(3);
} else {
e.target.value = value.slice(0, 3) + '-' + value.slice(3, 7) + '-' + value.slice(7, 11);
}
});
// 폼 제출
form.addEventListener('submit', async function(e) {
e.preventDefault();
const phone = document.getElementById('phone').value.trim();
const name = document.getElementById('name').value.trim();
if (!phone || !name) {
showAlert('전화번호와 이름을 모두 입력해주세요.');
return;
}
btnSubmit.disabled = true;
btnSubmit.textContent = '처리 중...';
alertMsg.style.display = 'none';
try {
const response = await fetch('/api/claim', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
transaction_id: tokenInfo.transaction_id,
nonce: tokenInfo.nonce,
phone: phone,
name: name
})
});
const data = await response.json();
if (data.success) {
showSuccess(data.points, data.balance, phone);
} else {
showAlert(data.message);
btnSubmit.disabled = false;
btnSubmit.textContent = '포인트 적립하기';
}
} catch (error) {
showAlert('네트워크 오류가 발생했습니다.');
btnSubmit.disabled = false;
btnSubmit.textContent = '포인트 적립하기';
}
});
function showAlert(msg) {
alertMsg.textContent = msg;
alertMsg.style.display = 'block';
setTimeout(() => {
alertMsg.style.display = 'none';
}, 5000);
}
function showSuccess(points, balance, phone) {
claimFormDiv.style.display = 'none';
document.getElementById('successPoints').textContent = points.toLocaleString() + 'P';
document.getElementById('successBalance').textContent = balance.toLocaleString() + 'P';
document.getElementById('btnMyPage').href = '/my-page?phone=' + encodeURIComponent(phone);
successScreen.style.display = 'block';
}
</script>
</body>
</html>

View File

@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>오류 - 청춘약국</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: #f5f7fa;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 16px;
-webkit-font-smoothing: antialiased;
}
.error-container {
background: #ffffff;
border-radius: 24px;
padding: 48px 32px;
max-width: 420px;
width: 100%;
text-align: center;
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}
.error-icon {
width: 80px;
height: 80px;
margin: 0 auto 24px auto;
background: linear-gradient(135deg, #f03e3e 0%, #d6336c 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 40px;
}
.error-title {
color: #212529;
font-size: 24px;
font-weight: 700;
margin-bottom: 16px;
letter-spacing: -0.5px;
}
.error-message {
color: #868e96;
font-size: 15px;
font-weight: 500;
line-height: 1.6;
margin-bottom: 32px;
letter-spacing: -0.2px;
}
.btn-home {
display: inline-block;
padding: 16px 32px;
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
color: #ffffff;
text-decoration: none;
border-radius: 14px;
font-size: 16px;
font-weight: 600;
letter-spacing: -0.2px;
transition: all 0.2s ease;
box-shadow: 0 4px 16px rgba(99, 102, 241, 0.24);
}
.btn-home:active {
transform: scale(0.98);
}
</style>
</head>
<body>
<div class="error-container">
<div class="error-icon">⚠️</div>
<div class="error-title">문제가 발생했어요</div>
<div class="error-message">{{ message }}</div>
<a href="/" class="btn-home">홈으로 이동</a>
</div>
</body>
</html>

View File

@ -0,0 +1,262 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>마이페이지 - 청춘약국</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: #f5f7fa;
min-height: 100vh;
-webkit-font-smoothing: antialiased;
}
.app-container {
background: #ffffff;
min-height: 100vh;
max-width: 420px;
margin: 0 auto;
}
.header {
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
padding: 48px 24px 32px 24px;
color: #ffffff;
}
.header-top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
}
.header-title {
font-size: 20px;
font-weight: 700;
letter-spacing: -0.3px;
}
.btn-logout {
color: rgba(255, 255, 255, 0.9);
font-size: 14px;
font-weight: 500;
text-decoration: none;
letter-spacing: -0.2px;
}
.user-info {
text-align: center;
padding: 20px 0;
}
.user-name {
font-size: 24px;
font-weight: 700;
margin-bottom: 8px;
letter-spacing: -0.5px;
}
.user-phone {
font-size: 15px;
opacity: 0.9;
font-weight: 500;
letter-spacing: -0.2px;
}
.balance-card {
background: rgba(255, 255, 255, 0.95);
border-radius: 20px;
padding: 32px 24px;
margin: -40px 24px 24px 24px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
text-align: center;
}
.balance-label {
color: #868e96;
font-size: 14px;
font-weight: 500;
margin-bottom: 12px;
letter-spacing: -0.2px;
}
.balance-amount {
color: #6366f1;
font-size: 48px;
font-weight: 700;
letter-spacing: -1.5px;
margin-bottom: 8px;
}
.balance-desc {
color: #868e96;
font-size: 13px;
font-weight: 500;
letter-spacing: -0.2px;
}
.section {
padding: 24px;
}
.section-title {
color: #212529;
font-size: 18px;
font-weight: 700;
margin-bottom: 16px;
letter-spacing: -0.3px;
}
.transaction-list {
list-style: none;
}
.transaction-item {
background: #ffffff;
border: 1px solid #e9ecef;
border-radius: 16px;
padding: 20px;
margin-bottom: 12px;
transition: all 0.2s ease;
}
.transaction-item:active {
transform: scale(0.98);
background: #f8f9fa;
}
.transaction-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
.transaction-reason {
color: #495057;
font-size: 15px;
font-weight: 600;
letter-spacing: -0.2px;
}
.transaction-points {
color: #6366f1;
font-size: 18px;
font-weight: 700;
letter-spacing: -0.3px;
}
.transaction-points.positive::before {
content: '+';
}
.transaction-desc {
color: #868e96;
font-size: 13px;
font-weight: 500;
margin-bottom: 8px;
letter-spacing: -0.2px;
}
.transaction-date {
color: #adb5bd;
font-size: 12px;
font-weight: 500;
letter-spacing: -0.2px;
}
.empty-state {
text-align: center;
padding: 60px 20px;
color: #868e96;
}
.empty-icon {
font-size: 64px;
margin-bottom: 16px;
opacity: 0.5;
}
.empty-text {
font-size: 15px;
font-weight: 500;
letter-spacing: -0.2px;
}
/* 모바일 최적화 */
@media (max-width: 480px) {
.header {
padding-top: 60px;
}
}
</style>
</head>
<body>
<div class="app-container">
<div class="header">
<div class="header-top">
<div class="header-title">마이페이지</div>
<a href="/my-page" class="btn-logout">다른 번호로 조회</a>
</div>
<div class="user-info">
<div class="user-name">{{ user.nickname }}님</div>
<div class="user-phone">{{ user.phone[:3] }}-{{ user.phone[3:7] }}-{{ user.phone[7:] if user.phone|length > 7 else '' }}</div>
</div>
</div>
<div class="balance-card">
<div class="balance-label">보유 포인트</div>
<div class="balance-amount">{{ "{:,}".format(user.mileage_balance) }}P</div>
<div class="balance-desc">약국에서 1P = 1원으로 사용 가능</div>
</div>
<div class="section">
<div class="section-title">적립 내역</div>
{% if transactions %}
<ul class="transaction-list">
{% for tx in transactions %}
<li class="transaction-item">
<div class="transaction-header">
<div class="transaction-reason">
{% if tx.reason == 'CLAIM' %}
영수증 적립
{% elif tx.reason == 'USE' %}
포인트 사용
{% else %}
{{ tx.reason }}
{% endif %}
</div>
<div class="transaction-points {% if tx.points > 0 %}positive{% endif %}">
{{ "{:,}".format(tx.points) }}P
</div>
</div>
{% if tx.description %}
<div class="transaction-desc">{{ tx.description }}</div>
{% endif %}
<div class="transaction-date">{{ tx.created_at[:16].replace('T', ' ') }}</div>
</li>
{% endfor %}
</ul>
{% else %}
<div class="empty-state">
<div class="empty-icon">📭</div>
<div class="empty-text">아직 적립 내역이 없습니다</div>
</div>
{% endif %}
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,183 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>마이페이지 - 청춘약국</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: #f5f7fa;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 16px;
-webkit-font-smoothing: antialiased;
}
.login-container {
background: #ffffff;
border-radius: 24px;
padding: 48px 32px;
max-width: 420px;
width: 100%;
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}
.header {
text-align: center;
margin-bottom: 40px;
}
.logo {
width: 64px;
height: 64px;
margin: 0 auto 20px auto;
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
border-radius: 20px;
display: flex;
align-items: center;
justify-content: center;
font-size: 32px;
}
.header-title {
color: #212529;
font-size: 24px;
font-weight: 700;
margin-bottom: 8px;
letter-spacing: -0.5px;
}
.header-subtitle {
color: #868e96;
font-size: 15px;
font-weight: 500;
letter-spacing: -0.2px;
}
.form-group {
margin-bottom: 24px;
}
.form-group label {
display: block;
color: #495057;
font-size: 14px;
font-weight: 600;
margin-bottom: 10px;
letter-spacing: -0.2px;
}
.form-group input {
width: 100%;
padding: 16px 18px;
border: 2px solid #e9ecef;
border-radius: 14px;
font-size: 16px;
font-weight: 500;
transition: all 0.2s ease;
letter-spacing: -0.3px;
background: #f8f9fa;
}
.form-group input:focus {
outline: none;
border-color: #6366f1;
background: #ffffff;
box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}
.form-group input::placeholder {
color: #adb5bd;
font-weight: 400;
}
.btn-submit {
width: 100%;
padding: 18px;
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
color: #ffffff;
border: none;
border-radius: 14px;
font-size: 17px;
font-weight: 700;
cursor: pointer;
letter-spacing: -0.3px;
transition: all 0.2s ease;
box-shadow: 0 4px 16px rgba(99, 102, 241, 0.24);
}
.btn-submit:active {
transform: scale(0.98);
}
.btn-back {
display: block;
text-align: center;
margin-top: 20px;
color: #6366f1;
text-decoration: none;
font-size: 15px;
font-weight: 500;
letter-spacing: -0.2px;
}
.btn-back:active {
color: #8b5cf6;
}
</style>
</head>
<body>
<div class="login-container">
<div class="header">
<div class="logo">📱</div>
<div class="header-title">마이페이지</div>
<div class="header-subtitle">전화번호로 포인트 조회</div>
</div>
<form method="GET" action="/my-page">
<div class="form-group">
<label for="phone">전화번호</label>
<input type="tel" id="phone" name="phone"
placeholder="010-0000-0000"
pattern="[0-9-]*"
autocomplete="tel"
required>
</div>
<button type="submit" class="btn-submit">
조회하기
</button>
</form>
<a href="/" class="btn-back">← 홈으로</a>
</div>
<script>
// 전화번호 자동 하이픈
const phoneInput = document.getElementById('phone');
phoneInput.addEventListener('input', function(e) {
let value = e.target.value.replace(/[^0-9]/g, '');
if (value.length <= 3) {
e.target.value = value;
} else if (value.length <= 7) {
e.target.value = value.slice(0, 3) + '-' + value.slice(3);
} else {
e.target.value = value.slice(0, 3) + '-' + value.slice(3, 7) + '-' + value.slice(7, 11);
}
});
</script>
</body>
</html>