From 0ac7da4f1ed9b71b3610b4a7dcdd86622dcc24df Mon Sep 17 00:00:00 2001 From: adonis Date: Sat, 8 Aug 2026 14:55:34 +0330 Subject: [PATCH] Align admin order statuses with server adminStatus mapping. Add terminal statuses, check_correction tab, and consistent status labels for cancelled/rejected/expired orders. Co-authored-by: Cursor --- src/components/ui/StatusBadge.vue | 1 + src/types/index.ts | 5 ++++- src/utils/orderStatus.ts | 16 ++++++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/components/ui/StatusBadge.vue b/src/components/ui/StatusBadge.vue index 4ab2b5c..5036b08 100644 --- a/src/components/ui/StatusBadge.vue +++ b/src/components/ui/StatusBadge.vue @@ -6,6 +6,7 @@ defineProps<{ status: OrderStatus | 'active' | 'inactive' | 'pending_check_review' }>() +/** فقط وضعیت‌هایی که سفارش نیستند */ const extraMeta: Record = { active: { label: 'فعال', tone: 'success' }, inactive: { label: 'غیرفعال', tone: 'neutral' }, diff --git a/src/types/index.ts b/src/types/index.ts index c8fe3d0..714d198 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -2,10 +2,13 @@ export type OrderStatus = | 'pending_review' | 'pending_check' | 'needs_correction' + | 'check_correction' | 'final_approval' | 'shipped' | 'delivered' - | 'check_correction' + | 'cancelled' + | 'rejected' + | 'expired' export type SettlementMethod = 'check' | 'cash' diff --git a/src/utils/orderStatus.ts b/src/utils/orderStatus.ts index abbdc0b..3a61931 100644 --- a/src/utils/orderStatus.ts +++ b/src/utils/orderStatus.ts @@ -13,14 +13,18 @@ export const ORDER_STATUS_META: Record = { final_approval: { label: 'تأیید نهایی', tone: 'success' }, shipped: { label: 'ارسال شده', tone: 'info' }, delivered: { label: 'تحویل شده', tone: 'delivered' }, + cancelled: { label: 'لغو شده', tone: 'neutral' }, + rejected: { label: 'رد شده', tone: 'danger' }, + expired: { label: 'منقضی شده', tone: 'neutral' }, } export const ORDER_TABS = [ { key: 'all', label: 'همه' }, - { key: 'pending_review', label: 'در انتظار بررسی', count: 18 }, - { key: 'pending_check', label: 'در انتظار چک', count: 9 }, - { key: 'needs_correction', label: 'نیاز به اصلاح', count: 6 }, - { key: 'final_approval', label: 'تأیید نهایی', count: 24 }, - { key: 'shipped', label: 'ارسال شده', count: 12 }, - { key: 'delivered', label: 'تحویل شده', count: 34 }, + { key: 'pending_review', label: 'در انتظار بررسی' }, + { key: 'pending_check', label: 'در انتظار چک' }, + { key: 'needs_correction', label: 'نیاز به اصلاح' }, + { key: 'check_correction', label: 'اصلاح چک' }, + { key: 'final_approval', label: 'تأیید نهایی' }, + { key: 'shipped', label: 'ارسال شده' }, + { key: 'delivered', label: 'تحویل شده' }, ] as const