From 9f6a5f6fde6d8c1745f37ca1d3c161ddd2310d7d Mon Sep 17 00:00:00 2001 From: zhoushengchen <3057083327@qq.com> Date: Mon, 12 Oct 2026 13:47:01 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E8=B4=A7=E5=8F=96=E4=BB=B6=E7=AE=A1?= =?UTF-8?q?=E7=90=86=EF=BC=9A=E6=95=B4=E8=A1=8C=E7=82=B9=E5=87=BB=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E5=8A=A0=E8=BD=BD=E8=AF=A6=E6=83=85=EF=BC=8C=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=20opcache=20=E6=8F=90=E9=80=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Business/Pages.php | 24 +++ deploy/php-local.ini | 10 +- .../partials/return-pickup-detail.blade.php | 115 ++++++++++ .../return-pickup-management.blade.php | 201 ++++++++---------- routes/admin.php | 4 + .../ReturnPickupManagementPageTest.php | 80 +++++++ 6 files changed, 315 insertions(+), 119 deletions(-) create mode 100644 resources/views/business/pages/courier-payables/partials/return-pickup-detail.blade.php diff --git a/app/Http/Controllers/Business/Pages.php b/app/Http/Controllers/Business/Pages.php index e7136f59..aa11cafe 100644 --- a/app/Http/Controllers/Business/Pages.php +++ b/app/Http/Controllers/Business/Pages.php @@ -6247,6 +6247,30 @@ class Pages extends Controller ); } + /** 详情局部刷新:点行后只返回详情面板,避免整页重载。 */ + public function returnPickupManagementDetail(Request $request): \Illuminate\Contracts\View\View + { + $pickupId = max((int) $request->query('pickup_id', 0), 0); + + abort_if($pickupId <= 0, 404); + + $repository = app(\Modules\EcommerceFinance\Repositories\ReturnPickupManagementMirrorRepository::class); + $detail = $this->enrichReturnPickupDetail( + $repository->detail($pickupId), + $repository->warehouseDirectory(), + ); + + abort_if($detail === null, 404); + + return view('business.pages.courier-payables.partials.return-pickup-detail', [ + 'detail' => $detail, + 'closeUrl' => route('business.pages.show', [ + 'section' => 'courier-payables', + 'page' => 'return-pickup-management', + ]), + ]); + } + protected function contentForReturnPickupManagement(): array { $filters = $this->returnPickupFilters(request()); diff --git a/deploy/php-local.ini b/deploy/php-local.ini index 812a4875..b46b0273 100644 --- a/deploy/php-local.ini +++ b/deploy/php-local.ini @@ -1,6 +1,10 @@ -; Local development serves bind-mounted PHP/Blade source directly. Disable -; opcode caching so a browser refresh always executes the current source. -opcache.enable=0 +; Local development serves bind-mounted PHP/Blade source directly. Keep opcode +; caching on with per-request timestamp validation so a browser refresh still +; executes the current source, without recompiling the whole framework each time. +opcache.enable=1 opcache.enable_cli=0 opcache.validate_timestamps=1 opcache.revalidate_freq=0 +opcache.memory_consumption=256 +opcache.max_accelerated_files=40000 +opcache.interned_strings_buffer=16 diff --git a/resources/views/business/pages/courier-payables/partials/return-pickup-detail.blade.php b/resources/views/business/pages/courier-payables/partials/return-pickup-detail.blade.php new file mode 100644 index 00000000..caff0bde --- /dev/null +++ b/resources/views/business/pages/courier-payables/partials/return-pickup-detail.blade.php @@ -0,0 +1,115 @@ + @if ($detail !== null) + @php + $main = $detail['main']; + @endphp +
+
+ 退货取件单详情 · {{ $main->orderId ?? '-' }} · {{ $main->shopName ?: '-' }} · {{ $main->express_company ?: '-' }} + 关闭详情 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @forelse ($detail['items'] as $item) + @php + $volumeWeight = ($item->length && $item->width && $item->height) + ? round(((float) $item->length * (float) $item->width * (float) $item->height) / 6000, 2) + : null; + @endphp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @empty + + @endforelse + + @if (($detail['totals'] ?? null) !== null) + + + + + + + + + + + + @endif +
应退货号实退货号平台商品id平台skuid条形码品名应退数量实退数量待核销数量明细退货进度发货仓收件人收件地址长宽高毛重(kg)体积重(kg)重量取大(kg)计费重量(kg)面单(元)费率(元/kg)预估运费(元)实际运费(元)未算出原因加收(元)差异(元)实退单号
{{ $item->returnProcode ?: '-' }}{{ $item->actualReturnProcode ?: '-' }}{{ $item->platformProductId ?: '-' }}{{ $item->platformSkuId ?: '-' }}{{ $item->barcode ?: '-' }}{{ $item->productName ?: '-' }}{{ $item->returnQuantity ?? '-' }}{{ $item->actualReturnQuantity ?? '-' }}{{ $item->unverifiedQuantity ?? '-' }}{{ $item->returnProgress ?: '-' }}{{ ($item->warehouse_name ?? null) ?: ($item->warehouse ?: '-') }}{{ $item->receiverName ?: '-' }} {{ $item->receiverPhone ?: '' }}{{ $item->receiverAddress ?: '-' }}{{ $item->length !== null ? number_format((float) $item->length, 2) : '-' }}{{ $item->width !== null ? number_format((float) $item->width, 2) : '-' }}{{ $item->height !== null ? number_format((float) $item->height, 2) : '-' }}{{ $item->grossWeight !== null ? number_format((float) $item->grossWeight, 2) : '-' }}{{ $volumeWeight !== null ? number_format($volumeWeight, 2) : '-' }}{{ $item->freight_settlement !== null ? number_format((float) $item->freight_settlement, 2) : '—' }}{{ $item->freight_billable !== null ? number_format((float) $item->freight_billable, 2) : '—' }}{{ $item->freight_base_amount !== null ? number_format((float) $item->freight_base_amount, 2) : '—' }}{{ $item->freight_increment_amount !== null ? number_format((float) $item->freight_increment_amount, 2) : '—' }}{{ $item->estimatedFreight !== null ? number_format((float) $item->estimatedFreight, 2) : '-' }} + {{ $item->actual_freight !== null ? number_format((float) $item->actual_freight, 2) : '—' }} + + {{ $item->actual_freight === null ? ($item->freight_note ?: '未匹配到报价') : '—' }} + + {{ ($item->freight_surcharge ?? 0) > 0 ? number_format((float) $item->freight_surcharge, 2) : '—' }} + + @if ($item->freight_diff !== null) + {{ number_format((float) $item->freight_diff, 2) }} + @else + — + @endif + {{ $item->actualReturnOrderNo ?: '-' }}
该取件单暂无明细分录。
合计({{ count($detail['items']) }} 条明细,差异 = 预估 − 实际运费,加收单列){{ number_format((float) $detail['totals']['estimated'], 2) }}{{ $detail['totals']['actual'] !== null ? number_format((float) $detail['totals']['actual'], 2) : '—' }}—{{ ($detail['totals']['surcharge'] ?? 0) > 0 ? number_format((float) $detail['totals']['surcharge'], 2) : '—' }} + {{ $detail['totals']['diff'] !== null ? number_format((float) $detail['totals']['diff'], 2) : '—' }} + —
+
+
+ @endif diff --git a/resources/views/business/pages/courier-payables/return-pickup-management.blade.php b/resources/views/business/pages/courier-payables/return-pickup-management.blade.php index b90e142e..d23c299c 100644 --- a/resources/views/business/pages/courier-payables/return-pickup-management.blade.php +++ b/resources/views/business/pages/courier-payables/return-pickup-management.blade.php @@ -252,6 +252,7 @@ .return-pickup-table tbody tr.is-active { background: var(--vip-content-accent-soft, #f7f0de); } .return-pickup-table tbody tr.is-active td { border-bottom-color: #e4d7ba; } .return-pickup-table tbody tr.is-active td:first-child { box-shadow: inset 3px 0 0 var(--vip-content-accent-dark, #856632); } + .return-pickup-table tbody tr.is-clickable { cursor: pointer; } .return-pickup-table .is-code { font-variant-numeric: tabular-nums; } .return-pickup-table .is-clamped { max-width: 220px; overflow: hidden; text-overflow: ellipsis; } .return-pickup-table .is-negative { color: var(--vip-danger, #b80000); font-weight: 600; } @@ -433,7 +434,7 @@ @forelse (($rows ?? collect()) as $row) - + {{ $row->orderId ?: '-' }} {{ $row->express_company ?: '-' }} @@ -485,121 +486,7 @@ @endif - @if ($detail !== null) - @php - $main = $detail['main']; - @endphp -
-
- 退货取件单详情 · {{ $main->orderId ?? '-' }} · {{ $main->shopName ?: '-' }} · {{ $main->express_company ?: '-' }} - 关闭详情 -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @forelse ($detail['items'] as $item) - @php - $volumeWeight = ($item->length && $item->width && $item->height) - ? round(((float) $item->length * (float) $item->width * (float) $item->height) / 6000, 2) - : null; - @endphp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @empty - - @endforelse - - @if (($detail['totals'] ?? null) !== null) - - - - - - - - - - - - @endif -
应退货号实退货号平台商品id平台skuid条形码品名应退数量实退数量待核销数量明细退货进度发货仓收件人收件地址长宽高毛重(kg)体积重(kg)重量取大(kg)计费重量(kg)面单(元)费率(元/kg)预估运费(元)实际运费(元)未算出原因加收(元)差异(元)实退单号
{{ $item->returnProcode ?: '-' }}{{ $item->actualReturnProcode ?: '-' }}{{ $item->platformProductId ?: '-' }}{{ $item->platformSkuId ?: '-' }}{{ $item->barcode ?: '-' }}{{ $item->productName ?: '-' }}{{ $item->returnQuantity ?? '-' }}{{ $item->actualReturnQuantity ?? '-' }}{{ $item->unverifiedQuantity ?? '-' }}{{ $item->returnProgress ?: '-' }}{{ ($item->warehouse_name ?? null) ?: ($item->warehouse ?: '-') }}{{ $item->receiverName ?: '-' }} {{ $item->receiverPhone ?: '' }}{{ $item->receiverAddress ?: '-' }}{{ $item->length !== null ? number_format((float) $item->length, 2) : '-' }}{{ $item->width !== null ? number_format((float) $item->width, 2) : '-' }}{{ $item->height !== null ? number_format((float) $item->height, 2) : '-' }}{{ $item->grossWeight !== null ? number_format((float) $item->grossWeight, 2) : '-' }}{{ $volumeWeight !== null ? number_format($volumeWeight, 2) : '-' }}{{ $item->freight_settlement !== null ? number_format((float) $item->freight_settlement, 2) : '—' }}{{ $item->freight_billable !== null ? number_format((float) $item->freight_billable, 2) : '—' }}{{ $item->freight_base_amount !== null ? number_format((float) $item->freight_base_amount, 2) : '—' }}{{ $item->freight_increment_amount !== null ? number_format((float) $item->freight_increment_amount, 2) : '—' }}{{ $item->estimatedFreight !== null ? number_format((float) $item->estimatedFreight, 2) : '-' }} - {{ $item->actual_freight !== null ? number_format((float) $item->actual_freight, 2) : '—' }} - - {{ $item->actual_freight === null ? ($item->freight_note ?: '未匹配到报价') : '—' }} - - {{ ($item->freight_surcharge ?? 0) > 0 ? number_format((float) $item->freight_surcharge, 2) : '—' }} - - @if ($item->freight_diff !== null) - {{ number_format((float) $item->freight_diff, 2) }} - @else - — - @endif - {{ $item->actualReturnOrderNo ?: '-' }}
该取件单暂无明细分录。
合计({{ count($detail['items']) }} 条明细,差异 = 预估 − 实际运费,加收单列){{ number_format((float) $detail['totals']['estimated'], 2) }}{{ $detail['totals']['actual'] !== null ? number_format((float) $detail['totals']['actual'], 2) : '—' }}—{{ ($detail['totals']['surcharge'] ?? 0) > 0 ? number_format((float) $detail['totals']['surcharge'], 2) : '—' }} - {{ $detail['totals']['diff'] !== null ? number_format((float) $detail['totals']['diff'], 2) : '—' }} - —
-
-
- @endif + @include('business.pages.courier-payables.partials.return-pickup-detail', ['detail' => $detail, 'closeUrl' => $pageUrl($rows?->currentPage() ?? 1)]) diff --git a/routes/admin.php b/routes/admin.php index 4de1c554..094bdb16 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -352,6 +352,10 @@ Route::get('workspace/courier-payables/return-pickup-management/export', 'Busine ->middleware('business.page:courier-payables,return-pickup-management') ->name('business.courier-payables.return-pickup-management.export'); +Route::get('workspace/courier-payables/return-pickup-management/detail', 'Business\Pages@returnPickupManagementDetail') + ->middleware('business.page:courier-payables,return-pickup-management') + ->name('business.courier-payables.return-pickup-management.detail'); + // 必须注册在通用 {section}/{page}/{tab}/export 之前,否则会被通用导出路由截获。 Route::get('workspace/courier-payables/courier-surcharge/settlement/export', 'Business\Pages@exportCourierSurchargeSettlement') ->middleware('business.page:courier-payables,courier-surcharge') diff --git a/tests/Feature/Business/ReturnPickupManagementPageTest.php b/tests/Feature/Business/ReturnPickupManagementPageTest.php index fc7b9c1d..f73f2674 100644 --- a/tests/Feature/Business/ReturnPickupManagementPageTest.php +++ b/tests/Feature/Business/ReturnPickupManagementPageTest.php @@ -216,6 +216,9 @@ class ReturnPickupManagementPageTest extends FeatureTestCase ->assertOk() ->assertSee('id="pickupCarrierFilter"', false) ->assertSee('data-name="carrier"', false) + ->assertSee('is-clickable', false) + ->assertSee('data-href=', false) + ->assertSee('data-detail-url=', false) ->assertSeeText('同步正常') ->assertSeeText('待快递下单') ->assertSeeText('E202610020090') @@ -349,6 +352,83 @@ class ReturnPickupManagementPageTest extends FeatureTestCase ->assertSeeText('该快递公司不在逆向物流报价范围内'); } + public function test_detail_endpoint_returns_partial_for_inline_loading(): void + { + $this->user->attachPermission(Permission::where('name', 'read-admin-panel')->firstOrFail()); + + $repository = Mockery::mock(ReturnPickupManagementMirrorRepository::class); + $repository->shouldReceive('detail')->once()->withArgs( + static fn (int $id): bool => $id === 900002 + )->andReturn([ + 'main' => (object) [ + 'Id' => 900002, + 'orderId' => 'E202609130089', + 'express_company' => '百世', + 'orderStatus' => 'WaitExpOrder', + 'urgencyLevel' => '正常', + 'shopName' => '天猫-欧意朗旗舰店', + 'transactionNo' => '3316448031005001998', + 'returnExpressNo' => '', + 'paymentMethod' => '月结', + 'pickupType' => '有主取件', + 'expectedPickupTime' => null, + 'expressOrderTime' => null, + 'expressPickupTime' => null, + 'senderName' => '张三', + 'senderPhone' => '13800000000', + 'province' => '福建省', + 'city' => '泉州市', + 'district' => '', + 'street' => '', + 'address' => '某处', + 'issueType' => '', + 'issueDescription' => '', + 'expressFollowStatus' => '', + 'expressFollowResult' => '', + 'expressFollowDescription' => '', + 'note' => '', + 'totalReturnQuantity' => 1, + 'createTime' => '2026-09-13 10:00:00', + 'updateTime' => '2026-09-13 10:00:00', + 'creator' => '白沙', + 'canceler' => '', + ], + 'items' => [(object) [ + 'id' => 2, + 'returnProcode' => 'CJ002319', + 'actualReturnProcode' => '', + 'barcode' => 'CJ002319N1', + 'productName' => '住宅家具 - 床', + 'platformProductId' => '3316448031005001998', + 'platformSkuId' => '4200000001002', + 'returnQuantity' => 1, + 'actualReturnQuantity' => null, + 'unverifiedQuantity' => null, + 'returnProgress' => '在途', + 'warehouse' => '', + 'receiverName' => '逆向物流萧十一郎', + 'receiverPhone' => '15370596225', + 'receiverAddress' => '江苏省常州市某处', + 'grossWeight' => 3.0, + 'length' => 87, + 'width' => 46, + 'height' => 6, + 'estimatedFreight' => null, + 'actualReturnOrderNo' => '', + ]], + 'truth_numbers' => [], + ]); + $repository->shouldReceive('warehouseDirectory')->once()->andReturn([]); + $this->app->instance(ReturnPickupManagementMirrorRepository::class, $repository); + + $this->loginAs() + ->get(route('business.courier-payables.return-pickup-management.detail', ['pickup_id' => 900002])) + ->assertOk() + ->assertSee('id="return-pickup-detail"', false) + ->assertSeeText('退货取件单详情') + ->assertSeeText('实际运费(元)'); + } + public function test_export_streams_filtered_rows_with_actual_freight_and_difference(): void { $this->user->attachPermission(