diff --git a/tests/Feature/Business/BankBillPageTest.php b/tests/Feature/Business/BankBillPageTest.php
index 83ba2f9ed..95b91c445 100644
--- a/tests/Feature/Business/BankBillPageTest.php
+++ b/tests/Feature/Business/BankBillPageTest.php
@@ -88,6 +88,27 @@ class BankBillPageTest extends FeatureTestCase
$this->assertStringContainsString('12,000.00', $html);
$this->assertStringContainsString('列设置', $html);
$this->assertStringContainsString('data-bank-bill-column-picker', $html);
+ $this->assertStringContainsString('data-ledger-date-range', $html);
+ $this->assertStringContainsString('name="bills_bank"', $html);
+ $this->assertStringContainsString('name="bills_account_no"', $html);
+ $this->assertStringContainsString('name="bills_from"', $html);
+ $this->assertStringContainsString('name="bills_to"', $html);
+ $this->assertStringContainsString('value="2026-11-01"', $html);
+ $this->assertStringContainsString('value="2026-11-30"', $html);
+ $this->assertStringContainsString('查询时间段', $html);
+ }
+
+ public function test_bank_bill_filters_default_to_the_current_month(): void
+ {
+ $html = $this->loginAs()->get($this->ledgerUrl([
+ 'tab' => 'bills',
+ ]))->assertOk()->getContent();
+
+ $this->assertStringContainsString('data-ledger-date-range', $html);
+ $this->assertStringContainsString('value="2026-11-01"', $html);
+ $this->assertStringContainsString('value="2026-11-30"', $html);
+ $this->assertStringContainsString('>全部账户', $html);
+ $this->assertStringContainsString('value="all" selected>全部', $html);
}
public function test_configured_headers_are_visible_when_the_bank_has_no_bill_rows(): void
@@ -210,7 +231,7 @@ class BankBillPageTest extends FeatureTestCase
$response->assertSee('data-bank-bill-header-filter', false);
$response->assertSee('筛选和排序:银行账号', false);
- $response->assertDontSee('data-bank-bill-date-filter', false);
+ $response->assertSee('data-ledger-date-range', false);
$response->assertSee('data-bank-bill-header-filter', false);
$response->assertSee('筛选和排序:账务时间', false);
$response->assertSeeText('升序');
--
2.47.2
From 19c5555373e3a30797b3aafbf26f874cb8683e2b Mon Sep 17 00:00:00 2001
From: yueyang <2495544247@qq.com>
Date: Thu, 3 Dec 2026 17:39:28 +0800
Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=B0=8F?=
=?UTF-8?q?=E9=A2=9D=E6=89=93=E6=AC=BE=E5=BA=97=E9=93=BA=E6=B1=87=E6=80=BB?=
=?UTF-8?q?=20(#1706)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/Http/Controllers/Business/Pages.php | 5 +
.../SmallPaymentWorkOrderMirrorRepository.php | 55 ++-
.../small-payment-work-orders.blade.php | 335 +++++++++++++++++-
.../SmallPaymentWorkOrderPageTest.php | 12 +
...llPaymentWorkOrderMirrorRepositoryTest.php | 17 +
5 files changed, 415 insertions(+), 9 deletions(-)
diff --git a/app/Http/Controllers/Business/Pages.php b/app/Http/Controllers/Business/Pages.php
index 4171d224d..c24bee5ce 100644
--- a/app/Http/Controllers/Business/Pages.php
+++ b/app/Http/Controllers/Business/Pages.php
@@ -8806,6 +8806,7 @@ class Pages extends Controller
$syncStatus = ['code' => 'unavailable', 'last_succeeded_at' => null];
$pagePaymentAmount = '0.00';
$filteredPaymentAmount = '0.00';
+ $storePaymentSummary = [];
$shopNames = [];
$paymentReasons = [];
$error = null;
@@ -8850,6 +8851,9 @@ class Pages extends Controller
);
$pagePaymentAmount = (string) ($result['page_payment_amount'] ?? '0.00');
$filteredPaymentAmount = (string) ($result['filtered_payment_amount'] ?? '0.00');
+ $storePaymentSummary = is_array($result['store_summary'] ?? null)
+ ? $result['store_summary']
+ : [];
}
}
} catch (Throwable $exception) {
@@ -8864,6 +8868,7 @@ class Pages extends Controller
'smallPaymentSyncStatus' => $syncStatus,
'smallPaymentPageAmount' => $pagePaymentAmount,
'smallPaymentFilteredAmount' => $filteredPaymentAmount,
+ 'smallPaymentStoreSummary' => $storePaymentSummary,
'smallPaymentShops' => $shopNames,
'smallPaymentReasons' => $paymentReasons,
'smallPaymentStatuses' => [
diff --git a/modules/EcommerceFinance/Repositories/SmallPaymentWorkOrderMirrorRepository.php b/modules/EcommerceFinance/Repositories/SmallPaymentWorkOrderMirrorRepository.php
index 8ea873995..fd7bf0a5a 100644
--- a/modules/EcommerceFinance/Repositories/SmallPaymentWorkOrderMirrorRepository.php
+++ b/modules/EcommerceFinance/Repositories/SmallPaymentWorkOrderMirrorRepository.php
@@ -163,7 +163,13 @@ class SmallPaymentWorkOrderMirrorRepository
/**
* @param array{from:string,to:string,work_order_no:string,shop_name:string,transaction_no:string,online_order_no:string,status:string,payment_reason:string} $filters
- * @return array{data:list
>,total:int,page_payment_amount:string,filtered_payment_amount:string}
+ * @return array{
+ * data:list>,
+ * total:int,
+ * page_payment_amount:string,
+ * filtered_payment_amount:string,
+ * store_summary:list
+ * }
*/
public function paginate(array $filters, int $page, int $perPage): array
{
@@ -188,6 +194,7 @@ class SmallPaymentWorkOrderMirrorRepository
'total' => $summary['count'],
'page_payment_amount' => $this->sumMoney(array_column($rows, 'payment_amount')),
'filtered_payment_amount' => $summary['payment_amount'],
+ 'store_summary' => $summary['store_summary'],
];
}
@@ -206,7 +213,11 @@ class SmallPaymentWorkOrderMirrorRepository
/**
* @param array{from:string,to:string,work_order_no:string,shop_name:string,transaction_no:string,online_order_no:string,status:string,payment_reason:string} $filters
- * @return array{count:int,payment_amount:string}
+ * @return array{
+ * count:int,
+ * payment_amount:string,
+ * store_summary:list
+ * }
*/
private function filteredSummary(array $filters, int $chunkSize = 1000): array
{
@@ -224,7 +235,11 @@ class SmallPaymentWorkOrderMirrorRepository
/**
* @param array{from:string,to:string,work_order_no:string,shop_name:string,transaction_no:string,online_order_no:string,status:string,payment_reason:string} $filters
- * @return array{count:int,payment_amount:string}
+ * @return array{
+ * count:int,
+ * payment_amount:string,
+ * store_summary:list
+ * }
*/
private function calculateFilteredSummary(array $filters, int $chunkSize): array
{
@@ -237,23 +252,49 @@ class SmallPaymentWorkOrderMirrorRepository
$cents = 0;
$count = 0;
$lastId = null;
+ $shops = [];
do {
$chunk = $this->boundedGet((clone $query)
- ->select(['w.Id AS source_id', 'w.businessFieldList'])
+ ->select(['w.Id AS source_id', 'w.businessFieldList', 'p.shop_name'])
->when($lastId !== null, static fn (Builder $q): Builder => $q->where('w.Id', '>', $lastId))
->orderBy('w.Id')
->limit($chunkSize));
foreach ($chunk as $row) {
- $cents += $this->centsFromMoney($this->paymentAmountOf($row->businessFieldList ?? null));
+ $rowCents = $this->centsFromMoney($this->paymentAmountOf($row->businessFieldList ?? null));
+ $shopName = trim((string) ($row->shop_name ?? '')) ?: '未填写店铺';
+ $shops[$shopName] ??= ['work_order_count' => 0, 'cents' => 0];
+ $shops[$shopName]['work_order_count']++;
+ $shops[$shopName]['cents'] += $rowCents;
+ $cents += $rowCents;
}
$count += $chunk->count();
$lastId = $chunk->isEmpty() ? null : $chunk->last()->source_id;
} while ($chunk->count() === $chunkSize);
- return ['count' => $count, 'payment_amount' => $this->formatCents($cents)];
+ $storeSummary = [];
+ foreach ($shops as $shopName => $shop) {
+ $storeSummary[] = [
+ 'shop_name' => $shopName,
+ 'work_order_count' => $shop['work_order_count'],
+ 'payment_amount' => $this->formatCents($shop['cents']),
+ ];
+ }
+ usort($storeSummary, static function (array $left, array $right): int {
+ $amountOrder = abs((float) $right['payment_amount']) <=> abs((float) $left['payment_amount']);
+
+ return $amountOrder !== 0
+ ? $amountOrder
+ : strcmp($left['shop_name'], $right['shop_name']);
+ });
+
+ return [
+ 'count' => $count,
+ 'payment_amount' => $this->formatCents($cents),
+ 'store_summary' => $storeSummary,
+ ];
}
private function paymentAmountOf(mixed $businessFieldList): ?string
@@ -717,7 +758,7 @@ class SmallPaymentWorkOrderMirrorRepository
$normalized = array_map(static fn (mixed $value): string => trim((string) $value), $filters);
ksort($normalized);
- return 'small-payment-work-orders:summary:v1:' . hash(
+ return 'small-payment-work-orders:summary:v2:' . hash(
'sha256',
(string) json_encode($normalized, JSON_UNESCAPED_UNICODE),
);
diff --git a/resources/views/business/pages/refunds/small-payment-work-orders.blade.php b/resources/views/business/pages/refunds/small-payment-work-orders.blade.php
index 21aa056d4..e09ea5cc0 100644
--- a/resources/views/business/pages/refunds/small-payment-work-orders.blade.php
+++ b/resources/views/business/pages/refunds/small-payment-work-orders.blade.php
@@ -28,6 +28,7 @@
['label' => '完成时间', 'field' => 'completed_at'],
];
$syncCode = $smallPaymentSyncStatus['code'] ?? 'unavailable';
+ $storeSummary = $smallPaymentStoreSummary ?? [];
$syncLabel = match ($syncCode) {
'healthy' => '业务镜像已同步',
'syncing' => '业务镜像同步中,当前显示最近成功数据',
@@ -73,6 +74,26 @@
border-radius: 0.5rem;
background: var(--vip-surface, #ffffff);
}
+ .small-payment-summary__drilldown {
+ display: block;
+ color: inherit;
+ cursor: pointer;
+ font: inherit;
+ text-align: left;
+ }
+ .small-payment-summary__drilldown:hover {
+ border-color: var(--vip-content-accent-dark, #856632);
+ background: var(--vip-content-accent-soft, #f7f0de);
+ }
+ .small-payment-summary__drilldown:focus-visible {
+ border-color: var(--vip-content-accent-dark, #856632);
+ box-shadow: 0 0 0 3px rgba(133, 102, 50, 0.2);
+ outline: none;
+ }
+ .small-payment-summary__drilldown:disabled {
+ cursor: default;
+ opacity: 0.55;
+ }
.small-payment-summary__label {
display: block;
color: var(--vip-content-muted, #595959);
@@ -86,6 +107,160 @@
font-variant-numeric: tabular-nums;
font-weight: 600;
}
+ .small-payment-summary__hint {
+ display: block;
+ margin-top: 0.3rem;
+ color: var(--vip-content-accent-dark, #856632);
+ font-size: 0.6875rem;
+ font-weight: 600;
+ }
+ .small-payment-store-dialog {
+ width: min(44rem, calc(100vw - 2rem));
+ max-width: none;
+ max-height: calc(100vh - 2rem);
+ box-sizing: border-box;
+ padding: 0;
+ border: 1px solid var(--vip-border, #d8d2c7);
+ border-radius: 0.75rem;
+ background: var(--vip-surface, #ffffff);
+ color: var(--vip-content-ink, #171717);
+ box-shadow: 0 10px 30px rgba(23, 23, 23, 0.18);
+ }
+ .small-payment-store-dialog::backdrop { background: rgba(23, 23, 23, 0.38); }
+ .small-payment-store-dialog[open] {
+ display: flex;
+ flex-direction: column;
+ }
+ .small-payment-store-dialog__head {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 1rem 1.1rem 0.8rem;
+ border-bottom: 1px solid var(--vip-border, #d8d2c7);
+ }
+ .small-payment-store-dialog__head h2 {
+ margin: 0;
+ font-size: 0.9375rem;
+ }
+ .small-payment-store-dialog__head p {
+ margin: 0.25rem 0 0;
+ color: var(--vip-content-muted, #595959);
+ font-size: 0.6875rem;
+ }
+ .small-payment-store-dialog__side {
+ display: flex;
+ align-items: flex-start;
+ gap: 1rem;
+ }
+ .small-payment-store-dialog__total {
+ text-align: right;
+ }
+ .small-payment-store-dialog__total span {
+ display: block;
+ color: var(--vip-content-muted, #595959);
+ font-size: 0.6875rem;
+ }
+ .small-payment-store-dialog__total strong {
+ display: block;
+ margin-top: 0.2rem;
+ font-size: 1rem;
+ font-variant-numeric: tabular-nums;
+ }
+ .small-payment-store-dialog__close {
+ display: inline-flex;
+ width: 1.8rem;
+ height: 1.8rem;
+ align-items: center;
+ justify-content: center;
+ border: 1px solid var(--vip-border, #d8d2c7);
+ border-radius: 50%;
+ background: var(--vip-surface, #ffffff);
+ color: var(--vip-content-muted, #595959);
+ cursor: pointer;
+ }
+ .small-payment-store-dialog__filter {
+ display: grid;
+ grid-template-columns: minmax(14rem, 22rem);
+ gap: 0.75rem;
+ padding: 0.8rem 1.1rem;
+ border-bottom: 1px solid var(--vip-border, #d8d2c7);
+ }
+ .small-payment-store-dialog__filter span {
+ display: block;
+ margin-bottom: 0.25rem;
+ color: var(--vip-content-muted, #595959);
+ font-size: 0.6875rem;
+ }
+ .small-payment-store-dialog__filter select {
+ width: 100%;
+ height: 2.1rem;
+ padding: 0 0.5rem;
+ border: 1px solid var(--vip-border, #d8d2c7);
+ border-radius: 0.375rem;
+ background: var(--vip-surface, #ffffff);
+ color: var(--vip-content-ink, #171717);
+ font: inherit;
+ font-size: 0.75rem;
+ }
+ .small-payment-store-dialog__scroll {
+ flex: 1 1 auto;
+ min-height: 0;
+ overflow: auto;
+ padding: 0 1.1rem 0.65rem;
+ overscroll-behavior: contain;
+ scrollbar-color: var(--vip-content-accent, #b9954f) #f1ece3;
+ scrollbar-gutter: stable;
+ scrollbar-width: thin;
+ }
+ .small-payment-store-dialog__table {
+ width: 100%;
+ border-collapse: collapse;
+ table-layout: fixed;
+ font-size: 0.75rem;
+ font-variant-numeric: tabular-nums;
+ }
+ .small-payment-store-dialog__table col:first-child { width: 68%; }
+ .small-payment-store-dialog__table col:last-child { width: 32%; }
+ .small-payment-store-dialog__table th,
+ .small-payment-store-dialog__table td {
+ padding: 0.7rem 0.65rem;
+ border-bottom: 1px solid #eee8dd;
+ line-height: 1.5;
+ text-align: left;
+ vertical-align: middle;
+ overflow-wrap: anywhere;
+ }
+ .small-payment-store-dialog__table thead th {
+ position: sticky;
+ top: 0;
+ z-index: 1;
+ background: var(--vip-content-accent-soft, #f7f0de);
+ color: var(--vip-content-muted, #595959);
+ font-weight: 600;
+ }
+ .small-payment-store-dialog__table .is-number {
+ text-align: right;
+ white-space: nowrap;
+ }
+ .small-payment-store-dialog__empty {
+ padding: 2rem 0.5rem;
+ color: var(--vip-content-muted, #595959);
+ font-size: 0.75rem;
+ text-align: center;
+ }
+ .small-payment-store-dialog__foot {
+ padding: 0.65rem 1.1rem;
+ border-top: 1px solid var(--vip-border, #d8d2c7);
+ color: var(--vip-content-muted, #595959);
+ font-size: 0.6875rem;
+ }
+ .small-payment-store-dialog__table tr[hidden] { display: none; }
+ @media (max-width: 720px) {
+ .small-payment-store-dialog__head { flex-direction: column; }
+ .small-payment-store-dialog__side { width: 100%; justify-content: space-between; }
+ .small-payment-store-dialog__filter { grid-template-columns: minmax(0, 1fr); }
+ }
.small-payment-table--wide { min-width: 204rem; }
.small-payment-table td.is-number,
.small-payment-table th.is-number {
@@ -558,12 +733,88 @@
筛选结果
{{ number_format($rows->total()) }} 条
-