[PROMOTE] dev -> demo: 取貨碼商品下拉/公開取貨頁顯示商品 + 批次下載不卡畫面(修正)

This commit is contained in:
terrylee 2026-06-29 15:34:28 +08:00
commit e2281fa425
7 changed files with 16 additions and 7 deletions

View File

@ -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); // 相容舊版或測試

View File

@ -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",

View File

@ -1,4 +1,5 @@
{
"Search Product...": "商品を検索...",
"Generate Quantity": "生成数量",
"Batch mode: codes are auto-generated and the custom code is ignored.": "バッチモード:コードは自動生成され、カスタムコードは無視されます。",
"Batch generated successfully": "バッチ生成が完了しました",

View File

@ -1,4 +1,5 @@
{
"Search Product...": "搜尋商品...",
"Generate Quantity": "產生數量",
"Batch mode: codes are auto-generated and the custom code is ignored.": "批次模式:系統自動產生隨機碼,將忽略自訂碼。",
"Batch generated successfully": "批次產生成功",

View File

@ -15,7 +15,9 @@
</p>
</div>
</div>
<a href="{{ $batch['download_url'] }}"
{{-- download 屬性讓全域連結攔截器layouts/admin跳過「導航載入遮罩」
否則檔案下載不會換頁、遮罩不會關閉,畫面會卡在模糊狀態。 --}}
<a href="{{ $batch['download_url'] }}" download
class="btn-luxury-primary whitespace-nowrap flex items-center justify-center gap-2">
<svg class="w-4 h-4 stroke-[2.5]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round"

View File

@ -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

View File

@ -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_idslot_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">