From d4d61461fe1b07f1f45b571af281bf0fcf239244 Mon Sep 17 00:00:00 2001 From: terrylee Date: Mon, 29 Jun 2026 15:18:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(pickup):=20=E5=8F=96=E8=B2=A8=E7=A2=BC?= =?UTF-8?q?=E5=95=86=E5=93=81=E4=B8=8B=E6=8B=89=20placeholder=20=E6=94=B9?= =?UTF-8?q?=E3=80=8C=E9=81=B8=E6=93=87=E5=95=86=E5=93=81=E3=80=8D+=20?= =?UTF-8?q?=E5=85=AC=E9=96=8B=E5=8F=96=E8=B2=A8=E9=A0=81=E6=AD=A3=E7=A2=BA?= =?UTF-8?q?=E9=A1=AF=E7=A4=BA=E7=B6=81=E5=AE=9A=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 取貨碼新增彈窗的商品下拉沿用了貨道設定的 placeholder(顯示「選擇貨道」), 改為「選擇商品」並補 Search Product... 多語系。 2. 公開取貨憑證頁(/p/{slug})原本只用 slot_no 對應商品,綁商品的碼 slot_no 為 null 導致顯示「未知商品」;改為優先用 product_id 綁定的商品,貨道欄無值顯示「—」。 Co-Authored-By: Claude Opus 4.8 (1M context) --- app/Http/Controllers/Guest/PickupController.php | 2 +- lang/en.json | 1 + lang/ja.json | 1 + lang/zh_TW.json | 1 + .../views/admin/sales/pickup-codes/index.blade.php | 4 ++-- resources/views/guest/pickup/show.blade.php | 10 +++++++--- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/Guest/PickupController.php b/app/Http/Controllers/Guest/PickupController.php index 0909faa..ab44a82 100644 --- a/app/Http/Controllers/Guest/PickupController.php +++ b/app/Http/Controllers/Guest/PickupController.php @@ -13,7 +13,7 @@ class PickupController extends Controller */ public function show($slug) { - $pickupCode = PickupCode::with(['machine.slots.product']) + $pickupCode = PickupCode::with(['machine.slots.product', 'product']) ->where(function($query) use ($slug) { $query->where('slug', $slug) ->orWhere('code', $slug); // 相容舊版或測試 diff --git a/lang/en.json b/lang/en.json index 097ce81..7c5fa20 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1,4 +1,5 @@ { + "Search Product...": "Search Product...", "Generate Quantity": "Generate Quantity", "Batch mode: codes are auto-generated and the custom code is ignored.": "Batch mode: codes are auto-generated and the custom code is ignored.", "Batch generated successfully": "Batch generated successfully", diff --git a/lang/ja.json b/lang/ja.json index 24b5fcb..96221a7 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -1,4 +1,5 @@ { + "Search Product...": "商品を検索...", "Generate Quantity": "生成数量", "Batch mode: codes are auto-generated and the custom code is ignored.": "バッチモード:コードは自動生成され、カスタムコードは無視されます。", "Batch generated successfully": "バッチ生成が完了しました", diff --git a/lang/zh_TW.json b/lang/zh_TW.json index c7c4945..54f76e3 100644 --- a/lang/zh_TW.json +++ b/lang/zh_TW.json @@ -1,4 +1,5 @@ { + "Search Product...": "搜尋商品...", "Generate Quantity": "產生數量", "Batch mode: codes are auto-generated and the custom code is ignored.": "批次模式:系統自動產生隨機碼,將忽略自訂碼。", "Batch generated successfully": "批次產生成功", diff --git a/resources/views/admin/sales/pickup-codes/index.blade.php b/resources/views/admin/sales/pickup-codes/index.blade.php index 0c2106b..1b30653 100644 --- a/resources/views/admin/sales/pickup-codes/index.blade.php +++ b/resources/views/admin/sales/pickup-codes/index.blade.php @@ -2,9 +2,9 @@ @php $slotSelectConfig = [ -"placeholder" => __("Select Slot"), +"placeholder" => __("Select Product"), "hasSearch" => true, -"searchPlaceholder" => __("Search Slot..."), +"searchPlaceholder" => __("Search Product..."), "isHidePlaceholder" => false, "searchClasses" => "block w-[calc(100%-16px)] mx-2 py-2 px-3 text-sm border-slate-200 dark:border-white/10 rounded-lg focus:border-cyan-500 focus:ring-cyan-500 bg-slate-50 dark:bg-slate-900/50 dark:text-slate-200 diff --git a/resources/views/guest/pickup/show.blade.php b/resources/views/guest/pickup/show.blade.php index cadcfed..1c3c10e 100644 --- a/resources/views/guest/pickup/show.blade.php +++ b/resources/views/guest/pickup/show.blade.php @@ -15,8 +15,12 @@ @php - $slot = $pickupCode->machine->slots->where('slot_no', $pickupCode->slot_no)->first(); - $product = $slot?->product; + // 取貨碼可能綁「商品」(product_id,slot_no 為 null,貨道刷碼當下挑) 或綁「貨道」(舊版)。 + // 優先用直接綁定的商品;否則回退用 slot_no 對應貨道的商品。 + $slot = $pickupCode->slot_no + ? $pickupCode->machine->slots->where('slot_no', $pickupCode->slot_no)->first() + : null; + $product = $pickupCode->product ?? $slot?->product; @endphp
@@ -53,7 +57,7 @@
{{ __('Slot') }} - {{ $pickupCode->slot_no }} + {{ $pickupCode->slot_no ?: '—' }}