pharmacy-pos-qr-system/backend/templates/my_page.html
thug0bin 82220a4a44 feat: GUI 칼럼 설정 저장, 010 전화번호 UX 개선, 품목 상세 조회
- GUI: SALES_COLUMNS 상수 정의, 칼럼 폭/윈도우 위치 gui_settings.json에 저장
- 전화번호 입력: 적립페이지/마이페이지에서 010 고정 + 뒷번호만 입력
- 적립페이지: MSSQL SALE_SUB에서 구매 품목 조회 및 토글 표시
- 마이페이지: 적립 내역 탭 시 품목 상세 AJAX 조회 (캐시 적용)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 01:17:45 +09:00

376 lines
11 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;
}
/* 품목 상세 */
.transaction-item.clickable {
cursor: pointer;
}
.item-detail {
display: none;
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid #f1f3f5;
}
.item-detail.open {
display: block;
}
.item-detail-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 6px 0;
font-size: 13px;
}
.item-detail-name {
color: #495057;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-right: 8px;
}
.item-detail-qty {
color: #868e96;
margin-right: 10px;
white-space: nowrap;
}
.item-detail-price {
color: #212529;
font-weight: 600;
white-space: nowrap;
}
.item-detail-loading {
text-align: center;
color: #adb5bd;
font-size: 13px;
padding: 8px 0;
}
.item-detail-hint {
color: #adb5bd;
font-size: 11px;
margin-top: 4px;
}
/* 모바일 최적화 */
@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 {% if tx.transaction_id %}clickable{% endif %}"
{% if tx.transaction_id %}onclick="toggleDetail(this, '{{ tx.transaction_id }}')"{% endif %}>
<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 }}
{% if tx.transaction_id %}
<span class="item-detail-hint">탭하여 품목 보기</span>
{% endif %}
</div>
<div class="item-detail" id="detail-{{ tx.transaction_id }}"></div>
</li>
{% endfor %}
</ul>
{% else %}
<div class="empty-state">
<div class="empty-icon">📭</div>
<div class="empty-text">아직 적립 내역이 없습니다</div>
</div>
{% endif %}
</div>
</div>
<script>
const detailCache = {};
async function toggleDetail(el, txId) {
const detail = document.getElementById('detail-' + txId);
if (!detail) return;
// 이미 열려있으면 닫기
if (detail.classList.contains('open')) {
detail.classList.remove('open');
return;
}
// 캐시에 있으면 바로 표시
if (detailCache[txId]) {
detail.innerHTML = detailCache[txId];
detail.classList.add('open');
return;
}
// 로딩 표시
detail.innerHTML = '<div class="item-detail-loading">품목 조회 중...</div>';
detail.classList.add('open');
try {
const res = await fetch('/admin/transaction/' + txId);
const data = await res.json();
if (data.success && data.items && data.items.length > 0) {
let html = '';
data.items.forEach(item => {
html += `<div class="item-detail-row">
<span class="item-detail-name">${item.name}</span>
<span class="item-detail-qty">${item.qty}개</span>
<span class="item-detail-price">${item.total.toLocaleString()}원</span>
</div>`;
});
detailCache[txId] = html;
detail.innerHTML = html;
} else {
detail.innerHTML = '<div class="item-detail-loading">품목 정보를 불러올 수 없습니다</div>';
}
} catch (e) {
detail.innerHTML = '<div class="item-detail-loading">조회 실패</div>';
}
}
</script>
</body>
</html>