将供应商负数预警中的负数原因显示改为情况说明,并在其后增加公司承担金额字段。 Co-authored-by: 苏木 <594326199@qq.com> Co-committed-by: 苏木 <594326199@qq.com>
430 lines
18 KiB
PHP
430 lines
18 KiB
PHP
@php
|
||
$assignment = $assignment ?? null;
|
||
$suppliers = $suppliers ?? [];
|
||
$supplierResults = $supplierResults ?? [];
|
||
$latestPeriod = $latestPeriod ?? ['month' => '', 'negative_amount' => 0, 'supplier_count' => 0, 'row_count' => 0];
|
||
$processingDeadline = $processingDeadline ?? null;
|
||
$supplierAttachments = $supplierAttachments ?? [];
|
||
$completed = ($assignment->status ?? '') === 'completed';
|
||
$processing = ($assignment->status ?? '') === 'processing';
|
||
$statusLabel = $completed ? '全部已回传,可继续修改' : ($processing ? '部分已回传,可继续填写' : '待填写');
|
||
$filledCount = collect($suppliers)->filter(
|
||
static fn (array $supplier): bool => filled($supplierResults[$supplier['supplier'] ?? ''] ?? null)
|
||
)->count();
|
||
@endphp
|
||
<!doctype html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||
<meta name="robots" content="noindex, nofollow">
|
||
<meta name="format-detection" content="telephone=no">
|
||
<title>供应商负数预警处理</title>
|
||
<style>
|
||
:root {
|
||
--ink: #171717;
|
||
--muted: #595959;
|
||
--gold: #856632;
|
||
--gold-strong: #6A5129;
|
||
--gold-soft: #F7F0DE;
|
||
--bg: #F8F6F1;
|
||
--surface: #FFFFFF;
|
||
--border: #D8D2C7;
|
||
--danger: #B80000;
|
||
--success: #53793E;
|
||
}
|
||
* { box-sizing: border-box; }
|
||
html { -webkit-text-size-adjust: 100%; }
|
||
body {
|
||
margin: 0;
|
||
background: var(--bg);
|
||
color: var(--ink);
|
||
font: 15px/1.55 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
|
||
}
|
||
.hero {
|
||
padding: 24px 16px 22px;
|
||
background: #050506;
|
||
color: #F2E7C5;
|
||
}
|
||
.hero__inner, .main { width: min(760px, 100%); margin: 0 auto; }
|
||
.hero__eyebrow { margin: 0 0 7px; color: #BFAF86; font-size: 12px; letter-spacing: .08em; }
|
||
.hero h1 { margin: 0; font-size: 22px; line-height: 1.3; }
|
||
.hero__meta {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 6px 16px;
|
||
margin-top: 12px;
|
||
color: #DDD0AA;
|
||
font-size: 13px;
|
||
}
|
||
.main { padding: 14px 16px 120px; }
|
||
.notice {
|
||
margin-bottom: 12px;
|
||
padding: 12px 14px;
|
||
border: 1px solid #B7CDA8;
|
||
border-radius: 10px;
|
||
background: #F1F7EC;
|
||
color: #2F4A22;
|
||
}
|
||
.notice.is-error {
|
||
border-color: #E3B0B0;
|
||
background: #FDF1F1;
|
||
color: #7A1010;
|
||
}
|
||
.period-summary {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: flex-end;
|
||
justify-content: space-between;
|
||
gap: 10px 20px;
|
||
margin-bottom: 12px;
|
||
padding: 16px;
|
||
border: 1px solid #D7C39D;
|
||
border-radius: 12px;
|
||
background: #FFFDF8;
|
||
}
|
||
.period-summary__amount { display: grid; gap: 3px; }
|
||
.period-summary__amount span { color: var(--muted); font-size: 12px; }
|
||
.period-summary__amount strong {
|
||
color: var(--danger);
|
||
font-size: 24px;
|
||
line-height: 1.25;
|
||
font-variant-numeric: tabular-nums;
|
||
}
|
||
.period-summary__meta {
|
||
max-width: 260px;
|
||
color: var(--muted);
|
||
font-size: 12px;
|
||
line-height: 1.6;
|
||
}
|
||
.deadline {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: baseline;
|
||
gap: 5px 10px;
|
||
margin: -2px 0 12px;
|
||
padding: 10px 14px;
|
||
border: 1px solid #E2C68C;
|
||
border-radius: 10px;
|
||
background: #FFF6E2;
|
||
color: #6A4505;
|
||
font-size: 13px;
|
||
}
|
||
.deadline strong { font-size: 15px; font-variant-numeric: tabular-nums; }
|
||
.summary {
|
||
display: grid;
|
||
grid-template-columns: repeat(3, 1fr);
|
||
gap: 8px;
|
||
margin-bottom: 12px;
|
||
}
|
||
.summary__item {
|
||
padding: 12px;
|
||
border: 1px solid var(--border);
|
||
border-radius: 10px;
|
||
background: var(--surface);
|
||
}
|
||
.summary__item span { display: block; color: var(--muted); font-size: 12px; }
|
||
.summary__item strong { display: block; margin-top: 3px; font-size: 18px; font-variant-numeric: tabular-nums; }
|
||
.task-card {
|
||
margin-bottom: 12px;
|
||
overflow: hidden;
|
||
border: 1px solid var(--border);
|
||
border-radius: 12px;
|
||
background: var(--surface);
|
||
}
|
||
.task-card__head { padding: 14px 16px 12px; border-bottom: 1px solid #ECE8E0; }
|
||
.task-card__title-row { display: flex; align-items: flex-start; gap: 10px; }
|
||
.task-card__index {
|
||
display: inline-grid;
|
||
flex: none;
|
||
width: 26px;
|
||
height: 26px;
|
||
place-items: center;
|
||
border-radius: 50%;
|
||
background: var(--gold-soft);
|
||
color: var(--gold);
|
||
font-size: 12px;
|
||
font-weight: 700;
|
||
}
|
||
.task-card h2 { margin: 0; font-size: 17px; line-height: 1.4; }
|
||
.task-card__meta { margin: 7px 0 0 36px; color: var(--muted); font-size: 12px; }
|
||
.task-card__body { display: grid; gap: 10px; padding: 14px 16px 16px; }
|
||
.facts { display: grid; gap: 7px; }
|
||
.fact {
|
||
display: grid;
|
||
grid-template-columns: 68px minmax(0, 1fr);
|
||
gap: 8px;
|
||
font-size: 13px;
|
||
}
|
||
.fact span { color: var(--muted); }
|
||
.fact strong { font-weight: 500; overflow-wrap: anywhere; }
|
||
.fact strong.is-negative { color: var(--danger); font-variant-numeric: tabular-nums; }
|
||
.field { display: grid; gap: 6px; }
|
||
.field label { font-size: 14px; font-weight: 600; }
|
||
.field .required { margin-left: 2px; color: var(--danger); }
|
||
textarea {
|
||
width: 100%;
|
||
min-height: 104px;
|
||
padding: 11px 12px;
|
||
border: 1px solid var(--border);
|
||
border-radius: 8px;
|
||
background: #fff;
|
||
color: var(--ink);
|
||
font: inherit;
|
||
font-size: 16px;
|
||
resize: vertical;
|
||
}
|
||
textarea:focus {
|
||
border-color: var(--gold);
|
||
outline: none;
|
||
box-shadow: 0 0 0 3px rgba(133, 102, 50, .18);
|
||
}
|
||
textarea.has-error { border-color: var(--danger); }
|
||
.error { margin: 0; color: var(--danger); font-size: 13px; }
|
||
.screenshot-upload {
|
||
display: grid;
|
||
gap: 8px;
|
||
padding: 12px;
|
||
border: 1px dashed #D7C39D;
|
||
border-radius: 10px;
|
||
background: #FFFDF8;
|
||
}
|
||
.screenshot-upload > label { font-size: 14px; font-weight: 600; }
|
||
.screenshot-upload input[type=file] {
|
||
width: 100%;
|
||
min-height: 42px;
|
||
padding: 8px;
|
||
border: 1px solid var(--border);
|
||
border-radius: 8px;
|
||
background: #fff;
|
||
font: inherit;
|
||
font-size: 14px;
|
||
}
|
||
.screenshot-upload input[type=file]::file-selector-button {
|
||
min-height: 32px;
|
||
margin-right: 10px;
|
||
padding: 0 12px;
|
||
border: 1px solid var(--gold);
|
||
border-radius: 7px;
|
||
background: #fff;
|
||
color: var(--gold-strong);
|
||
font: inherit;
|
||
font-weight: 600;
|
||
}
|
||
.screenshot-help { margin: 0; color: var(--muted); font-size: 12px; }
|
||
.attachment-grid { display: flex; flex-wrap: wrap; gap: 8px; }
|
||
.attachment-grid a {
|
||
display: grid;
|
||
width: 76px;
|
||
gap: 4px;
|
||
color: var(--gold-strong);
|
||
font-size: 11px;
|
||
text-decoration: none;
|
||
}
|
||
.attachment-grid img {
|
||
width: 76px;
|
||
height: 76px;
|
||
border: 1px solid var(--border);
|
||
border-radius: 8px;
|
||
object-fit: cover;
|
||
background: #F4F1EA;
|
||
}
|
||
.submit-bar {
|
||
position: fixed;
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
z-index: 20;
|
||
padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
|
||
border-top: 1px solid var(--border);
|
||
background: rgba(255, 255, 255, .96);
|
||
backdrop-filter: blur(10px);
|
||
}
|
||
.submit-bar__inner {
|
||
width: min(760px, 100%);
|
||
margin: 0 auto;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 12px;
|
||
}
|
||
.submit-progress { flex: 1; color: var(--muted); font-size: 12px; }
|
||
button {
|
||
min-height: 44px;
|
||
padding: 0 18px;
|
||
border: 1px solid var(--gold-strong);
|
||
border-radius: 8px;
|
||
background: var(--gold-strong);
|
||
color: #fff;
|
||
font: inherit;
|
||
font-weight: 600;
|
||
cursor: pointer;
|
||
}
|
||
button:disabled { cursor: wait; opacity: .65; }
|
||
@media (max-width: 520px) {
|
||
.summary { grid-template-columns: 1fr 1fr; }
|
||
.summary__item:last-child { grid-column: 1 / -1; }
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<header class="hero">
|
||
<div class="hero__inner">
|
||
<p class="hero__eyebrow">{{ $assignment->group_name }}</p>
|
||
<h1>供应商负数预警处理</h1>
|
||
<div class="hero__meta">
|
||
<span>采购:{{ $assignment->purchaser_name }}</span>
|
||
<span>发送时间:{{ mb_substr((string) $assignment->sent_at, 0, 16) }}</span>
|
||
<span>状态:{{ $statusLabel }}</span>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
|
||
<main class="main">
|
||
@if (session('negative_alert_success'))
|
||
<div class="notice" role="status">{{ session('negative_alert_success') }}</div>
|
||
@endif
|
||
@if ($errors->any())
|
||
<div class="notice is-error" role="alert">{{ $errors->first() }}</div>
|
||
@endif
|
||
|
||
<section class="period-summary" aria-label="最新账期负数合计">
|
||
<div class="period-summary__amount">
|
||
<span>
|
||
最新账期负数合计 ·
|
||
{{ ($latestPeriod['month'] ?? '') !== '' ? $latestPeriod['month'] : '未标注月份' }}
|
||
</span>
|
||
<strong>¥{{ number_format((float) ($latestPeriod['negative_amount'] ?? 0), 2) }}</strong>
|
||
</div>
|
||
<div class="period-summary__meta">
|
||
该账期涉及 {{ number_format((int) ($latestPeriod['supplier_count'] ?? 0)) }} 家供应商、
|
||
{{ number_format((int) ($latestPeriod['row_count'] ?? 0)) }} 条负数预警
|
||
</div>
|
||
</section>
|
||
|
||
@if ($processingDeadline)
|
||
<div class="deadline" role="status">
|
||
<span>最晚处理时间</span>
|
||
<strong>{{ $processingDeadline }}</strong>
|
||
<span>(每月账单须在次月最后一天 18:00 前处理完成)</span>
|
||
</div>
|
||
@endif
|
||
|
||
<section class="summary" aria-label="任务汇总">
|
||
<div class="summary__item">
|
||
<span>供应商</span>
|
||
<strong>{{ number_format(count($suppliers)) }} 家</strong>
|
||
</div>
|
||
<div class="summary__item">
|
||
<span>预警记录</span>
|
||
<strong>{{ number_format((int) $assignment->row_count) }} 条</strong>
|
||
</div>
|
||
<div class="summary__item">
|
||
<span>已填写</span>
|
||
<strong data-filled-count>{{ number_format($filledCount) }} 家</strong>
|
||
</div>
|
||
</section>
|
||
|
||
<form method="POST" enctype="multipart/form-data" action="{{ route('supplier-negative-alert.task.update', ['token' => $token]) }}" data-result-form>
|
||
@csrf
|
||
@foreach ($suppliers as $index => $supplier)
|
||
@php
|
||
$supplierName = (string) ($supplier['supplier'] ?? '');
|
||
$months = implode('、', (array) ($supplier['months'] ?? []));
|
||
$reasons = implode(';', (array) ($supplier['negative_reasons'] ?? []));
|
||
$value = old('results.' . $index, $supplierResults[$supplierName] ?? '');
|
||
@endphp
|
||
<article class="task-card" data-result-card>
|
||
<div class="task-card__head">
|
||
<div class="task-card__title-row">
|
||
<span class="task-card__index">{{ $index + 1 }}</span>
|
||
<h2>{{ $supplierName }}</h2>
|
||
</div>
|
||
<p class="task-card__meta">
|
||
{{ number_format((int) ($supplier['row_count'] ?? 0)) }} 条预警
|
||
@if ($months !== '') · 月份 {{ $months }} @endif
|
||
</p>
|
||
</div>
|
||
<div class="task-card__body">
|
||
<div class="facts">
|
||
<div class="fact">
|
||
<span>负数金额</span>
|
||
<strong class="is-negative">¥{{ number_format((float) ($supplier['alert_amount'] ?? 0), 2) }}</strong>
|
||
</div>
|
||
@if ($reasons !== '')
|
||
<div class="fact">
|
||
<span>情况说明</span>
|
||
<strong>{{ $reasons }}</strong>
|
||
</div>
|
||
@endif
|
||
</div>
|
||
<div class="field">
|
||
<label for="result-{{ $index }}">处理结果(可分批填写)</label>
|
||
<textarea
|
||
id="result-{{ $index }}"
|
||
name="results[]"
|
||
maxlength="2000"
|
||
data-result-input
|
||
@class(['has-error' => $errors->has('results.' . $index)])
|
||
placeholder="请填写该供应商的核对、沟通或处理结果">{{ $value }}</textarea>
|
||
@if ($errors->has('results.' . $index))
|
||
<p class="error">{{ $errors->first('results.' . $index) }}</p>
|
||
@endif
|
||
</div>
|
||
<div class="screenshot-upload">
|
||
<label for="screenshots-{{ $index }}">上传处理截图(选填,最多 5 张)</label>
|
||
<input
|
||
id="screenshots-{{ $index }}"
|
||
type="file"
|
||
name="screenshots[{{ $index }}][]"
|
||
accept=".jpg,.jpeg,.png,.webp,image/jpeg,image/png,image/webp"
|
||
multiple>
|
||
<p class="screenshot-help">支持 JPG、PNG、WEBP,单张不超过 10MB。</p>
|
||
@php $attachments = (array) ($supplierAttachments[$supplierName] ?? []); @endphp
|
||
@if ($attachments !== [])
|
||
<div class="attachment-grid" aria-label="{{ $supplierName }}已上传截图">
|
||
@foreach ($attachments as $attachment)
|
||
<a href="{{ route('supplier-negative-alert.task.attachment', ['token' => $token, 'attachment' => $attachment->id]) }}"
|
||
target="_blank"
|
||
rel="noopener">
|
||
<img src="{{ route('supplier-negative-alert.task.attachment', ['token' => $token, 'attachment' => $attachment->id]) }}"
|
||
alt="{{ $attachment->original_name }}">
|
||
<span>已上传 {{ $loop->iteration }}</span>
|
||
</a>
|
||
@endforeach
|
||
</div>
|
||
@endif
|
||
</div>
|
||
</div>
|
||
</article>
|
||
@endforeach
|
||
|
||
<div class="submit-bar">
|
||
<div class="submit-bar__inner">
|
||
<span class="submit-progress" data-submit-progress>已填写 {{ $filledCount }} / {{ count($suppliers) }} 家</span>
|
||
<button type="submit" data-submit-button>保存已填写结果</button>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</main>
|
||
|
||
<script>
|
||
(() => {
|
||
const form = document.querySelector('[data-result-form]');
|
||
if (!form) return;
|
||
const inputs = [...form.querySelectorAll('[data-result-input]')];
|
||
const progress = form.querySelector('[data-submit-progress]');
|
||
const button = form.querySelector('[data-submit-button]');
|
||
const updateProgress = () => {
|
||
const filled = inputs.filter(input => input.value.trim() !== '').length;
|
||
progress.textContent = `已填写 ${filled} / ${inputs.length} 家`;
|
||
};
|
||
inputs.forEach(input => input.addEventListener('input', updateProgress));
|
||
form.addEventListener('submit', () => {
|
||
button.disabled = true;
|
||
button.textContent = '正在回传…';
|
||
});
|
||
})();
|
||
</script>
|
||
</body>
|
||
</html>
|