附加费结算:明细行点击高亮,方便核对时标记当前行 (#317)
This commit is contained in:
parent
7ecd5a59e6
commit
f663ddc51f
@ -161,6 +161,14 @@
|
||||
.settlement-table td[data-finance-fixed="end"] { background: #fffdf8; }
|
||||
.settlement-table td { overflow: hidden; text-overflow: ellipsis; }
|
||||
.settlement-table .settlement-empty td { min-width: 22rem; padding: 3rem 1rem; text-align: center; color: var(--settlement-muted); white-space: normal; }
|
||||
.settlement-table tbody tr.is-clickable { cursor: pointer; }
|
||||
.settlement-table tbody tr.is-clickable:not(.is-active):hover td,
|
||||
.settlement-table tbody tr.is-clickable:not(.is-active):hover td[data-finance-fixed="true"],
|
||||
.settlement-table tbody tr.is-clickable:not(.is-active):hover td[data-finance-fixed="end"] { background: #fcfaf5; }
|
||||
.settlement-table tbody tr.is-active td,
|
||||
.settlement-table tbody tr.is-active td[data-finance-fixed="true"],
|
||||
.settlement-table tbody tr.is-active td[data-finance-fixed="end"] { background: var(--settlement-soft); border-bottom-color: #e4d7ba; }
|
||||
.settlement-table tbody tr.is-active td:first-child { box-shadow: inset 3px 0 0 var(--settlement-accent); }
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.settlement-summary { grid-template-columns: 1fr 1fr; }
|
||||
@ -233,7 +241,7 @@
|
||||
</form>
|
||||
|
||||
<div class="settlement-table-surface" data-finance-table-surface>
|
||||
<div class="settlement-table-head"><div><div class="settlement-table-title"><span class="material-icons-outlined" aria-hidden="true">table_view</span>附加费结算明细</div><div class="settlement-table-hint">快递名称和附加费类型固定显示,其余字段可在“列设置”中调整。</div></div><div class="finance-table-controls" data-finance-controls><span class="settlement-table-hint">列设置按当前用户和本页面保存</span></div></div>
|
||||
<div class="settlement-table-head"><div><div class="settlement-table-title"><span class="material-icons-outlined" aria-hidden="true">table_view</span>附加费结算明细</div><div class="settlement-table-hint">快递名称和附加费类型固定显示,其余字段可在“列设置”中调整;点击行可高亮标记。</div></div><div class="finance-table-controls" data-finance-controls><span class="settlement-table-hint">列设置按当前用户和本页面保存</span></div></div>
|
||||
<div class="settlement-table-meta"><span>当前筛选结果:<strong>{{ number_format((int) ($summary['count'] ?? $rows->total()), 0) }}</strong> 条</span><span>数据状态:{{ $syncLabel }}@if (! empty($sync['last_succeeded_at'])),最近同步 {{ $sync['last_succeeded_at'] }}@endif</span></div>
|
||||
<div class="settlement-table-scroll finance-table-scroll-owner">
|
||||
<table class="settlement-table" data-finance-table data-finance-table-name="courier-surcharge-settlement" data-finance-table-key="{{ auth()->id() }}:{{ company_id() }}:courier-payables:courier-surcharge:settlement:details" aria-label="附加费结算明细">
|
||||
@ -244,7 +252,7 @@
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
@forelse ($rows as $row)
|
||||
<tr>
|
||||
<tr class="is-clickable" data-settlement-row>
|
||||
@foreach ($columns as $column)
|
||||
<td data-finance-column-key="{{ $column['key'] }}" data-export-value="{{ $displayValue(data_get($row, $column['key']), $column['key']) }}">{{ $displayValue(data_get($row, $column['key']), $column['key']) }}</td>
|
||||
@endforeach
|
||||
@ -261,3 +269,31 @@
|
||||
<div class="settlement-pagination">{{ $rows->withQueryString()->links() }}</div>
|
||||
@endif
|
||||
</section>
|
||||
|
||||
<script>
|
||||
(() => {
|
||||
const table = document.querySelector('table[data-finance-table-name="courier-surcharge-settlement"]');
|
||||
|
||||
if (!table) {
|
||||
return;
|
||||
}
|
||||
|
||||
const activate = (row) => {
|
||||
table.querySelectorAll('tbody tr.is-active').forEach((item) => item.classList.remove('is-active'));
|
||||
row.classList.add('is-active');
|
||||
};
|
||||
|
||||
document.addEventListener('click', (event) => {
|
||||
if (!(event.target instanceof Element) || event.target.closest('a, button, input, label, select')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const row = event.target.closest('tr[data-settlement-row]');
|
||||
|
||||
if (row && table.contains(row)) {
|
||||
event.preventDefault();
|
||||
activate(row);
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
@ -111,6 +111,53 @@ class CourierSurchargeSettlementPageTest extends FeatureTestCase
|
||||
->assertSeeText('附加费结算');
|
||||
}
|
||||
|
||||
public function test_settlement_rows_support_click_highlight(): void
|
||||
{
|
||||
$this->user->attachPermission(Permission::where('name', 'read-admin-panel')->firstOrFail());
|
||||
|
||||
$repository = Mockery::mock(CourierSurchargeSettlementMirrorRepository::class);
|
||||
$repository->shouldReceive('available')->andReturn(true);
|
||||
$repository->shouldReceive('ready')->andReturn(true);
|
||||
$repository->shouldReceive('paginate')->andReturn([
|
||||
'data' => [[
|
||||
'courier_name' => '曹县德邦',
|
||||
'shipped_at' => '2026-10-12 18:38:33',
|
||||
'waybill' => 'DPK317248316615',
|
||||
'platform_product_id' => '993815011271',
|
||||
'product_code' => 'MKHDNZ0409260601380',
|
||||
'shop_name' => '拼多多-HX旗舰店101',
|
||||
'online_order_no' => '260912-325069063762746',
|
||||
'length' => 168,
|
||||
'width' => 30,
|
||||
'height' => 20,
|
||||
'volume' => 100800,
|
||||
'inspection_type' => null,
|
||||
'inspection_reason' => null,
|
||||
'return_waybill_no' => null,
|
||||
'settlement_weight' => null,
|
||||
'settlement_amount' => 8,
|
||||
'surcharge_type' => '超长费',
|
||||
]],
|
||||
'total' => 1,
|
||||
'has_more' => false,
|
||||
'summary' => ['count' => 1, 'settlement_amount' => 8.0],
|
||||
'sync' => ['code' => 'fresh', 'last_succeeded_at' => '2026-10-13 06:31:34'],
|
||||
'state' => ['code' => 'fresh', 'last_succeeded_at' => '2026-10-13 06:31:34'],
|
||||
]);
|
||||
$this->app->instance(CourierSurchargeSettlementMirrorRepository::class, $repository);
|
||||
|
||||
$this->loginAs()->get(route('business.pages.show', [
|
||||
'section' => 'courier-payables',
|
||||
'page' => 'courier-surcharge-settlement',
|
||||
]))->assertOk()
|
||||
->assertSee('data-settlement-row', false)
|
||||
->assertSee('is-clickable', false)
|
||||
->assertSee('is-active', false)
|
||||
->assertSeeText('点击行可高亮标记')
|
||||
->assertSeeText('曹县德邦')
|
||||
->assertSeeText('超长费');
|
||||
}
|
||||
|
||||
public function test_settlement_export_streams_filtered_rows_as_xlsx(): void
|
||||
{
|
||||
$this->user->attachPermission(Permission::where('name', 'read-admin-panel')->firstOrFail());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user