194 lines
8.1 KiB
HTML
194 lines
8.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<title>数据修正 - IMC益选便利店</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
|
<style>
|
|
:root {
|
|
--primary: #22d3ee; /* cyan-400 */
|
|
--primary-dim: rgba(34, 211, 238, 0.1);
|
|
--bg-dark: #0b1121;
|
|
}
|
|
body { background-color: var(--bg-dark); color: #e2e8f0; font-family: 'Inter', system-ui, sans-serif; }
|
|
|
|
/* Tech Background Grid - Toned down */
|
|
.bg-tech-grid {
|
|
background-size: 40px 40px;
|
|
background-image:
|
|
linear-gradient(to right, rgba(34, 211, 238, 0.03) 1px, transparent 1px),
|
|
linear-gradient(to bottom, rgba(34, 211, 238, 0.03) 1px, transparent 1px);
|
|
mask-image: radial-gradient(circle at center, black 30%, transparent 100%);
|
|
}
|
|
|
|
/* Glass Tech Panel - Toned down */
|
|
.glass-panel {
|
|
background: rgba(15, 23, 42, 0.85);
|
|
backdrop-filter: blur(8px);
|
|
-webkit-backdrop-filter: blur(8px);
|
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
}
|
|
|
|
/* Typography & Effects */
|
|
.text-glow { text-shadow: 0 0 5px rgba(34, 211, 238, 0.3); }
|
|
.font-mono-tech { font-family: 'JetBrains Mono', 'Consolas', monospace; }
|
|
|
|
.btn-tech {
|
|
background: rgba(30, 41, 59, 0.8);
|
|
border: 1px solid rgba(148, 163, 184, 0.2);
|
|
color: #94a3b8;
|
|
transition: all 0.2s ease;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.05em;
|
|
}
|
|
.btn-tech:hover {
|
|
background: rgba(34, 211, 238, 0.1);
|
|
border-color: var(--primary);
|
|
color: var(--primary);
|
|
box-shadow: 0 0 10px rgba(34, 211, 238, 0.1);
|
|
}
|
|
|
|
.input-tech {
|
|
background: rgba(15, 23, 42, 0.6);
|
|
border: 1px solid rgba(148, 163, 184, 0.2);
|
|
color: #e2e8f0;
|
|
transition: all 0.2s ease;
|
|
}
|
|
.input-tech:focus {
|
|
outline: none;
|
|
border-color: var(--primary);
|
|
box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.2);
|
|
background: rgba(15, 23, 42, 0.8);
|
|
}
|
|
|
|
/* Scrollbar */
|
|
::-webkit-scrollbar { width: 6px; height: 6px; }
|
|
::-webkit-scrollbar-track { background: #0b1121; }
|
|
::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 3px; border: 1px solid #334155; }
|
|
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
|
|
</style>
|
|
</head>
|
|
<body class="antialiased min-h-screen bg-slate-900 selection:bg-cyan-500 selection:text-white overflow-x-hidden flex items-center justify-center">
|
|
<!-- Tech Background Layers -->
|
|
<div class="fixed inset-0 bg-[url('https://tailwindcss.com/img/beams-home@95.jpg')] bg-cover bg-center opacity-20 pointer-events-none"></div>
|
|
<div class="fixed inset-0 bg-tech-grid pointer-events-none z-0"></div>
|
|
<div class="fixed inset-0 bg-gradient-to-b from-slate-900/50 via-slate-900/20 to-slate-900/80 pointer-events-none z-0"></div>
|
|
|
|
<div class="relative z-10 w-full max-w-md p-4">
|
|
<div class="glass-panel p-6 rounded-lg">
|
|
<div class="flex items-center justify-between mb-6">
|
|
<h1 class="text-xl font-bold tracking-wider text-white text-glow flex items-center gap-2">
|
|
<span class="w-1.5 h-6 bg-cyan-400 rounded-full shadow-[0_0_8px_#22d3ee]"></span>
|
|
数据修正控制台
|
|
</h1>
|
|
<a href="/" class="text-xs text-slate-500 hover:text-cyan-400 transition-colors font-mono">< 返回看板</a>
|
|
</div>
|
|
|
|
<div class="space-y-4">
|
|
<div>
|
|
<label class="block text-xs font-bold text-slate-400 mb-1.5 uppercase tracking-wider">日期 / DATE</label>
|
|
<input id="date" type="date" class="input-tech w-full px-3 py-2 rounded text-sm font-mono-tech" />
|
|
</div>
|
|
<div>
|
|
<label class="block text-xs font-bold text-slate-400 mb-1.5 uppercase tracking-wider">金额 / AMOUNT</label>
|
|
<div class="relative">
|
|
<span class="absolute left-3 top-2 text-slate-500">¥</span>
|
|
<input id="amount" type="number" step="0.01" class="input-tech w-full pl-7 pr-3 py-2 rounded text-sm font-mono-tech" placeholder="0.00" />
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<label class="block text-xs font-bold text-slate-400 mb-1.5 uppercase tracking-wider">原因 / REASON</label>
|
|
<input id="reason" type="text" class="input-tech w-full px-3 py-2 rounded text-sm" placeholder="例如:手动调整入账" />
|
|
</div>
|
|
<div>
|
|
<label class="block text-xs font-bold text-slate-400 mb-1.5 uppercase tracking-wider">管理口令 / ADMIN TOKEN</label>
|
|
<div class="flex gap-2">
|
|
<input id="token" type="password" class="input-tech flex-1 px-3 py-2 rounded text-sm font-mono-tech" placeholder="输入 .env 中的口令" />
|
|
<button id="toggle" type="button" class="btn-tech px-3 py-2 rounded text-xs whitespace-nowrap">显示</button>
|
|
</div>
|
|
</div>
|
|
|
|
<button id="submit" class="w-full mt-2 bg-cyan-600/20 border border-cyan-500/50 text-cyan-400 hover:bg-cyan-500/20 hover:border-cyan-400 hover:shadow-[0_0_15px_rgba(34,211,238,0.2)] transition-all duration-300 py-2.5 rounded text-sm font-bold tracking-widest uppercase">
|
|
提交修正 / SUBMIT
|
|
</button>
|
|
|
|
<div id="msg" class="text-xs mt-3 font-mono text-center min-h-[1.5em]"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
function post(url, data, headers){
|
|
return fetch(url,{method:'PUT',headers:Object.assign({'Content-Type':'application/json'},headers||{}),body:JSON.stringify(data)});
|
|
}
|
|
|
|
// Auto fill today
|
|
document.getElementById('date').valueAsDate = new Date();
|
|
|
|
document.getElementById('toggle').addEventListener('click', (e)=>{
|
|
const el = document.getElementById('token');
|
|
const btn = e.target;
|
|
if (el.type === 'password') {
|
|
el.type = 'text';
|
|
btn.textContent = '隐藏';
|
|
btn.classList.add('text-cyan-300');
|
|
} else {
|
|
el.type = 'password';
|
|
btn.textContent = '显示';
|
|
btn.classList.remove('text-cyan-300');
|
|
}
|
|
});
|
|
|
|
document.getElementById('submit').addEventListener('click', async ()=>{
|
|
const btn = document.getElementById('submit');
|
|
const date = document.getElementById('date').value;
|
|
const amount = document.getElementById('amount').value;
|
|
const reason = document.getElementById('reason').value || 'manual_correct';
|
|
const token = document.getElementById('token').value;
|
|
const msg = document.getElementById('msg');
|
|
|
|
if(!date || !amount || !token){
|
|
msg.textContent = 'ERROR: 请填写完整信息 (Missing fields)';
|
|
msg.className='text-red-400 text-xs mt-3 font-mono text-center min-h-[1.5em]';
|
|
return;
|
|
}
|
|
if(isNaN(Number(amount))){
|
|
msg.textContent = 'ERROR: 金额格式错误 (Invalid Amount)';
|
|
msg.className='text-red-400 text-xs mt-3 font-mono text-center min-h-[1.5em]';
|
|
return;
|
|
}
|
|
|
|
// Loading state
|
|
const originText = btn.innerHTML;
|
|
btn.textContent = 'PROCESSING...';
|
|
btn.disabled = true;
|
|
btn.classList.add('opacity-50', 'cursor-not-allowed');
|
|
|
|
try{
|
|
const res = await post('/api/admin/turnover',{date,amount:Number(amount),reason},{'X-Admin-Token':token});
|
|
const ok = res.ok;
|
|
if(ok){
|
|
msg.textContent = 'SUCCESS: 数据已修正,面板将同步更新';
|
|
msg.className='text-green-400 text-xs mt-3 font-mono text-center min-h-[1.5em]';
|
|
// Reset amount
|
|
document.getElementById('amount').value = '';
|
|
}
|
|
else {
|
|
const t = await res.text();
|
|
msg.textContent = 'FAILED: ' + t;
|
|
msg.className='text-red-400 text-xs mt-3 font-mono text-center min-h-[1.5em]';
|
|
}
|
|
}catch(e){
|
|
msg.textContent = 'NETWORK ERROR: '+e;
|
|
msg.className='text-red-400 text-xs mt-3 font-mono text-center min-h-[1.5em]';
|
|
} finally {
|
|
btn.innerHTML = originText;
|
|
btn.disabled = false;
|
|
btn.classList.remove('opacity-50', 'cursor-not-allowed');
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|