Align the two status colors with the frozen mapping so 已驳回 is danger red and repayment 待处理/未还 uses orange. Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: multica-agent <github@multica.ai>
363 lines
16 KiB
PHP
363 lines
16 KiB
PHP
<?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',
|
||
'已驳回' => 'over',
|
||
'已停用' => '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
|
||
}
|