移除三方仓进销存费用汇总入口 #189
@ -87,19 +87,6 @@
|
||||
: (is_countable($rows) ? count($rows) : 0);
|
||||
$summaryReady = ! $pending && collect(['count', 'opening_qty', 'closing_qty'])
|
||||
->every(static fn (string $key): bool => array_key_exists($key, $summary));
|
||||
$settlement = [
|
||||
'ready' => false, 'complete' => false,
|
||||
'inbound_fee' => 0, 'outbound_fee' => 0, 'storage_fee' => 0, 'total_fee' => 0,
|
||||
'message' => null,
|
||||
];
|
||||
if ($summaryReady) {
|
||||
try {
|
||||
$settlement = app(\Modules\EcommerceFinance\Services\ThirdPartyWarehouseStorageSettlementService::class)->settle($filters);
|
||||
} catch (\Throwable) {
|
||||
$settlement['message'] = '仓储费暂时无法核算,请稍后重试。';
|
||||
}
|
||||
}
|
||||
$settlementComplete = ($settlement['ready'] ?? false) && ($settlement['complete'] ?? false);
|
||||
$showingLastVersion = $rowTotal > 0 && ($error !== '' || in_array($statusCode, [
|
||||
'syncing', 'reconciling', 'stale', 'delayed', 'failed',
|
||||
], true));
|
||||
@ -108,7 +95,6 @@
|
||||
$filters,
|
||||
static fn (mixed $value): bool => $value !== null && $value !== ''
|
||||
);
|
||||
$settlementExportUrl = route('business.courier-payables.third-party-warehouse-storage.settlement-export', $activeFilters);
|
||||
if (is_object($rows) && method_exists($rows, 'appends')) {
|
||||
$rows->appends($activeFilters);
|
||||
}
|
||||
@ -233,7 +219,7 @@
|
||||
.third-party-warehouse-actions [data-finance-server-export] { display:none; }
|
||||
.third-party-warehouse-page[data-finance-enhanced] .third-party-warehouse-actions [data-finance-server-export] { display:inline-flex; }
|
||||
.third-party-warehouse-page .finance-table-field-picker__panel { right:0; left:auto; }
|
||||
.third-party-warehouse-summary { display:grid; grid-template-columns:repeat(7,minmax(8rem,1fr)); overflow:hidden; border:1px solid var(--warehouse-border); border-radius:.5rem; background:#fff; }
|
||||
.third-party-warehouse-summary { display:grid; grid-template-columns:repeat(3,minmax(8rem,1fr)); overflow:hidden; border:1px solid var(--warehouse-border); border-radius:.5rem; background:#fff; }
|
||||
.third-party-warehouse-summary__item { min-width:0; padding:.625rem .75rem; border-right:1px solid var(--warehouse-border); }
|
||||
.third-party-warehouse-summary__item:last-child { border-right:0; }
|
||||
.third-party-warehouse-summary__label { display:block; color:var(--warehouse-muted); font-size:.7rem; }
|
||||
@ -377,13 +363,6 @@
|
||||
<button type="button" data-finance-server-export="all" @disabled(! $canExport)>
|
||||
<span class="material-icons-outlined" aria-hidden="true">download</span><span>导出全部列</span>
|
||||
</button>
|
||||
<a
|
||||
@class(['third-party-warehouse-button', 'is-primary' => $settlementComplete, 'is-disabled' => ! $settlementComplete])
|
||||
href="{{ $settlementComplete ? $settlementExportUrl : '#' }}"
|
||||
@if (! $settlementComplete) aria-disabled="true" @endif
|
||||
>
|
||||
<span class="material-icons-outlined" aria-hidden="true">receipt_long</span><span>导出仓储费核算</span>
|
||||
</a>
|
||||
<div class="finance-table-field-picker" data-finance-field-picker>
|
||||
<button type="button" class="third-party-warehouse-button" aria-expanded="false">
|
||||
<span class="material-icons-outlined" aria-hidden="true">view_column</span><span>列设置</span>
|
||||
@ -398,18 +377,11 @@
|
||||
['key' => 'count', 'label' => '明细记录数', 'type' => 'count'],
|
||||
['key' => 'opening_qty', 'label' => '期初数量合计', 'type' => 'number'],
|
||||
['key' => 'closing_qty', 'label' => '期末数量合计', 'type' => 'number'],
|
||||
['key' => 'inbound_fee', 'label' => '入库管理费', 'type' => 'money'],
|
||||
['key' => 'outbound_fee', 'label' => '出库费用', 'type' => 'money'],
|
||||
['key' => 'storage_fee', 'label' => '仓储费', 'type' => 'money'],
|
||||
['key' => 'total_fee', 'label' => '应结算合计', 'type' => 'money'],
|
||||
] as $metric)
|
||||
@php
|
||||
$metricValue = in_array($metric['key'], ['inbound_fee', 'outbound_fee', 'storage_fee', 'total_fee'], true)
|
||||
? ($settlementComplete ? ($settlement[$metric['key']] ?? null) : null)
|
||||
: ($summaryReady ? ($summary[$metric['key']] ?? null) : null);
|
||||
$metricValue = $summaryReady ? ($summary[$metric['key']] ?? null) : null;
|
||||
$metricDisplay = match ($metric['type']) {
|
||||
'count' => $metricValue === null ? '—' : number_format((int) $metricValue),
|
||||
'money' => $metricValue === null ? '—' : '¥ ' . $money($metricValue),
|
||||
default => $metricValue === null ? '—' : $number($metricValue),
|
||||
};
|
||||
@endphp
|
||||
@ -420,13 +392,6 @@
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@if (! empty($settlement['message']))
|
||||
<div class="third-party-warehouse-notice" role="status">
|
||||
<span class="material-icons-outlined" aria-hidden="true">info</span>
|
||||
<span>{{ $settlement['message'] }}</span>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="third-party-warehouse-table-panel">
|
||||
<div class="third-party-warehouse-table-scroll finance-table-scroll-owner">
|
||||
<table
|
||||
|
||||
@ -76,6 +76,23 @@ class ThirdPartyWarehouseStorageViewTest extends TestCase
|
||||
$this->assertStringContainsString('referrerpolicy="no-referrer"', $source);
|
||||
}
|
||||
|
||||
public function test_summary_only_displays_inventory_counts(): void
|
||||
{
|
||||
$source = $this->viewSource();
|
||||
|
||||
$this->assertStringContainsString('grid-template-columns:repeat(3,minmax(8rem,1fr))', $source);
|
||||
$this->assertStringContainsString("['key' => 'count', 'label' => '明细记录数'", $source);
|
||||
$this->assertStringContainsString("['key' => 'opening_qty', 'label' => '期初数量合计'", $source);
|
||||
$this->assertStringContainsString("['key' => 'closing_qty', 'label' => '期末数量合计'", $source);
|
||||
$this->assertStringNotContainsString("['key' => 'inbound_fee'", $source);
|
||||
$this->assertStringNotContainsString("['key' => 'outbound_fee'", $source);
|
||||
$this->assertStringNotContainsString("['key' => 'storage_fee'", $source);
|
||||
$this->assertStringNotContainsString("['key' => 'total_fee'", $source);
|
||||
$this->assertStringNotContainsString('ThirdPartyWarehouseStorageSettlementService', $source);
|
||||
$this->assertStringNotContainsString('导出仓储费核算', $source);
|
||||
$this->assertStringNotContainsString('仓储费暂时无法核算', $source);
|
||||
}
|
||||
|
||||
private function viewSource(): string
|
||||
{
|
||||
$root = dirname(__DIR__, 3);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user