HEL-327: apply frost-obsidian day/night theme across the live PHP UI.

Replace the old teal top-nav shell with the fusion sidebar layout, token CSS, and HEL-325 logos without changing business rules, APIs, or calculator formulas.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
施工员
2026-09-01 09:26:15 +08:00
co-authored by Cursor multica-agent
parent 472cf7942e
commit a05075735d
9 changed files with 2449 additions and 792 deletions
+8 -1
View File
@@ -37,7 +37,14 @@ function requireAdmin(): void
requireLogin();
if (!isAdmin()) {
http_response_code(403);
echo 'Forbidden';
$me = currentUser();
if ($me && function_exists('pageHeader') && function_exists('fusionRestrictedCard')) {
pageHeader($me);
fusionRestrictedCard();
pageFooter();
} else {
echo '需要管理员权限';
}
exit;
}
}
+91 -112
View File
@@ -2,121 +2,100 @@
declare(strict_types=1);
/** @var array $me */
?>
<div class="card fin-tool-page">
<h3 class="section-title">承兑贴现计算器</h3>
<div class="quick-links-col" style="margin-bottom:14px">
<a class="tree-link" href="index.php?action=quick_queries">← 返回便捷查询</a>
<div class="page-head">
<div>
<h1 class="page-title">计算工具</h1>
<div class="page-sub">本地浏览器计算,结果仅供参考,不写入档案数据</div>
<?php fusionToolsTabs('acceptance_discount_calculator'); ?>
</div>
</div>
<div class="calc-grid">
<div class="editor-card">
<div class="cr-group">
<div class="section-title" style="margin-top:0;">票据信息</div>
<div class="cr"><span class="cr-label">票据类型</span><div class="cr-ctl"><div class="opt-row">
<label><input type="radio" name="dc_bill" value="bank" checked> 银行承兑汇票</label>
<label><input type="radio" name="dc_bill" value="commercial"> 商业承兑汇票</label>
</div>
<p class="cr-hint" id="dc_risk_hint">银承信用风险相对较低;商承请结合承兑人资信评估。</p>
</div></div>
<div class="cr"><label for="dc_face">票面金额(元)</label><div class="cr-ctl">
<input id="dc_face" type="text" inputmode="decimal">
<div class="cr-hint"><span id="dc_face_fmt"></span> <span id="dc_face_cap"></span></div>
</div></div>
<div class="cr"><label for="dc_issue">出票日期</label><div class="cr-ctl"><input id="dc_issue" type="date"></div></div>
<div class="cr"><span class="cr-label">到期日</span><div class="cr-ctl"><div class="opt-row">
<label><input type="radio" name="dc_mat_mode" value="date" checked> 指定日期</label>
<label><input type="radio" name="dc_mat_mode" value="after"> 见票后定期</label>
</div></div></div>
<div class="cr" id="dc_row_mat_date"><label for="dc_maturity">到期日期</label><div class="cr-ctl"><input id="dc_maturity" type="date"></div></div>
<div class="cr" id="dc_row_mat_after" style="display:none"><label for="dc_months">期限(月)</label><div class="cr-ctl"><div class="cr-inline">
<input id="dc_months" type="number" min="1" max="12" step="1" value="6" style="width:80px">
<button type="button" class="btn btn--plain btn--sm" id="dc_apply_months">推算到期日</button>
<span class="cr-hint" style="margin:0" id="dc_mat_preview"></span>
</div></div></div>
<div class="cr"><label for="dc_discount">贴现日期</label><div class="cr-ctl"><input id="dc_discount" type="date"></div></div>
<div class="cr"><span class="cr-label">节假日</span><div class="cr-ctl"><div class="opt-row">
<label><input type="checkbox" id="dc_holiday"> 到期日遇双休日/法定节假日顺延至下一工作日</label>
</div></div></div>
</div>
<div class="fin-two-col">
<div class="fin-panel">
<h4>票据信息</h4>
<div class="fin-row">
<label>票据类型</label>
<div>
<label class="inline small"><input type="radio" name="dc_bill" value="bank" checked> 银行承兑汇票</label>
<label class="inline small" style="margin-left:12px"><input type="radio" name="dc_bill" value="commercial"> 商业承兑汇票</label>
<p class="fin-muted" id="dc_risk_hint" style="margin:4px 0 0">银承信用风险相对较低;商承请结合承兑人资信评估。</p>
</div>
</div>
<div class="fin-row">
<label for="dc_face">票面金额(元)</label>
<div>
<input id="dc_face" type="text" inputmode="decimal" style="width:100%;max-width:280px">
<div id="dc_face_fmt" class="fin-muted"></div>
<div id="dc_face_cap" class="fin-cn-cap"></div>
</div>
</div>
<div class="fin-row">
<label for="dc_issue">出票日期</label>
<input id="dc_issue" type="date">
</div>
<div class="fin-row">
<label>到期日</label>
<div>
<label class="inline small"><input type="radio" name="dc_mat_mode" value="date" checked> 指定日期</label>
<label class="inline small" style="margin-left:10px"><input type="radio" name="dc_mat_mode" value="after"> 见票后定期</label>
</div>
</div>
<div class="fin-row" id="dc_row_mat_date">
<label for="dc_maturity">到期日期</label>
<input id="dc_maturity" type="date">
</div>
<div class="fin-row" id="dc_row_mat_after" style="display:none">
<label for="dc_months">期限(月)</label>
<div>
<input id="dc_months" type="number" min="1" max="12" step="1" value="6" style="width:80px">
<button type="button" class="toolbar-btn" id="dc_apply_months" style="margin-left:8px">推算到期日</button>
<span class="fin-muted" id="dc_mat_preview"></span>
</div>
</div>
<div class="fin-row">
<label for="dc_discount">贴现日期</label>
<input id="dc_discount" type="date">
</div>
<div class="fin-row">
<label class="inline"><input type="checkbox" id="dc_holiday"> 到期日遇双休日/法定节假日顺延至下一工作日</label>
</div>
<h4 style="margin:16px 0 10px">贴现参数</h4>
<div class="fin-row">
<label for="dc_rate">贴现年利率 %</label>
<div>
<input id="dc_rate" type="text" inputmode="decimal" style="width:100px">
<button type="button" class="toolbar-btn" data-ref="1.85" style="margin-left:6px">国股参考</button>
<button type="button" class="toolbar-btn" data-ref="2.15">城商参考</button>
<button type="button" class="toolbar-btn" data-ref="2.45">农商参考</button>
</div>
</div>
<div class="fin-row">
<label>计息基准</label>
<span>360 天/年(票据贴现常用)</span>
</div>
<div class="fin-row">
<label class="inline"><input type="checkbox" id="dc_remote"> 异地(+3 天在途)</label>
</div>
<div class="fin-row">
<label for="dc_day_rule">计息方式</label>
<select id="dc_day_rule">
<option value="exclusive" selected>记首不记尾(贴现日至到期前一日)</option>
<option value="inclusive">记首记尾(对比用)</option>
</select>
</div>
<h4 style="margin:16px 0 10px">反向推算(选填其一)</h4>
<div class="fin-row">
<label for="dc_net_in">实付金额(元)</label>
<input id="dc_net_in" type="text" inputmode="decimal" placeholder="反推利率">
</div>
<div class="fin-row">
<label for="dc_per10">每10万扣息(元)</label>
<input id="dc_per10" type="text" inputmode="decimal" placeholder="反推利率">
</div>
<div class="fin-actions">
<button type="button" class="toolbar-btn primary" id="dc_calc">计算</button>
<button type="button" class="toolbar-btn" id="dc_copy">复制结果</button>
<button type="button" class="toolbar-btn" id="dc_save">保存记录</button>
<button type="button" class="btn-gray" id="dc_reset">重置</button>
</div>
</div>
<div>
<div class="fin-result-card" id="dc_result">
<h4 style="margin:0 0 10px">计算结果</h4>
<p id="dc_result_placeholder" class="fin-muted" style="margin:0">填写左侧并点击「计算」</p>
<div id="dc_result_body" style="display:none;font-size:13px;line-height:1.65">
<p style="margin:0"><strong>贴现天数</strong>:<span id="dc_out_days">—</span> <span id="dc_out_day_note" class="fin-muted"></span></p>
<p style="margin:8px 0 0"><strong>贴现利息</strong>:<span class="fin-out-num" style="font-size:18px" id="dc_out_int">—</span> 元</p>
<p style="margin:8px 0 0"><strong>实付金额</strong>:<span id="dc_out_net">—</span> 元</p>
<p style="margin:8px 0 0"><strong>年化成本率</strong>:<span id="dc_out_ann">—</span></p>
<p style="margin:8px 0 0"><strong>每10万扣息</strong>:<span id="dc_out_p10">—</span> 元</p>
<p style="margin:8px 0 0" id="dc_rev_line" class="fin-muted"></p>
</div>
</div>
<div class="fin-panel" style="margin-top:12px">
<h4 style="margin:0 0 8px">本地历史记录</h4>
<p class="fin-muted" style="margin:0 0 8px">保存在本浏览器,可对比多次试算。</p>
<ul id="dc_hist_list" style="margin:0;padding-left:18px;font-size:12px;max-height:220px;overflow:auto"></ul>
<button type="button" class="btn-gray" id="dc_hist_clear" style="margin-top:8px">清空历史</button>
</div>
<div class="cr-group">
<div class="section-title">贴现条件</div>
<div class="cr"><label for="dc_rate">贴现年利率 %</label><div class="cr-ctl">
<div class="cr-inline">
<input id="dc_rate" type="text" inputmode="decimal" style="width:110px">
<span class="ref-chips">
<button type="button" class="btn btn--plain btn--sm" data-ref="1.85">国股参考</button>
<button type="button" class="btn btn--plain btn--sm" data-ref="2.15">城商参考</button>
<button type="button" class="btn btn--plain btn--sm" data-ref="2.45">农商参考</button>
</span>
</div>
</div></div>
<div class="cr"><span class="cr-label">计息基准</span><div class="cr-ctl"><div class="cr-static">360 天/年(票据贴现常用)</div></div></div>
<div class="cr"><span class="cr-label">加天规则</span><div class="cr-ctl"><div class="opt-row">
<label><input type="checkbox" id="dc_remote"> 异地(+3 天在途)</label>
</div></div></div>
<div class="cr"><label for="dc_day_rule">计息方式</label><div class="cr-ctl">
<select id="dc_day_rule" style="max-width:360px">
<option value="exclusive" selected>记首不记尾(贴现日至到期前一日)</option>
<option value="inclusive">记首记尾(对比用)</option>
</select>
</div></div>
</div>
<div class="cr-group">
<div class="section-title">反向推算(选填其一)</div>
<div class="cr"><label for="dc_net_in">实付金额(元)</label><div class="cr-ctl"><input id="dc_net_in" type="text" inputmode="decimal" placeholder="反推利率"></div></div>
<div class="cr"><label for="dc_per10">每10万扣息(元)</label><div class="cr-ctl"><input id="dc_per10" type="text" inputmode="decimal" placeholder="反推利率"></div></div>
</div>
<div class="cr-actions">
<button type="button" class="btn btn--primary" id="dc_calc">计算</button>
<button type="button" class="btn btn--plain" id="dc_copy">复制结果</button>
<button type="button" class="btn btn--plain" id="dc_save">保存记录</button>
<button type="button" class="btn btn--plain" id="dc_reset">重置</button>
</div>
</div>
<div class="calc-side">
<div class="summary-card" id="dc_result">
<div class="drawer-eyebrow">计算结果</div>
<p class="calc-note" id="dc_result_placeholder">填写左侧并点击「计算」</p>
<div id="dc_result_body" style="display:none">
<div class="ha-label" style="font-size:11px;font-weight:700;letter-spacing:.12em;color:var(--gold)">贴现利息</div>
<div class="calc-result-hero num"><span id="dc_out_int">—</span></div>
<div class="summary-row"><span>贴现天数</span><b class="num" id="dc_out_days">—</b></div>
<div class="calc-note" id="dc_out_day_note"></div>
<div class="summary-row"><span>实付金额</span><b class="gold num" id="dc_out_net">—</b></div>
<div class="summary-row"><span>年化成本率</span><b id="dc_out_ann">—</b></div>
<div class="summary-row"><span>每10万扣息</span><b class="num" id="dc_out_p10">—</b></div>
<div class="rev-line" id="dc_rev_line"></div>
</div>
</div>
<div class="editor-card">
<div class="section-title" style="margin-top:0">本地历史记录</div>
<p class="calc-group-note">保存在本浏览器,最多对照多次试算。</p>
<ul id="dc_hist_list" class="calc-hist"></ul>
<button type="button" class="btn btn--plain btn--sm" id="dc_hist_clear" style="margin-top:8px">清空历史</button>
</div>
</div>
</div>
<script>
(function(){
+79 -81
View File
@@ -2,89 +2,86 @@
declare(strict_types=1);
/** @var array $me */
?>
<div class="card fin-tool-page">
<h3 class="section-title">利息计算器</h3>
<div class="quick-links-col" style="margin-bottom:14px">
<a class="tree-link" href="index.php?action=quick_queries">← 返回便捷查询</a>
<div class="page-head">
<div>
<h1 class="page-title">计算工具</h1>
<div class="page-sub">本地浏览器计算,结果仅供参考,不写入档案数据</div>
<?php fusionToolsTabs('interest_calculator'); ?>
</div>
</div>
<div class="calc-grid">
<div class="editor-card">
<div class="cr-group">
<div class="section-title" style="margin-top:0;">金额与利率</div>
<div class="cr"><label for="ic_principal">本金(元)</label><div class="cr-ctl">
<input id="ic_principal" type="text" inputmode="decimal" autocomplete="off" placeholder="如 1000000">
<div class="cr-hint"><span id="ic_principal_fmt"></span> <span id="ic_principal_cap"></span></div>
</div></div>
<div class="cr"><label for="ic_rate">利率数值</label><div class="cr-ctl"><div class="cr-inline">
<input id="ic_rate" type="text" inputmode="decimal" style="width:110px">
<select id="ic_rate_kind" aria-label="利率种类" style="width:126px">
<option value="annual">年利率 %</option>
<option value="monthly">月利率 %</option>
<option value="daily">日利率 %</option>
</select>
</div></div></div>
</div>
<div class="fin-two-col">
<div class="fin-panel">
<h4>输入</h4>
<div class="fin-row">
<label for="ic_principal">本金(元)</label>
<div>
<input id="ic_principal" type="text" inputmode="decimal" autocomplete="off" placeholder="如 1000000" style="width:100%;max-width:320px">
<div id="ic_principal_fmt" class="fin-muted"></div>
<div id="ic_principal_cap" class="fin-cn-cap"></div>
</div>
</div>
<div class="fin-row">
<label for="ic_rate">利率数值</label>
<div>
<input id="ic_rate" type="text" inputmode="decimal" style="width:140px">
<select id="ic_rate_kind" style="margin-left:8px">
<option value="annual">年利率 %</option>
<option value="monthly">月利率 %</option>
<option value="daily">日利率 %</option>
</select>
</div>
</div>
<div class="fin-row">
<label>计息天数</label>
<div>
<label class="inline small"><input type="radio" name="ic_day_mode" value="manual" checked> 模式A:直接输入天数</label>
<label class="inline small" style="margin-left:12px"><input type="radio" name="ic_day_mode" value="range"> 模式B:起止日期</label>
</div>
</div>
<div class="fin-row" id="ic_row_manual">
<label for="ic_days">天数</label>
<div>
<input id="ic_days" type="number" min="0" step="1" style="width:120px" placeholder="正整数">
<span class="fin-muted" id="ic_days_hint"></span>
</div>
</div>
<div class="fin-row" id="ic_row_range" style="display:none">
<label>起止日期</label>
<div style="display:flex;flex-wrap:wrap;gap:8px;align-items:center">
<input id="ic_d1" type="date">
<span>至</span>
<input id="ic_d2" type="date">
<span class="fin-muted" id="ic_range_days_label"></span>
</div>
</div>
<div class="fin-row">
<label for="ic_count_mode">结息方式</label>
<select id="ic_count_mode">
<option value="inclusive">记首记尾(算头又算尾,天数+1)</option>
<option value="exclusive" selected>记首不记尾(算头不算尾)</option>
</select>
</div>
<div class="fin-row">
<label for="ic_basis">计息基准</label>
<select id="ic_basis">
<option value="360" selected>360 天/年(银行常用)</option>
<option value="365">365 天/年</option>
</select>
</div>
<div class="fin-actions">
<button type="button" class="toolbar-btn primary" id="ic_calc">计算</button>
<button type="button" class="toolbar-btn" id="ic_copy">一键复制结果</button>
<button type="button" class="btn-gray" id="ic_reset">重置</button>
</div>
</div>
<div class="fin-result-card" id="ic_result_wrap">
<h4 style="margin:0 0 10px">计算结果</h4>
<p class="fin-muted" style="margin:0 0 8px" id="ic_placeholder">请先填写左侧数据并点击「计算」</p>
<div id="ic_result_body" style="display:none">
<p class="small muted" style="margin:0">应付利息</p>
<div class="fin-out-num" id="ic_out_interest">—</div>
<p class="small muted" style="margin:12px 0 0">本息合计</p>
<div class="fin-out-num" id="ic_out_total" style="font-size:18px">—</div>
<p style="margin:12px 0 4px;font-size:13px">实际计息天数:<strong id="ic_out_days">—</strong></p>
<p style="margin:0;font-size:13px">参考日利率:<strong id="ic_out_daily">—</strong></p>
</div>
</div>
<div class="cr-group">
<div class="section-title">计息天数</div>
<div class="cr"><span class="cr-label">取值方式</span><div class="cr-ctl"><div class="opt-row">
<label><input type="radio" name="ic_day_mode" value="manual" checked> 模式A:直接输入天数</label>
<label><input type="radio" name="ic_day_mode" value="range"> 模式B:起止日期</label>
</div></div></div>
<div class="cr" id="ic_row_manual"><label for="ic_days">天数</label><div class="cr-ctl"><div class="cr-inline">
<input id="ic_days" type="number" min="0" step="1" style="width:110px" placeholder="正整数">
<span class="cr-hint" style="margin:0;" id="ic_days_hint">正整数;与起止日期互斥</span>
</div></div></div>
<div class="cr" id="ic_row_range" style="display:none"><span class="cr-label">起止日期</span><div class="cr-ctl"><div class="cr-inline">
<input id="ic_d1" type="date">
<span style="color:var(--text-3);">至</span>
<input id="ic_d2" type="date">
<span class="cr-hint" style="margin:0;" id="ic_range_days_label"></span>
</div></div></div>
</div>
<div class="cr-group">
<div class="section-title">计息口径</div>
<div class="calc-group-note">银行贷款档案计息常用 360 天基准;365 仅作对照。</div>
<div class="cr"><label for="ic_count_mode">结息方式</label><div class="cr-ctl">
<select id="ic_count_mode" style="max-width:320px">
<option value="exclusive" selected>记首不记尾(算头不算尾)</option>
<option value="inclusive">记首记尾(算头又算尾,天数+1)</option>
</select>
</div></div>
<div class="cr"><label for="ic_basis">计息基准</label><div class="cr-ctl">
<select id="ic_basis" style="max-width:320px">
<option value="360" selected>360 天/年(银行常用)</option>
<option value="365">365 天/年</option>
</select>
</div></div>
</div>
<div class="cr-actions">
<button type="button" class="btn btn--primary" id="ic_calc">计算</button>
<button type="button" class="btn btn--plain" id="ic_copy">一键复制结果</button>
<button type="button" class="btn btn--plain" id="ic_reset">重置</button>
</div>
</div>
<div class="calc-side">
<div class="summary-card" id="ic_result_wrap">
<div class="drawer-eyebrow">计算结果</div>
<p class="calc-note" id="ic_placeholder">请先填写左侧数据并点击「计算」</p>
<div id="ic_result_body" style="display:none">
<div class="ha-label" style="font-size:11px;font-weight:700;letter-spacing:.12em;color:var(--gold)">应付利息</div>
<div class="calc-result-hero num" id="ic_out_interest">—</div>
<div class="calc-caps-block" id="ic_caps_block">
<span class="caps-label">大写</span>
<span class="calc-caps" id="ic_out_cap">—</span>
</div>
<div class="summary-row"><span>本息合计</span><b class="gold num" id="ic_out_total">—</b></div>
<div class="summary-row"><span>实际计息天数</span><b class="num" id="ic_out_days">—</b></div>
<div class="summary-row"><span>参考日利率</span><b id="ic_out_daily">—</b></div>
</div>
</div>
</div>
</div>
<script>
(function(){
@@ -170,6 +167,7 @@ declare(strict_types=1);
document.getElementById('ic_out_total').textContent=fmtMoney(P+intr)+' 元';
document.getElementById('ic_out_days').textContent=String(days);
document.getElementById('ic_out_daily').textContent=(dref*100).toFixed(6)+'%(按当前利率种类换算,仅供参考)';
var cap=document.getElementById('ic_out_cap'); if(cap) cap.textContent=toRmbUpper(Math.floor(intr))||'—';
document.getElementById('ic_result_body').style.display='block';
var ph=document.getElementById('ic_placeholder'); if(ph) ph.style.display='none';
}
+362
View File
@@ -0,0 +1,362 @@
<?php
declare(strict_types=1);
function fusionNavKey(string $action): string
{
return match ($action) {
'dashboard' => 'workbench',
'home', 'new_dir', 'edit_dir', 'archive_form', 'archive_detail', 'directories' => 'list',
'reminders', 'pending_updates' => 'tasks',
'quick_queries', 'query_totals', 'query_payable_interest', 'query_external_guarantee', 'repayment_history' => 'query',
'interest_calculator', 'acceptance_discount_calculator' => 'tools',
'delete_approvals' => 'approvals',
'users' => 'users',
'profile' => 'profile',
default => 'list',
};
}
function fusionStatusPill(string $status): string
{
$map = [
'履行中' => 'ok',
'已还款' => 'ok',
'已通过' => 'ok',
'待更新' => 'pending',
'待处理' => 'pending',
'即将到期' => 'due',
'未还' => 'due',
'待审批' => 'due',
'逾期中' => 'over',
'已逾期' => 'over',
'逾期' => 'over',
'已完成' => 'done',
'已延期' => 'done',
'已驳回' => 'done',
'已停用' => 'done',
];
$cls = $map[$status] ?? 'pending';
return '<span class="pill pill--' . e($cls) . '">' . e($status) . '</span>';
}
function fusionPendingApprovalCount(): int
{
if (!function_exists('loadDeleteApprovals')) {
return 0;
}
$n = 0;
foreach (loadDeleteApprovals() as $ap) {
if (($ap['status'] ?? '') === 'pending') {
$n++;
}
}
return $n;
}
function fusionQueryTabs(string $current): void
{
$tabs = [
'query_totals' => '总金额',
'query_payable_interest' => '应付本息',
'query_external_guarantee' => '对外担保',
'repayment_history' => '历史还款',
];
echo '<div class="seg query-tabs" role="tablist" aria-label="统计口径">';
foreach ($tabs as $act => $label) {
$active = $current === $act ? ' data-active' : '';
echo '<a class="btn btn--sm" role="tab" href="index.php?action=' . e($act) . '"' . ($active ? ' data-active style="background:var(--surface-2);box-shadow:var(--shadow-seg);font-weight:600;color:var(--text)"' : ' style="color:var(--text-2)"') . '>' . e($label) . '</a>';
}
echo '</div>';
}
function fusionToolsTabs(string $current): void
{
$tabs = [
'interest_calculator' => '利息计算器',
'acceptance_discount_calculator' => '承兑贴现计算器',
];
echo '<div class="seg head-switch" role="tablist" aria-label="计算工具">';
foreach ($tabs as $act => $label) {
$on = $current === $act;
echo '<a role="tab" href="index.php?action=' . e($act) . '"' . ($on ? ' data-active' : '') . ' class="btn btn--sm" style="' . ($on ? 'background:var(--surface-2);box-shadow:var(--shadow-seg);font-weight:600' : 'color:var(--text-2)') . '">' . e($label) . '</a>';
}
echo '</div>';
}
function fusionRestrictedCard(string $title = '需要管理员权限'): void
{
echo '<div class="restricted-card"><div class="lock" aria-hidden="true">Restricted</div><h2>' . e($title) . '</h2><p>当前账号为普通用户,该功能仅管理员可操作。如需开通,请联系系统管理员。</p><p style="margin-top:16px"><a class="btn btn--plain" href="index.php?action=dashboard">返回工作台</a></p></div>';
}
function fusionQuickDock(bool $isAdmin): void
{
$ico = static function (string $p): string {
return '<svg width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">' . $p . '</svg>';
};
$items = [];
if ($isAdmin) {
$items[] = ['新建档案', '五步录入 · 自动归档', 'index.php?action=archive_form', '<path d="M5 2h5l3.5 3.5V16H5z"/><path d="M10 2v3.5h3.5"/><path d="M9 9v4M7 11h4"/>'];
$items[] = ['导入档案', 'xlsx / csv 模板批量导入', '#', '<path d="M9 2.5v7"/><path d="m6 6.5 3 3 3-3"/><path d="M3 11v3.5A1.5 1.5 0 0 0 4.5 16h9a1.5 1.5 0 0 0 1.5-1.5V11"/>', 'data-open-modal="import"'];
}
$items[] = ['统计查询', '总金额 / 应付本息 / 担保 / 历史', 'index.php?action=query_totals', '<path d="M3 15.5h12"/><path d="M5.5 12V8M9 12V4.5M12.5 12V6.5"/>'];
$items[] = ['利息计算', '单利 · 360 / 365 天基准', 'index.php?action=interest_calculator', '<circle cx="6" cy="6" r="2.2"/><circle cx="12" cy="12" r="2.2"/><path d="M13.5 4.5 4.5 13.5"/>'];
$items[] = ['承兑贴现', '异地加天 · 节假日顺延', 'index.php?action=acceptance_discount_calculator', '<path d="M3 5.5h12A1.5 1.5 0 0 1 16.5 7v1.5a2 2 0 0 0 0 4V14A1.5 1.5 0 0 1 15 15.5H3A1.5 1.5 0 0 1 1.5 14v-1.5a2 2 0 0 0 0-4V7A1.5 1.5 0 0 1 3 5.5z"/><path d="M11 5.5v10" stroke-dasharray="2 2.5"/>'];
echo '<div class="quick-dock">';
foreach ($items as $i => $it) {
$extra = $it[4] ?? '';
$tag = $extra !== '' ? 'button type="button"' : 'a href="' . e($it[2]) . '"';
$close = $extra !== '' ? 'button' : 'a';
echo '<'.$tag.' class="qd-item stagger-in" style="animation-delay:' . ($i * 45) . 'ms" ' . $extra . '>';
echo '<span class="qd-ico">' . $ico($it[3]) . '</span>';
echo '<span class="qd-main">' . e($it[0]) . '</span>';
echo '<span class="qd-sub">' . e($it[1]) . '</span>';
echo '</'.$close.'>';
}
echo '</div>';
}
function pageHeader(array $me): void
{
$flash = getFlash();
$action = (string)($_GET['action'] ?? 'dashboard');
if ($action === 'home' && isset($_GET['view']) && $_GET['view'] === 'dirs') {
$action = 'directories';
}
$navKey = fusionNavKey($action);
$isAdmin = (($me['role'] ?? '') === 'admin');
$taskBadge = (int)($GLOBALS['fusion_task_badge'] ?? 0);
$approvalBadge = $isAdmin ? fusionPendingApprovalCount() : 0;
$who = maskUsername((string)$me['username']);
$role = roleLabel((string)$me['role']);
$weekdays = ['日', '一', '二', '三', '四', '五', '六'];
$todayLabel = date('Y-m-d') . ' 星期' . $weekdays[(int)date('w')];
$nav = [
['group', '档案'],
['workbench', '工作台', '台', 'index.php?action=dashboard', false, 0],
['list', '档案库', '库', 'index.php?action=home', false, 0],
['tasks', '任务中心', '任', 'index.php?action=reminders&type=due', false, $taskBadge],
['group', '分析'],
['query', '统计查询', '查', 'index.php?action=query_totals', false, 0],
['tools', '计算工具', '算', 'index.php?action=interest_calculator', false, 0],
['group', '管理', true],
['approvals', '删除审批', '审', 'index.php?action=delete_approvals', true, $approvalBadge],
['users', '用户管理', '用', 'index.php?action=users', true, 0],
['group', '账户'],
['profile', '个人设置', '我', 'index.php?action=profile', false, 0],
];
?>
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>金牛集团贷款档案管理系统</title>
<link rel="stylesheet" href="assets/fusion.css">
<script>
(function(){
try {
var t = localStorage.getItem('jinniu-theme');
if (t === 'night') document.documentElement.setAttribute('data-boot-theme','night');
} catch (e) {}
})();
</script>
</head>
<body>
<div class="v-fusion" data-variant-root>
<script>
(function(){
try {
var t = localStorage.getItem('jinniu-theme');
var r = document.querySelector('[data-variant-root]');
if (t === 'night' && r) r.setAttribute('data-theme','night');
} catch (e) {}
})();
</script>
<aside class="sidebar">
<div class="brand">
<img src="assets/logo-day.png" alt="金牛集团" data-brand-logo width="38" height="38">
<div><div class="brand-name">金牛贷款档案</div><div class="brand-sub">JINNIU ARCHIVE</div></div>
</div>
<?php foreach ($nav as $n):
$isGroup = $n[0] === 'group';
$adminOnly = $isGroup ? !empty($n[2]) : !empty($n[4]);
if ($adminOnly && !$isAdmin) {
continue;
}
if ($isGroup) {
echo '<div class="nav-label">' . e((string)$n[1]) . '</div>';
continue;
}
$active = $navKey === $n[0] ? ' data-active' : '';
$badge = (int)($n[5] ?? 0);
echo '<a class="nav-item" href="' . e((string)$n[3]) . '" data-nav="' . e((string)$n[0]) . '" data-short="' . e((string)$n[2]) . '"' . $active . '><span class="dot"></span>' . e((string)$n[1]);
if ($badge > 0) {
echo '<span class="nav-badge num">' . $badge . '</span>';
}
echo '</a>';
endforeach; ?>
<div class="sidebar-account">
<div class="theme-toggle" role="group" aria-label="日间 / 夜间主题切换">
<button type="button" data-theme-btn="day" aria-pressed="true">日间</button>
<button type="button" data-theme-btn="night" aria-pressed="false">夜间</button>
</div>
<div class="account-box">
<div class="account-id">
<div class="account-meta">
<div class="account-name"><?= e($role) ?><span class="num">(<?= e($who) ?>)</span></div>
</div>
<a class="icon-btn" href="index.php?action=logout" aria-label="退出登录" title="退出登录">
<svg width="15" height="15" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 2H3.5A1.5 1.5 0 0 0 2 3.5v9A1.5 1.5 0 0 0 3.5 14H6"/><path d="M10.5 5l3 3-3 3"/><path d="M13.5 8H6.5"/></svg>
</a>
</div>
<div class="account-note">贷款与对外担保档案 · <?= e($todayLabel) ?></div>
</div>
</div>
</aside>
<div class="content-shell">
<main class="content">
<?php if ($flash): ?>
<div id="flash-banner" class="<?= ($flash['type'] ?? '') === 'ok' ? 'flash-ok' : 'flash-err' ?>"><?= e((string)$flash['msg']) ?></div>
<?php endif; ?>
<?php
}
function pageFooter(): void
{
$isAdmin = isAdmin();
?>
</main>
</div>
<div class="scrim" data-close-modal></div>
<?php if ($isAdmin): ?>
<div class="modal-scrim" data-close-modal></div>
<div class="modal-card" role="dialog" aria-modal="true" aria-label="导入档案">
<div class="modal-head"><div class="modal-title">导入档案</div></div>
<form method="post" action="index.php?action=import_archives" enctype="multipart/form-data">
<div class="modal-body">
<p class="calc-group-note">使用系统模板(xlsx / csv)批量导入。校验规则与原模板 15 列一致,不改变导入格式。</p>
<div class="form-field" style="margin-top:12px">
<label for="import_file">选择文件</label>
<input id="import_file" type="file" name="import_file" required accept=".xlsx,.csv,.xls">
</div>
<p style="margin-top:12px"><a class="btn btn--plain btn--sm" href="index.php?action=download_import_template">下载导入模板</a></p>
</div>
<div class="modal-foot">
<button type="button" class="btn btn--plain" data-close-modal>取消</button>
<button type="submit" class="btn btn--primary">开始导入</button>
</div>
</form>
</div>
<?php endif; ?>
<div class="v-fusion toast-wrap" id="fusion-toast-wrap"></div>
</div>
<script>
(function(){
var boot = document.documentElement.getAttribute('data-boot-theme');
var root = document.querySelector('[data-variant-root]');
if (boot === 'night' && root) root.setAttribute('data-theme','night');
})();
</script>
<script src="assets/fusion.js"></script>
</body></html>
<?php
}
function fusionLoginPage(?array $flash): void
{
$err = $flash && ($flash['type'] ?? '') !== 'ok';
$feats = [
'三级目录归档:银行贷款 / 对外担保逐级归档,附件自动命名',
'结息与逾期计息:剩余额度联动扣减,利息与逾期上浮自动试算',
'到期与还款提醒:到期前 30 / 7 天提醒,还款计划逐期跟踪',
'删除审批闭环:档案删除需双管理员审批,操作全程留痕',
];
?>
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>金牛集团贷款档案管理系统 - 登录</title>
<link rel="stylesheet" href="assets/fusion.css">
<script>
(function(){
try {
var t = localStorage.getItem('jinniu-theme');
if (t === 'night') document.documentElement.setAttribute('data-boot-theme','night');
} catch (e) {}
})();
</script>
</head>
<body>
<div class="v-fusion" data-variant-root>
<script>
(function(){
try {
var t = localStorage.getItem('jinniu-theme');
var r = document.querySelector('[data-variant-root]');
if (t === 'night' && r) r.setAttribute('data-theme','night');
} catch (e) {}
})();
</script>
<div class="login-shell">
<div class="login-theme">
<div class="theme-toggle" role="group" aria-label="日间 / 夜间主题切换" style="margin:0;">
<button type="button" data-theme-btn="day" aria-pressed="true">日间</button>
<button type="button" data-theme-btn="night" aria-pressed="false">夜间</button>
</div>
</div>
<div class="lp-brand">
<div class="lp-head stagger-in">
<img src="assets/logo-day.png" alt="金牛实业集团标识" data-brand-logo width="52" height="52">
<div class="lp-cap">JINNIU GROUP · LOAN ARCHIVE</div>
</div>
<div class="lp-hero stagger-in" style="animation-delay:60ms;">
<div class="lp-title">金牛集团<br>贷款档案管理系统</div>
<div class="lp-sub">集团内部贷款与对外担保档案的统一归档、计息与提醒工作平台,档案、附件与还款记录一处管理。</div>
</div>
<div class="lp-feats stagger-in" style="animation-delay:120ms;">
<?php foreach ($feats as $i => $f): ?>
<div class="lp-feat"><span class="lp-num">0<?= $i + 1 ?></span><span><?= e($f) ?></span></div>
<?php endforeach; ?>
</div>
</div>
<div class="lp-main">
<div class="lp-form stagger-in" style="animation-delay:90ms;">
<div class="login-title">登录</div>
<div class="login-sub">使用集团内部账号登录,进入你有权限的档案工作区。</div>
<form method="post" novalidate style="margin-top:22px;">
<div class="form-grid" style="grid-template-columns:1fr; gap:14px;">
<div class="form-field">
<label for="l-user">账号</label>
<input id="l-user" name="username" placeholder="请输入用户名" autocomplete="username" required>
<div class="field-err"></div>
</div>
<div class="form-field"<?= $err ? ' data-error' : '' ?>>
<label for="l-pass">密码</label>
<input id="l-pass" name="password" type="password" placeholder="请输入密码" autocomplete="current-password" required<?= $err ? ' aria-invalid="true"' : '' ?>>
<div class="field-err"><?= $err ? e((string)$flash['msg']) : '' ?></div>
</div>
</div>
<button type="submit" class="btn btn--primary" style="width:100%; height:40px; margin-top:12px;">登 录</button>
</form>
<div class="login-notice">
<b>首次登录请修改初始密码</b>
初始密码由管理员发放,登录后可在「个人设置」中修改;请勿使用默认密码上线。
</div>
<div class="login-foot">忘记密码或无法登录?请联系 <b>系统管理员</b> 重置</div>
</div>
</div>
</div>
</div>
<script>
(function(){
var boot = document.documentElement.getAttribute('data-boot-theme');
var root = document.querySelector('[data-variant-root]');
if (boot === 'night' && root) root.setAttribute('data-theme','night');
})();
</script>
<script src="assets/fusion.js"></script>
</body></html>
<?php
}
File diff suppressed because it is too large Load Diff
+147
View File
@@ -0,0 +1,147 @@
(function () {
var THEME_KEY = "jinniu-theme";
var root = function () { return document.querySelector("[data-variant-root]"); };
function currentTheme() {
var r = root();
if (r && r.getAttribute("data-theme") === "night") return "night";
return "day";
}
function applyLogos(theme) {
var src = theme === "night" ? "assets/logo-night.png" : "assets/logo-day.png";
document.querySelectorAll("img[data-brand-logo]").forEach(function (img) { img.src = src; });
}
window.setFusionTheme = function (next, animate) {
if (next !== "day" && next !== "night") return;
var r = root();
if (!r) return;
var reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
if (animate !== false && !reduce) {
r.setAttribute("data-theme-anim", "");
setTimeout(function () { r.removeAttribute("data-theme-anim"); }, 240);
}
if (next === "night") r.setAttribute("data-theme", "night");
else r.removeAttribute("data-theme");
try { localStorage.setItem(THEME_KEY, next); } catch (e) {}
r.querySelectorAll("[data-theme-btn]").forEach(function (b) {
b.setAttribute("aria-pressed", String(b.getAttribute("data-theme-btn") === next));
});
applyLogos(next);
};
document.addEventListener("click", function (e) {
var btn = e.target.closest("[data-theme-btn]");
if (btn) {
e.preventDefault();
window.setFusionTheme(btn.getAttribute("data-theme-btn"), true);
}
});
var toastWrap = document.getElementById("fusion-toast-wrap");
window.fusionToast = function (msg) {
if (!toastWrap) return;
toastWrap.innerHTML = '<div class="toast" data-hidden role="status"><span class="tick" aria-hidden="true">✓</span><span></span></div>';
var t = toastWrap.querySelector(".toast");
t.querySelector("span:last-child").textContent = msg;
requestAnimationFrame(function () {
requestAnimationFrame(function () { t.removeAttribute("data-hidden"); });
});
clearTimeout(window.fusionToast._t);
window.fusionToast._t = setTimeout(function () { t.setAttribute("data-hidden", ""); }, 2600);
t.addEventListener("mouseenter", function () { clearTimeout(window.fusionToast._t); });
t.addEventListener("mouseleave", function () {
window.fusionToast._t = setTimeout(function () { t.setAttribute("data-hidden", ""); }, 2600);
});
};
function rowChecks(scope) {
var table = scope || document;
return Array.prototype.slice.call(table.querySelectorAll("tbody input.cid, tbody input[data-row-check]"));
}
window.syncCheckAll = function (table) {
table = table || document.querySelector(".table-card table, .table-wrap table");
if (!table) return;
var all = table.querySelector("[data-check-all]");
if (!all) return;
var boxes = rowChecks(table);
var n = boxes.filter(function (x) { return x.checked; }).length;
all.checked = boxes.length > 0 && n === boxes.length;
all.indeterminate = n > 0 && n < boxes.length;
boxes.forEach(function (x) {
var tr = x.closest("tr");
if (tr) {
if (x.checked) tr.setAttribute("data-checked", "");
else tr.removeAttribute("data-checked");
}
});
var bar = document.querySelector("[data-batch-slot]");
if (bar) bar.hidden = n === 0;
var countEl = document.querySelector("[data-batch-count]");
if (countEl) countEl.textContent = String(n);
};
document.addEventListener("change", function (e) {
var all = e.target.closest("[data-check-all]");
if (all) {
var table = all.closest("table");
rowChecks(table).forEach(function (x) { x.checked = all.checked; });
window.syncCheckAll(table);
return;
}
if (e.target.matches("input.cid, input[data-row-check]")) {
window.syncCheckAll(e.target.closest("table"));
}
});
document.addEventListener("pointerdown", function (e) {
var hold = e.target.closest(".hold-btn");
if (!hold || hold.disabled) return;
hold.setAttribute("data-holding", "");
hold._holdTimer = setTimeout(function () {
hold.removeAttribute("data-holding");
var href = hold.getAttribute("data-hold-href");
var form = hold.closest("form");
if (href) window.location.href = href;
else if (form) form.submit();
else hold.dispatchEvent(new CustomEvent("holdconfirm", { bubbles: true }));
}, 1400);
});
["pointerup", "pointerleave", "pointercancel"].forEach(function (ev) {
document.addEventListener(ev, function (e) {
var hold = e.target.closest ? e.target.closest(".hold-btn") : null;
document.querySelectorAll(".hold-btn[data-holding]").forEach(function (h) {
if (hold && h !== hold && ev === "pointerup") return;
h.removeAttribute("data-holding");
if (h._holdTimer) clearTimeout(h._holdTimer);
});
});
});
document.addEventListener("click", function (e) {
var openModal = e.target.closest("[data-open-modal]");
if (openModal) {
e.preventDefault();
var r = root();
if (r) r.setAttribute("data-modal-open", openModal.getAttribute("data-open-modal") || "import");
}
if (e.target.closest("[data-close-modal]")) {
var r2 = root();
if (r2) r2.removeAttribute("data-modal-open");
}
});
var shell = document.querySelector(".content-shell");
if (shell && !window.history.state) shell.scrollTop = 0;
document.addEventListener("DOMContentLoaded", function () {
window.setFusionTheme(currentTheme(), false);
document.querySelectorAll("table").forEach(function (t) { window.syncCheckAll(t); });
var flash = document.getElementById("flash-banner");
if (flash && flash.classList.contains("flash-ok")) {
window.fusionToast(flash.textContent.trim());
}
});
})();
Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

+700 -598
View File
File diff suppressed because it is too large Load Diff