567 lines
20 KiB
PHP
567 lines
20 KiB
PHP
@php
|
|
$base = $kukaPostingBase ?? [];
|
|
$directory = $base['directory'] ?? ['fields' => [], 'empty' => '基础数据尚未导入。'];
|
|
$baseRows = $base['rows'] ?? collect();
|
|
$filters = $base['filters'] ?? [];
|
|
$periods = $base['periods'] ?? [];
|
|
$statuses = $base['statuses'] ?? [];
|
|
$stores = $base['stores'] ?? [];
|
|
$import = $base['import'] ?? null;
|
|
$summary = $base['summary'] ?? [];
|
|
$postingAmount = $base['posting_amount'] ?? null;
|
|
$postingPreview = session('kuka_posting_amount_preview');
|
|
$postingAmountError = $errors->first('posting_amount');
|
|
$postingTargetValue = old(
|
|
'target_amount',
|
|
$postingPreview['target_amount'] ?? ($postingAmount['target_amount'] ?? ''),
|
|
);
|
|
$error = $base['error'] ?? null;
|
|
$resetUrl = route('business.pages.show', ['section' => 'posting-data', 'page' => 'kuka-basic-data']);
|
|
@endphp
|
|
|
|
<style>
|
|
.kuka-base-page {
|
|
--kb-gold: var(--vip-content-accent, #b9954f);
|
|
--kb-gold-dark: var(--vip-content-accent-dark, #856632);
|
|
--kb-gold-soft: var(--vip-content-accent-soft, #f7f0de);
|
|
--kb-border: var(--vip-border, #d8d2c7);
|
|
--kb-ink: var(--vip-content-ink, #171717);
|
|
--kb-muted: var(--vip-content-muted, #595959);
|
|
color: var(--kb-ink);
|
|
}
|
|
|
|
.kuka-base-page * { box-sizing: border-box; }
|
|
|
|
.kuka-base-alert {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
gap: 0.45rem;
|
|
margin-bottom: 1rem;
|
|
padding: 0.75rem 0.85rem;
|
|
border: 1px solid #dfbbbb;
|
|
border-radius: 0.6rem;
|
|
background: #fff4f4;
|
|
color: var(--vip-danger, #b80000);
|
|
font-size: 0.75rem;
|
|
line-height: 1.55;
|
|
}
|
|
|
|
.kuka-base-summary {
|
|
display: grid;
|
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
gap: 0.7rem;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.kuka-base-card {
|
|
min-width: 0;
|
|
padding: 0.8rem 0.9rem;
|
|
border: 1px solid var(--kb-border);
|
|
border-radius: 0.65rem;
|
|
background: #fffdf8;
|
|
}
|
|
|
|
.kuka-base-card span {
|
|
display: block;
|
|
color: var(--kb-muted);
|
|
font-size: 0.7rem;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.kuka-base-card strong {
|
|
display: block;
|
|
margin-top: 0.25rem;
|
|
overflow: hidden;
|
|
color: var(--kb-ink);
|
|
font-size: 1.05rem;
|
|
font-weight: 700;
|
|
line-height: 1.3;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.kuka-base-card small {
|
|
display: block;
|
|
margin-top: 0.22rem;
|
|
overflow: hidden;
|
|
color: var(--kb-muted);
|
|
font-size: 0.68rem;
|
|
line-height: 1.4;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.kuka-base-filter {
|
|
display: grid;
|
|
grid-template-columns: minmax(8rem, 0.8fr) minmax(13rem, 1.4fr) minmax(8rem, 0.8fr) minmax(15rem, 2fr) minmax(7rem, 0.7fr) auto;
|
|
align-items: end;
|
|
gap: 0.65rem;
|
|
margin-bottom: 1rem;
|
|
padding: 0.9rem 1rem;
|
|
border: 1px solid var(--kb-border);
|
|
border-radius: 0.75rem;
|
|
background: #fff;
|
|
}
|
|
|
|
.kuka-base-filter label {
|
|
display: grid;
|
|
min-width: 0;
|
|
gap: 0.28rem;
|
|
color: var(--kb-muted);
|
|
font-size: 0.7rem;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.kuka-base-filter select,
|
|
.kuka-base-filter input {
|
|
width: 100%;
|
|
height: 2.125rem;
|
|
min-width: 0;
|
|
padding: 0 0.65rem;
|
|
border: 1px solid var(--kb-border);
|
|
border-radius: 0.5rem;
|
|
background: #fff;
|
|
color: var(--kb-ink);
|
|
font: inherit;
|
|
font-size: 0.75rem;
|
|
outline: none;
|
|
}
|
|
|
|
.kuka-base-filter select:focus,
|
|
.kuka-base-filter input:focus {
|
|
border-color: var(--kb-gold-dark);
|
|
box-shadow: 0 0 0 3px rgba(133, 102, 50, 0.16);
|
|
}
|
|
|
|
.kuka-base-filter__actions {
|
|
display: flex;
|
|
gap: 0.45rem;
|
|
}
|
|
|
|
.kuka-base-filter__actions button,
|
|
.kuka-base-filter__actions a {
|
|
display: inline-flex;
|
|
height: 2.125rem;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 0 0.85rem;
|
|
border-radius: 0.5rem;
|
|
font: inherit;
|
|
font-size: 0.75rem;
|
|
text-decoration: none;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.kuka-base-filter__actions button {
|
|
border: 1px solid var(--kb-gold-dark);
|
|
background: var(--kb-gold-dark);
|
|
color: #fff;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.kuka-base-filter__actions a {
|
|
border: 1px solid var(--kb-border);
|
|
background: #fff;
|
|
color: var(--kb-ink);
|
|
}
|
|
|
|
.kuka-posting-amount {
|
|
margin-bottom: 1rem;
|
|
padding: 1rem;
|
|
border: 1px solid var(--kb-border);
|
|
border-radius: 0.75rem;
|
|
background: #fff;
|
|
}
|
|
|
|
.kuka-posting-amount__head {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
justify-content: space-between;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.kuka-posting-amount__title {
|
|
display: flex;
|
|
min-width: 0;
|
|
align-items: flex-start;
|
|
gap: 0.55rem;
|
|
}
|
|
|
|
.kuka-posting-amount__title .material-icons-outlined {
|
|
flex: 0 0 auto;
|
|
margin-top: 0.05rem;
|
|
color: var(--kb-gold-dark);
|
|
font-size: 1.15rem;
|
|
}
|
|
|
|
.kuka-posting-amount__title strong {
|
|
display: block;
|
|
font-size: 0.8125rem;
|
|
font-weight: 600;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.kuka-posting-amount__title p {
|
|
margin: 0.22rem 0 0;
|
|
color: var(--kb-muted);
|
|
font-size: 0.7rem;
|
|
line-height: 1.55;
|
|
}
|
|
|
|
.kuka-posting-amount__applied {
|
|
flex: 0 0 auto;
|
|
color: var(--kb-muted);
|
|
font-size: 0.68rem;
|
|
line-height: 1.5;
|
|
text-align: right;
|
|
}
|
|
|
|
.kuka-posting-amount__form {
|
|
display: grid;
|
|
grid-template-columns: minmax(15rem, 22rem) auto;
|
|
align-items: end;
|
|
gap: 0.65rem;
|
|
margin-top: 0.9rem;
|
|
padding-top: 0.85rem;
|
|
border-top: 1px solid #ebe6dd;
|
|
}
|
|
|
|
.kuka-posting-amount__form label {
|
|
display: grid;
|
|
gap: 0.28rem;
|
|
color: var(--kb-muted);
|
|
font-size: 0.7rem;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.kuka-posting-amount__form input {
|
|
width: 100%;
|
|
height: 2.125rem;
|
|
padding: 0 0.65rem;
|
|
border: 1px solid var(--kb-border);
|
|
border-radius: 0.5rem;
|
|
background: #fff;
|
|
color: var(--kb-ink);
|
|
font: inherit;
|
|
font-size: 0.8rem;
|
|
font-variant-numeric: tabular-nums;
|
|
outline: none;
|
|
text-align: right;
|
|
}
|
|
|
|
.kuka-posting-amount__form input:focus {
|
|
border-color: var(--kb-gold-dark);
|
|
box-shadow: 0 0 0 3px rgba(133, 102, 50, 0.16);
|
|
}
|
|
|
|
.kuka-posting-amount__form button,
|
|
.kuka-posting-amount__apply button {
|
|
display: inline-flex;
|
|
height: 2.125rem;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 0 0.9rem;
|
|
border: 1px solid var(--kb-gold-dark);
|
|
border-radius: 0.5rem;
|
|
background: var(--kb-gold-dark);
|
|
color: #fff;
|
|
font: inherit;
|
|
font-size: 0.75rem;
|
|
cursor: pointer;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.kuka-posting-amount__error,
|
|
.kuka-posting-amount__warning,
|
|
.kuka-posting-amount__success {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
gap: 0.45rem;
|
|
margin-top: 0.75rem;
|
|
padding: 0.65rem 0.75rem;
|
|
border-radius: 0.5rem;
|
|
font-size: 0.72rem;
|
|
line-height: 1.55;
|
|
}
|
|
|
|
.kuka-posting-amount__error {
|
|
border: 1px solid #dfbbbb;
|
|
background: #fff4f4;
|
|
color: var(--vip-danger, #b80000);
|
|
}
|
|
|
|
.kuka-posting-amount__warning {
|
|
border: 1px solid #e1c999;
|
|
background: #fff9ed;
|
|
color: var(--vip-warning, #935f07);
|
|
}
|
|
|
|
.kuka-posting-amount__success {
|
|
border: 1px solid #c8d8be;
|
|
background: #f5faf1;
|
|
color: var(--vip-success, #53793e);
|
|
}
|
|
|
|
.kuka-posting-amount__preview {
|
|
display: grid;
|
|
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
gap: 0.55rem;
|
|
margin-top: 0.75rem;
|
|
}
|
|
|
|
.kuka-posting-amount__metric {
|
|
min-width: 0;
|
|
padding: 0.6rem 0.7rem;
|
|
border: 1px solid #e8e1d5;
|
|
border-radius: 0.5rem;
|
|
background: #fffdf8;
|
|
}
|
|
|
|
.kuka-posting-amount__metric span {
|
|
display: block;
|
|
color: var(--kb-muted);
|
|
font-size: 0.66rem;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.kuka-posting-amount__metric strong {
|
|
display: block;
|
|
overflow: hidden;
|
|
margin-top: 0.18rem;
|
|
font-size: 0.82rem;
|
|
font-variant-numeric: tabular-nums;
|
|
line-height: 1.4;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.kuka-posting-amount__apply {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 1rem;
|
|
margin-top: 0.75rem;
|
|
padding-top: 0.75rem;
|
|
border-top: 1px solid #ebe6dd;
|
|
}
|
|
|
|
.kuka-posting-amount__apply p {
|
|
margin: 0;
|
|
color: var(--kb-muted);
|
|
font-size: 0.7rem;
|
|
line-height: 1.55;
|
|
}
|
|
|
|
@media (max-width: 980px) {
|
|
.kuka-posting-amount__preview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
}
|
|
|
|
@media (max-width: 1180px) {
|
|
.kuka-base-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
.kuka-base-filter__actions { grid-column: 1 / -1; }
|
|
}
|
|
|
|
@media (max-width: 760px) {
|
|
.kuka-base-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
.kuka-base-filter { grid-template-columns: 1fr; }
|
|
.kuka-posting-amount__head,
|
|
.kuka-posting-amount__apply { flex-direction: column; align-items: stretch; }
|
|
.kuka-posting-amount__applied { text-align: left; }
|
|
.kuka-posting-amount__form { grid-template-columns: 1fr; }
|
|
.kuka-posting-amount__preview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
}
|
|
</style>
|
|
|
|
<div class="kuka-base-page">
|
|
@if ($error)
|
|
<div class="kuka-base-alert" role="alert">
|
|
<span class="material-icons-outlined" aria-hidden="true">error_outline</span>
|
|
<span>{{ $error }}</span>
|
|
</div>
|
|
@endif
|
|
|
|
<section class="kuka-posting-amount" data-kuka-posting-amount-panel aria-label="整月过账金额">
|
|
<div class="kuka-posting-amount__head">
|
|
<div class="kuka-posting-amount__title">
|
|
<span class="material-icons-outlined" aria-hidden="true">account_balance_wallet</span>
|
|
<div>
|
|
<strong>整月过账金额</strong>
|
|
<p>按每个料号本月发货金额占比分配,同料号按发货日期优先选择;只有“是”明细合计与整月金额完全一致时才允许写入标签。</p>
|
|
</div>
|
|
</div>
|
|
@if ($postingAmount)
|
|
<div class="kuka-posting-amount__applied">
|
|
<div>上次过账 {{ number_format((float) $postingAmount['target_amount'], 2) }}</div>
|
|
<div>{{ $postingAmount['applied_at'] ? \Illuminate\Support\Carbon::parse($postingAmount['applied_at'])->format('Y-m-d H:i') : '时间未记录' }}</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
<form class="kuka-posting-amount__form" method="POST" action="{{ route('business.kuka-posting-amount.preview') }}">
|
|
@csrf
|
|
<input type="hidden" name="period" value="{{ $filters['period'] ?? '' }}">
|
|
<input type="hidden" name="store_name" value="{{ $filters['store_name'] ?? '' }}">
|
|
<input type="hidden" name="status" value="{{ $filters['status'] ?? '' }}">
|
|
<input type="hidden" name="keyword" value="{{ $filters['keyword'] ?? '' }}">
|
|
<input type="hidden" name="per_page" value="{{ (int) ($filters['per_page'] ?? 50) }}">
|
|
<label>
|
|
填写整月总过账金额
|
|
<input
|
|
type="text"
|
|
name="target_amount"
|
|
value="{{ $postingTargetValue }}"
|
|
inputmode="decimal"
|
|
autocomplete="off"
|
|
placeholder="例如 1661276.90"
|
|
aria-label="整月总过账金额"
|
|
>
|
|
</label>
|
|
<button type="submit">计算分配方案</button>
|
|
</form>
|
|
|
|
@if ($postingAmountError)
|
|
<div class="kuka-posting-amount__error" role="alert">
|
|
<span class="material-icons-outlined" aria-hidden="true">error_outline</span>
|
|
<span>{{ $postingAmountError }}</span>
|
|
</div>
|
|
@endif
|
|
|
|
@if (is_array($postingPreview))
|
|
@php
|
|
$previewExact = (bool) ($postingPreview['is_exact'] ?? false);
|
|
$previewDifference = (int) ($postingPreview['difference_cents'] ?? 0);
|
|
@endphp
|
|
<div class="{{ $previewExact ? 'kuka-posting-amount__success' : 'kuka-posting-amount__warning' }}" role="status">
|
|
<span class="material-icons-outlined" aria-hidden="true">{{ $previewExact ? 'verified' : 'warning_amber' }}</span>
|
|
<span>
|
|
@if ($previewExact)
|
|
方案已精确匹配到分,可以确认写入过账标签。
|
|
@else
|
|
当前方案与整月过账金额相差 {{ number_format(abs($previewDifference) / 100, 2) }},系统不会写入任何标签,请调整整月金额后重新计算。
|
|
@endif
|
|
</span>
|
|
</div>
|
|
<div class="kuka-posting-amount__preview" aria-label="过账分配预览">
|
|
<div class="kuka-posting-amount__metric">
|
|
<span>整月过账金额</span>
|
|
<strong>{{ number_format((int) $postingPreview['target_cents'] / 100, 2) }}</strong>
|
|
</div>
|
|
<div class="kuka-posting-amount__metric">
|
|
<span>选中发货金额</span>
|
|
<strong>{{ number_format((int) $postingPreview['selected_cents'] / 100, 2) }}</strong>
|
|
</div>
|
|
<div class="kuka-posting-amount__metric">
|
|
<span>差额</span>
|
|
<strong>{{ number_format(abs((int) $postingPreview['difference_cents']) / 100, 2) }}</strong>
|
|
</div>
|
|
<div class="kuka-posting-amount__metric">
|
|
<span>“是”行 / 料号</span>
|
|
<strong>{{ number_format((int) $postingPreview['selected_rows']) }} / {{ number_format((int) $postingPreview['selected_material_count']) }}</strong>
|
|
</div>
|
|
<div class="kuka-posting-amount__metric">
|
|
<span>无法计算金额行</span>
|
|
<strong>{{ number_format((int) $postingPreview['uncalculable_rows']) }}</strong>
|
|
</div>
|
|
</div>
|
|
@if ($previewExact)
|
|
<form class="kuka-posting-amount__apply" method="POST" action="{{ route('business.kuka-posting-amount.apply') }}">
|
|
@csrf
|
|
<input type="hidden" name="period" value="{{ $postingPreview['period'] }}">
|
|
<input type="hidden" name="target_amount" value="{{ $postingPreview['target_amount'] }}">
|
|
<input type="hidden" name="preview_hash" value="{{ $postingPreview['preview_hash'] }}">
|
|
<input type="hidden" name="store_name" value="{{ $filters['store_name'] ?? '' }}">
|
|
<input type="hidden" name="status" value="{{ $filters['status'] ?? '' }}">
|
|
<input type="hidden" name="keyword" value="{{ $filters['keyword'] ?? '' }}">
|
|
<input type="hidden" name="per_page" value="{{ (int) ($filters['per_page'] ?? 50) }}">
|
|
<p>确认后,“是”明细进入顾家对账;其余明细统一标记为“补单(订单四组)”。</p>
|
|
<button type="submit">确认写入过账标签</button>
|
|
</form>
|
|
@endif
|
|
@endif
|
|
</section>
|
|
|
|
<section class="kuka-base-summary" aria-label="基础数据汇总">
|
|
<article class="kuka-base-card">
|
|
<span>账期</span>
|
|
<strong>{{ $filters['period'] ?? '—' }}</strong>
|
|
<small>当前筛选账期</small>
|
|
</article>
|
|
<article class="kuka-base-card">
|
|
<span>原始数据行</span>
|
|
<strong>{{ number_format((int) ($summary['rows'] ?? 0)) }}</strong>
|
|
<small>当前筛选 {{ number_format((int) ($summary['filtered_rows'] ?? 0)) }} 行</small>
|
|
</article>
|
|
<article class="kuka-base-card">
|
|
<span>店铺 / 订单</span>
|
|
<strong>{{ number_format((int) ($summary['stores'] ?? 0)) }} / {{ number_format((int) ($summary['orders'] ?? 0)) }}</strong>
|
|
<small>仅包含指定店铺</small>
|
|
</article>
|
|
<article class="kuka-base-card">
|
|
<span>最近导入</span>
|
|
<strong>{{ $summary['completed_at'] ? \Illuminate\Support\Carbon::parse($summary['completed_at'])->format('Y-m-d H:i') : '尚未导入' }}</strong>
|
|
<small>{{ $import['source_sheet'] ?? '等待首次导入' }}</small>
|
|
</article>
|
|
</section>
|
|
|
|
<form class="kuka-base-filter" method="GET" action="{{ route('business.pages.show', ['section' => 'posting-data', 'page' => 'kuka-basic-data']) }}">
|
|
<label>
|
|
账期
|
|
<select name="period">
|
|
@if ($periods === [])
|
|
<option value="{{ $filters['period'] ?? '' }}">{{ $filters['period'] ?? '尚无数据' }}</option>
|
|
@endif
|
|
@foreach ($periods as $period)
|
|
<option value="{{ $period }}" @selected(($filters['period'] ?? '') === $period)>{{ $period }}</option>
|
|
@endforeach
|
|
</select>
|
|
</label>
|
|
<label>
|
|
店铺
|
|
<select name="store_name">
|
|
<option value="">全部指定店铺</option>
|
|
@foreach ($stores as $store)
|
|
<option value="{{ $store }}" @selected(($filters['store_name'] ?? '') === $store)>{{ $store }}</option>
|
|
@endforeach
|
|
</select>
|
|
</label>
|
|
<label>
|
|
订单状态
|
|
<select name="status">
|
|
<option value="">全部状态</option>
|
|
@foreach ($statuses as $status)
|
|
<option value="{{ $status }}" @selected(($filters['status'] ?? '') === $status)>{{ $status }}</option>
|
|
@endforeach
|
|
</select>
|
|
</label>
|
|
<label>
|
|
内部单号 / 线上单号 / 商品编码
|
|
<input type="search" name="keyword" value="{{ $filters['keyword'] ?? '' }}" placeholder="输入单号或商品编码" autocomplete="off">
|
|
</label>
|
|
<label>
|
|
每页
|
|
<select name="per_page">
|
|
@foreach ([50, 100, 200] as $size)
|
|
<option value="{{ $size }}" @selected((int) ($filters['per_page'] ?? 50) === $size)>{{ $size }} 行</option>
|
|
@endforeach
|
|
</select>
|
|
</label>
|
|
<div class="kuka-base-filter__actions">
|
|
<button type="submit">查询</button>
|
|
<a href="{{ $resetUrl }}">重置</a>
|
|
</div>
|
|
</form>
|
|
|
|
@include('business.pages.partials.directory-table', [
|
|
'directory' => $directory,
|
|
'rows' => $baseRows,
|
|
'section' => $section,
|
|
'page' => $page,
|
|
'upstreamError' => $error,
|
|
'showDirectoryIntro' => false,
|
|
'showDirectoryIndex' => false,
|
|
'enableColumnResize' => true,
|
|
'columnWidths' => config('kuka_posting.field_widths', []),
|
|
'columnPreferenceVersion' => 'kuka-shipment-columns-v4',
|
|
])
|
|
</div>
|