fix(pickup): 取貨碼商品下拉 placeholder 改「選擇商品」+ 公開取貨頁正確顯示綁定商品
1. 取貨碼新增彈窗的商品下拉沿用了貨道設定的 placeholder(顯示「選擇貨道」),
改為「選擇商品」並補 Search Product... 多語系。
2. 公開取貨憑證頁(/p/{slug})原本只用 slot_no 對應商品,綁商品的碼 slot_no 為
null 導致顯示「未知商品」;改為優先用 product_id 綁定的商品,貨道欄無值顯示「—」。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
330b81ab7b
commit
d4d61461fe
@ -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); // 相容舊版或測試
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
{
|
||||
"Search Product...": "商品を検索...",
|
||||
"Generate Quantity": "生成数量",
|
||||
"Batch mode: codes are auto-generated and the custom code is ignored.": "バッチモード:コードは自動生成され、カスタムコードは無視されます。",
|
||||
"Batch generated successfully": "バッチ生成が完了しました",
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
{
|
||||
"Search Product...": "搜尋商品...",
|
||||
"Generate Quantity": "產生數量",
|
||||
"Batch mode: codes are auto-generated and the custom code is ignored.": "批次模式:系統自動產生隨機碼,將忽略自訂碼。",
|
||||
"Batch generated successfully": "批次產生成功",
|
||||
|
||||
@ -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
|
||||
|
||||
@ -15,8 +15,12 @@
|
||||
</head>
|
||||
<body class="min-h-screen bg-slate-50 dark:bg-slate-950 flex flex-col items-center justify-start pt-8 pb-12 px-6 antialiased">
|
||||
@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
|
||||
|
||||
<div class="w-full max-w-sm animate-luxury-in">
|
||||
@ -53,7 +57,7 @@
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="text-center flex-1">
|
||||
<span class="block text-[10px] font-black text-slate-400 uppercase tracking-widest mb-1">{{ __('Slot') }}</span>
|
||||
<span class="text-2xl font-black text-slate-800 dark:text-white font-display">{{ $pickupCode->slot_no }}</span>
|
||||
<span class="text-2xl font-black text-slate-800 dark:text-white font-display">{{ $pickupCode->slot_no ?: '—' }}</span>
|
||||
</div>
|
||||
<div class="w-px h-8 bg-slate-100 dark:bg-slate-800"></div>
|
||||
<div class="text-center flex-1">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user