[RELEASE] demo -> main: 銷售紀錄付款狀態預設「已完成」+ 新增「待領取」

1. 付款狀態下拉預設改為「已完成」,避免客戶把 failed(付款失敗/逾時) 誤會成刷卡失敗;
   「所有付款狀態」改為明確選項 value=all,選它才顯示全部。
2. 新增 awaiting_pickup(待領取) 至下拉選項與各狀態顯示(桌機/手機徽章、明細面板、匯出標籤)。
This commit is contained in:
twsystem1004 2026-07-17 01:21:27 +00:00
commit 777ae82833
3 changed files with 13 additions and 3 deletions

View File

@ -35,7 +35,9 @@ class SalesController extends Controller
$search = $request->input('search'); $search = $request->input('search');
$machineId = $request->input('machine_id'); $machineId = $request->input('machine_id');
$paymentType = $request->input('payment_type'); $paymentType = $request->input('payment_type');
$status = $request->input('status'); // 付款狀態預設只看「已完成」:避免客戶把 failed(付款失敗/逾時) 誤會成刷卡失敗。
// 「所有付款狀態」為明確選項 status=all非空值AJAX 才不會當空值丟掉)。
$status = $request->input('status', 'completed');
$deliveryStatus = $request->input('delivery_status'); $deliveryStatus = $request->input('delivery_status');
$startDate = $request->input('start_date'); $startDate = $request->input('start_date');
$endDate = $request->input('end_date'); $endDate = $request->input('end_date');
@ -138,7 +140,7 @@ class SalesController extends Controller
// 訂單專用過濾器 // 訂單專用過濾器
if ($tab === 'orders') { if ($tab === 'orders') {
if ($paymentType) $ordersQuery->where('payment_type', $paymentType); if ($paymentType) $ordersQuery->where('payment_type', $paymentType);
if ($status) $ordersQuery->where('status', $status); if ($status && $status !== 'all') $ordersQuery->where('status', $status);
// 出貨狀態:唯有付款成功(completed/paid)的單才有出貨結果,需與列表顯示邏輯 (hasDeliveryOutcome) 一致 // 出貨狀態:唯有付款成功(completed/paid)的單才有出貨結果,需與列表顯示邏輯 (hasDeliveryOutcome) 一致
if ($deliveryStatus !== null && $deliveryStatus !== '') { if ($deliveryStatus !== null && $deliveryStatus !== '') {
$ordersQuery->whereIn('status', [Order::STATUS_COMPLETED, 'paid']) $ordersQuery->whereIn('status', [Order::STATUS_COMPLETED, 'paid'])
@ -1545,6 +1547,7 @@ class SalesController extends Controller
'pending' => __('Pending'), 'pending' => __('Pending'),
'paid' => __('Paid'), 'paid' => __('Paid'),
'completed' => __('Completed'), 'completed' => __('Completed'),
'awaiting_pickup' => __('Awaiting Pickup'),
'failed' => __('Failed'), 'failed' => __('Failed'),
'abandoned' => __('Unpaid'), 'abandoned' => __('Unpaid'),
'cancelled' => __('Cancelled'), 'cancelled' => __('Cancelled'),

View File

@ -34,6 +34,7 @@
'pending' => 'pending', 'pending' => 'pending',
'paid' => 'active', 'paid' => 'active',
'completed' => 'active', 'completed' => 'active',
'awaiting_pickup' => 'pending',
'failed' => 'error', 'failed' => 'error',
'abandoned' => 'disabled', 'abandoned' => 'disabled',
'cancelled' => 'disabled', 'cancelled' => 'disabled',
@ -43,6 +44,7 @@
'pending' => __('Pending'), 'pending' => __('Pending'),
'paid' => __('Paid'), 'paid' => __('Paid'),
'completed' => __('Completed'), 'completed' => __('Completed'),
'awaiting_pickup' => __('Awaiting Pickup'),
'failed' => __('Failed'), 'failed' => __('Failed'),
'abandoned' => __('Unpaid'), 'abandoned' => __('Unpaid'),
'cancelled' => __('Cancelled'), 'cancelled' => __('Cancelled'),

View File

@ -31,11 +31,14 @@
{{-- 付款狀態 --}} {{-- 付款狀態 --}}
<div class="w-full lg:w-44"> <div class="w-full lg:w-44">
<x-searchable-select name="status" :placeholder="__('All Payment Statuses')" :selected="$filters['status']" {{-- 不傳 placeholder避免產生 value=" " 的空值選項;「所有付款狀態」改為明確的 value=all 選項,預設為「已完成」 --}}
<x-searchable-select name="status" :selected="$filters['status']"
:has-search="false" @change="$el.closest('form').dispatchEvent(new Event('submit'))"> :has-search="false" @change="$el.closest('form').dispatchEvent(new Event('submit'))">
<option value="all" {{ $filters['status']==='all' ? 'selected' : '' }} data-title="{{ __('All Payment Statuses') }}">{{ __('All Payment Statuses') }}</option>
<option value="pending" {{ $filters['status']==='pending' ? 'selected' : '' }} data-title="{{ __('Pending') }}">{{ __('Pending') }}</option> <option value="pending" {{ $filters['status']==='pending' ? 'selected' : '' }} data-title="{{ __('Pending') }}">{{ __('Pending') }}</option>
<option value="paid" {{ $filters['status']==='paid' ? 'selected' : '' }} data-title="{{ __('Paid') }}">{{ __('Paid') }}</option> <option value="paid" {{ $filters['status']==='paid' ? 'selected' : '' }} data-title="{{ __('Paid') }}">{{ __('Paid') }}</option>
<option value="completed" {{ $filters['status']==='completed' ? 'selected' : '' }} data-title="{{ __('Completed') }}">{{ __('Completed') }}</option> <option value="completed" {{ $filters['status']==='completed' ? 'selected' : '' }} data-title="{{ __('Completed') }}">{{ __('Completed') }}</option>
<option value="awaiting_pickup" {{ $filters['status']==='awaiting_pickup' ? 'selected' : '' }} data-title="{{ __('Awaiting Pickup') }}">{{ __('Awaiting Pickup') }}</option>
<option value="failed" {{ $filters['status']==='failed' ? 'selected' : '' }} data-title="{{ __('Failed') }}">{{ __('Failed') }}</option> <option value="failed" {{ $filters['status']==='failed' ? 'selected' : '' }} data-title="{{ __('Failed') }}">{{ __('Failed') }}</option>
<option value="abandoned" {{ $filters['status']==='abandoned' ? 'selected' : '' }} data-title="{{ __('Unpaid') }}">{{ __('Unpaid') }}</option> <option value="abandoned" {{ $filters['status']==='abandoned' ? 'selected' : '' }} data-title="{{ __('Unpaid') }}">{{ __('Unpaid') }}</option>
<option value="cancelled" {{ $filters['status']==='cancelled' ? 'selected' : '' }} data-title="{{ __('Cancelled') }}">{{ __('Cancelled') }}</option> <option value="cancelled" {{ $filters['status']==='cancelled' ? 'selected' : '' }} data-title="{{ __('Cancelled') }}">{{ __('Cancelled') }}</option>
@ -325,6 +328,8 @@
'pending' => ['label' => __('Pending'), 'color' => 'amber'], 'pending' => ['label' => __('Pending'), 'color' => 'amber'],
'paid' => ['label' => __('Paid'), 'color' => 'emerald'], 'paid' => ['label' => __('Paid'), 'color' => 'emerald'],
'completed' => ['label' => __('Completed'), 'color' => 'emerald'], 'completed' => ['label' => __('Completed'), 'color' => 'emerald'],
'awaiting_pickup' => ['label' => __('Awaiting Pickup'), 'color' => 'amber'],
'awaiting_pickup' => ['label' => __('Awaiting Pickup'), 'color' => 'amber'],
'failed' => ['label' => __('Failed'), 'color' => 'rose'], 'failed' => ['label' => __('Failed'), 'color' => 'rose'],
'abandoned' => ['label' => __('Unpaid'), 'color' => 'slate'], 'abandoned' => ['label' => __('Unpaid'), 'color' => 'slate'],
'cancelled' => ['label' => __('Cancelled'), 'color' => 'slate'], 'cancelled' => ['label' => __('Cancelled'), 'color' => 'slate'],