Files
dukang/pages/user/14_餐券核销页_5c456aac/code.html
T
2026-06-30 10:33:56 +08:00

332 lines
16 KiB
HTML

<!DOCTYPE html><html lang="zh-CN" style=""><head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&amp;display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Manrope:wght@600;700&amp;family=Be+Vietnam+Pro:wght@400&amp;family=Inter:wght@500&amp;display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&amp;display=swap" rel="stylesheet">
<style>
.material-symbols-outlined {
font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.coupon-notch {
position: relative;
}
.coupon-notch::before, .coupon-notch::after {
content: '';
position: absolute;
top: 50%;
width: 16px;
height: 16px;
background-color: #faf9f7;
border-radius: 50%;
transform: translateY(-50%);
}
.coupon-notch::before { left: -8px; }
.coupon-notch::after { right: -8px; }
.glass-panel {
background: rgba(255, 255, 255, 0.8);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
.number-input::-webkit-inner-spin-button,
.number-input::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
@keyframes pulse-red {
0% { box-shadow: 0 0 0 0 rgba(166, 29, 36, 0.2); }
70% { box-shadow: 0 0 0 10px rgba(166, 29, 36, 0); }
100% { box-shadow: 0 0 0 0 rgba(166, 29, 36, 0); }
}
.active-timer {
animation: pulse-red 2s infinite;
}
</style>
<script id="tailwind-config">
tailwind.config = {
darkMode: "class",
theme: {
extend: {
"colors": {
"on-surface-variant": "#5a413f",
"on-secondary-fixed-variant": "#574500",
"secondary-fixed-dim": "#e9c349",
"aged-amber": "#FFBF00",
"on-background": "#1a1c1b",
"tertiary-fixed": "#dae5dd",
"status-blue": "#2A6EBB",
"background": "#faf9f7",
"on-primary-fixed": "#410004",
"on-tertiary-fixed": "#141e19",
"surface-container": "#efeeec",
"on-secondary-container": "#745c00",
"secondary-fixed": "#ffe088",
"tertiary-fixed-dim": "#bec9c2",
"inverse-primary": "#ffb3ae",
"surface": "#faf9f7",
"on-primary": "#ffffff",
"surface-tint": "#b3272c",
"primary": "#820012",
"tertiary-container": "#4e5852",
"primary-fixed": "#ffdad7",
"on-surface": "#1a1c1b",
"on-tertiary-fixed-variant": "#3f4943",
"error-container": "#ffdad6",
"outline-variant": "#e2bebc",
"primary-container": "#a61d24",
"surface-container-lowest": "#ffffff",
"on-primary-fixed-variant": "#910817",
"subtle-gray": "#999999",
"on-error-container": "#93000a",
"inverse-surface": "#2f3130",
"on-tertiary": "#ffffff",
"inverse-on-surface": "#f1f1ef",
"success-green": "#2D6A4F",
"surface-dim": "#dadad8",
"on-error": "#ffffff",
"on-tertiary-container": "#c2cdc6",
"tertiary": "#37413b",
"surface-container-highest": "#e3e2e0",
"heritage-red": "#A61D24",
"on-primary-container": "#ffb9b4",
"ink-black": "#1A1A1A",
"secondary": "#735c00",
"error": "#ba1a1a",
"secondary-container": "#fed65b",
"surface-bright": "#faf9f7",
"outline": "#8d706e",
"primary-fixed-dim": "#ffb3ae",
"surface-variant": "#e3e2e0",
"surface-container-low": "#f4f3f1",
"on-secondary-fixed": "#241a00",
"surface-container-high": "#e9e8e6",
"on-secondary": "#ffffff"
},
"borderRadius": {
"DEFAULT": "0.25rem",
"lg": "0.5rem",
"xl": "0.75rem",
"full": "9999px"
},
"spacing": {
"gutter-card": "12px",
"stack-lg": "32px",
"base": "8px",
"stack-md": "16px",
"margin-page": "20px",
"stack-sm": "4px"
},
"fontFamily": {
"headline-xl": ["Manrope"],
"headline-md": ["Manrope"],
"headline-lg-mobile": ["Manrope"],
"headline-lg": ["Manrope"],
"body-lg": ["Be Vietnam Pro"],
"body-md": ["Be Vietnam Pro"],
"coupon-amount": ["Manrope"],
"label-md": ["Inter"]
},
"fontSize": {
"headline-xl": ["32px", {"lineHeight": "40px", "letterSpacing": "-0.02em", "fontWeight": "700"}],
"headline-md": ["18px", {"lineHeight": "26px", "fontWeight": "600"}],
"headline-lg-mobile": ["20px", {"lineHeight": "28px", "fontWeight": "600"}],
"headline-lg": ["24px", {"lineHeight": "32px", "fontWeight": "600"}],
"body-lg": ["16px", {"lineHeight": "24px", "fontWeight": "400"}],
"body-md": ["14px", {"lineHeight": "20px", "fontWeight": "400"}],
"coupon-amount": ["28px", {"lineHeight": "28px", "fontWeight": "700"}],
"label-md": ["12px", {"lineHeight": "16px", "letterSpacing": "0.05em", "fontWeight": "500"}]
}
},
},
}
</script>
<style>
body {
min-height: max(884px, 100dvh);
}
</style>
</head>
<body class="bg-surface font-body-md text-on-surface selection:bg-heritage-red/20">
<!-- Top AppBar -->
<header class="bg-surface dark:bg-on-background w-full sticky top-0 flex items-center justify-between px-margin-page h-16 z-50 shadow-[0px_4px_20px_rgba(166,29,36,0.05)]">
<button class="hover:opacity-80 transition-opacity duration-200">
<span class="material-symbols-outlined text-heritage-red">arrow_back</span>
</button>
<h1 class="font-headline-lg-mobile text-headline-lg-mobile font-bold text-heritage-red">好客权益核销</h1>
<button class="hover:opacity-80 transition-opacity duration-200">
<span class="material-symbols-outlined text-heritage-red">help_outline</span>
</button>
</header>
<main class="px-margin-page py-stack-md pb-32">
<!-- Balance Card -->
<section class="mb-stack-lg">
<div class="relative overflow-hidden rounded-xl bg-primary-container p-stack-lg shadow-[0px_4px_20px_rgba(166,29,36,0.1)] text-on-primary-container">
<!-- Background texture/pattern -->
<div class="absolute inset-0 opacity-10 pointer-events-none" style="background-image: radial-gradient(circle at 2px 2px, white 1px, transparent 0); background-size: 24px 24px;"></div>
<div class="relative z-10 flex flex-col items-center text-center">
<span class="font-label-md text-label-md uppercase tracking-widest opacity-80 mb-2">当前好客权益可用余额</span>
<div class="flex items-baseline gap-1">
<span class="font-headline-lg text-headline-lg">¥</span>
<span class="font-headline-xl text-[48px] leading-none tracking-tight">500.00</span>
</div>
<div class="mt-4 flex gap-2">
</div>
</div>
</div>
</section>
<!-- Transaction Form -->
<div class="space-y-stack-md">
<!-- Store Selector -->
<!-- Amount Input -->
<div class="bg-surface-container-lowest rounded-xl p-6 shadow-[0px_4px_20px_rgba(166,29,36,0.05)] border border-surface-container-highest">
<label class="block font-label-md text-on-surface-variant mb-4">核销金额 (¥)</label>
<div class="flex items-center border-b-2 border-surface-container-highest focus-within:border-heritage-red transition-colors pb-2">
<span class="text-headline-xl text-ink-black mr-2">¥</span>
<input class="number-input w-full bg-transparent border-none focus:ring-0 text-[40px] font-bold text-ink-black placeholder:text-surface-container-highest h-16" placeholder="0.00" step="0.01" type="number">
</div>
<div class="mt-4 flex justify-between items-center text-label-md">
<span class="text-on-surface-variant">单次最高可核销 ¥500.00</span>
<button class="text-heritage-red font-bold">全部核销</button>
</div>
</div>
<!-- Action Button -->
<button class="w-full bg-heritage-red text-on-primary py-4 rounded-xl font-headline-md text-headline-md shadow-lg shadow-heritage-red/20 active:scale-95 transition-all flex items-center justify-center gap-2" id="generate-btn">
<span class="material-symbols-outlined">qr_code_2</span>
生成核销码
</button>
</div>
<!-- Security Notice -->
<div class="mt-stack-lg flex items-start gap-2 px-2">
<span class="material-symbols-outlined text-aged-amber text-[18px]">shield</span>
<p class="text-[12px] text-on-surface-variant leading-relaxed">
安全提示:请在核销前核实金额,核销码将在 5 分钟后自动失效。
</p>
</div>
</main>
<!-- QR Code Modal (Hidden by default) -->
<div class="fixed inset-0 z-[100] flex items-center justify-center p-margin-page opacity-0 pointer-events-none transition-all duration-300" id="qr-modal">
<div class="absolute inset-0 bg-ink-black/60 backdrop-blur-sm"></div>
<div class="relative w-full max-w-sm bg-surface-container-lowest rounded-2xl overflow-hidden shadow-2xl scale-90 transition-transform duration-300" id="qr-container">
<div class="p-6 text-center border-b border-surface-container">
<h3 class="font-headline-md text-headline-md text-heritage-red mb-1">正在核销</h3>
<p class="text-body-md text-on-surface-variant">请向收银员出示此码</p>
</div>
<div class="p-8 flex flex-col items-center">
<!-- QR Placeholder -->
<div class="relative p-3 border-4 border-heritage-red/10 rounded-xl mb-6">
<div class="w-48 h-48 bg-white flex items-center justify-center relative">
<img class="w-full h-full object-contain" data-alt="A clean, minimalist high-contrast digital QR code on a pristine white background. The QR code has a small circular logo in the center featuring a stylized Chinese character for 'Du'. The visual style is premium, sharp, and modern, illuminated by soft studio lighting with a slight heritage-red accent border around the code area." src="https://lh3.googleusercontent.com/aida-public/AB6AXuBOWO_blN4PtKLz6L9PsWbRPoG5Kl7BCROKAIfGW1cegiEfRUvcmEvOWAT5AbhgCgbXpzlfPmqFJ3GJS9vGzE7kimBIZMVPysnDOUc7vBPmsepAGy9-2DLpGIaa_j_cLS2ukP835eFXS3ER0n6uRhv7RV231q8Bx3ma_wgOkJPqnO9K8BXIfa21PaBo459_GfYQcfrJJVtu1YaL23eKLNG5dF4nhI0pbVY5jhMwbXtfa_R1_xyiG1CACH7zZpO2njENTEZvB-BrZ3s">
<!-- Scanning line animation -->
<div class="absolute inset-x-0 h-1 bg-heritage-red/40 shadow-[0_0_10px_rgba(166,29,36,0.5)] top-0 animate-[scan_3s_ease-in-out_infinite]"></div>
</div>
</div>
<div class="flex items-center gap-4 mb-4">
<div class="flex flex-col items-center">
<span class="text-headline-lg font-bold text-ink-black" id="timer">04:59</span>
<span class="text-[10px] text-on-surface-variant uppercase tracking-widest">失效倒计时</span>
</div>
</div>
<div class="w-full bg-surface-container-low rounded-lg p-3 text-center">
<p class="text-label-md text-on-surface-variant">待核销金额</p>
<p class="text-headline-md text-heritage-red">¥ <span id="confirm-amount" class="">200.00</span></p>
</div>
</div>
<button class="w-full py-4 bg-surface-container-highest text-ink-black font-bold hover:bg-surface-variant transition-colors" id="close-modal">
取消核销
</button>
</div>
</div>
<!-- Bottom Sheet Store Selector (Hidden by default) -->
<!-- Bottom Navigation -->
<script>
// Modal Logic
const generateBtn = document.getElementById('generate-btn');
const qrModal = document.getElementById('qr-modal');
const qrContainer = document.getElementById('qr-container');
const closeModal = document.getElementById('close-modal');
const amountInput = document.querySelector('input[type="number"]');
const confirmAmount = document.getElementById('confirm-amount');
generateBtn.addEventListener('click', () => {
const val = amountInput.value || "0.00";
confirmAmount.textContent = parseFloat(val).toFixed(2);
qrModal.classList.remove('opacity-0', 'pointer-events-none');
qrContainer.classList.remove('scale-90');
startTimer();
});
closeModal.addEventListener('click', () => {
qrModal.classList.add('opacity-0', 'pointer-events-none');
qrContainer.classList.add('scale-90');
stopTimer();
});
// Timer Logic
let timerInterval;
function startTimer() {
let seconds = 300;
const timerEl = document.getElementById('timer');
timerEl.parentElement.classList.add('active-timer');
timerInterval = setInterval(() => {
seconds--;
const mins = Math.floor(seconds / 60);
const secs = seconds % 60;
timerEl.textContent = `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
if (seconds <= 0) {
clearInterval(timerInterval);
alert('核销码已失效,请重新生成');
closeModal.click();
}
}, 1000);
}
function stopTimer() {
clearInterval(timerInterval);
document.getElementById('timer').textContent = "05:00";
document.getElementById('timer').parentElement.classList.remove('active-timer');
}
// Bottom Sheet Logic
function toggleBottomSheet() {
const sheet = document.getElementById('bottom-sheet');
const content = document.getElementById('sheet-content');
if (sheet.classList.contains('opacity-0')) {
sheet.classList.remove('opacity-0', 'pointer-events-none');
content.classList.remove('translate-y-full');
} else {
sheet.classList.add('opacity-0', 'pointer-events-none');
content.classList.add('translate-y-full');
}
}
// Simple keyframe for scanning line (embedded in HTML style above)
</script>
<style>
@keyframes scan {
0%, 100% { top: 0%; opacity: 0.1; }
50% { top: 95%; opacity: 0.8; }
}
.pb-safe {
padding-bottom: env(safe-area-inset-bottom);
}
</style>
</body></html>