pharmacy-pos-qr-system/backend/templates/my_page.html
시골약사 59a33cc249 feat: 포인트 사용 기능 및 시간 표시 개선
- UTC to KST 시간 변환 로직 추가 (SQLite 저장 시간 표시용)
- 관리자 페이지에 포인트 사용(차감) 기능 추가
  - 사용자 상세 모달에 "포인트 사용" 버튼 추가
  - 포인트 입력 및 차감 처리
  - 마일리지 원장에 USE 타입으로 기록
- 구매 이력 시간을 MSSQL의 실제 거래 시간(InsertTime)으로 수정
- 선택적 시간 변환 적용
  - 변환: users.created_at, mileage_ledger.created_at, claim_tokens.created_at
  - 미변환: claim_tokens.claimed_at, MSSQL 거래 시간
- 관리자 페이지에 검색 기능 추가 (사이드바)
  - 사용자 검색 (이름, 전화번호, 뒷자리)
  - 제품 검색 (약품명으로 구매자 조회)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-23 21:54:12 +09:00

263 lines
7.3 KiB
HTML

<!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 }}</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>