Files
star-erp/resources/js/constants/purchase-order.ts
sky121113 a7c445bd3f
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Successful in 50s
Koori-ERP-Deploy-System / deploy-production (push) Has been skipped
fix: 修正部分進貨採購單更新失敗與狀態顯示問題
2026-01-27 13:27:28 +08:00

57 lines
1.8 KiB
TypeScript

/**
* 採購單相關常數
*/
import type { PurchaseOrderStatus, PaymentMethod, InvoiceType } from "@/types/purchase-order";
// 狀態標籤配置
export const STATUS_CONFIG: Record<
PurchaseOrderStatus,
{ label: string; variant: "default" | "secondary" | "destructive" | "outline" }
> = {
draft: { label: "草稿", variant: "outline" },
pending: { label: "待審核", variant: "outline" },
processing: { label: "處理中", variant: "outline" },
shipping: { label: "運送中", variant: "outline" },
confirming: { label: "待確認", variant: "outline" },
completed: { label: "已完成", variant: "outline" },
cancelled: { label: "已取消", variant: "outline" },
partial: { label: "部分進貨", variant: "secondary" },
};
export const STATUS_OPTIONS = Object.entries(STATUS_CONFIG).map(([value, config]) => ({
value,
label: (config as any).label,
}));
// 付款方式選項
export const PAYMENT_METHODS: Record<PaymentMethod, string> = {
cash: "現金",
bank_transfer: "銀行轉帳",
credit_card: "信用卡",
check: "支票",
};
// 發票類型選項
export const INVOICE_TYPES: Record<InvoiceType, string> = {
duplicate: "二聯式",
triplicate: "三聯式",
electronic: "電子發票",
};
// 退回原因選項
export const REJECTION_REASONS = [
{ value: "預算不足", label: "預算不足" },
{ value: "非必要採購", label: "非必要採購" },
{ value: "數量過多", label: "數量過多" },
{ value: "價格過高", label: "價格過高" },
{ value: "資訊不完整", label: "資訊不完整" },
{ value: "其他", label: "其他" },
];
/**
* 價格警示閾值(百分比)
* 當單價比上次採購價高出此百分比時,顯示警示
*/
export const PRICE_ALERT_THRESHOLD = 5;