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 ?: '—' }}