export default class AppOrder { order: undefined } declare global { type TTableDisplayStatusKey = 'unknow' | // 未知 'waiting_order' | // 未點餐 'preparing_meal' | // 備餐中 目前不會顯示這個狀態,因為沒有廚房系統 'waiting_pay' | // 待結帳 已點餐後會顯示待結帳 'paid' | // 已結帳 'cancel_table' | // 已退桌 'delete_order' // 已作廢 type TTakeawayDisplayStatusKey = 'unknow' | // 未知 'waiting_order' | // 未點餐 'waiting_pay' | // 待結帳 'paid' | // 已結帳 'waiting_accept' | // 待接單 'preparing_meal' | // 備餐中 'waiting_pick_up' | // 待取餐 'picked_up' | // 已取餐 'cancel_order' | // 已取消 'delete_order' // 已作廢 type TDeliveryDisplayStatusKey = 'unknow' | // 未知 'waiting_accept' | // 待接單 'preparing_meal' | // 備餐中 'waiting_pick_up' | // 待取餐 'in_delivery' | // 配送中 'waiting_pay' | // 待結帳 'arrived' | // 已送達 'complete' | // 已完成 'cancel_order' | // 已取消 'delete_order' // 已作廢 type TDisplayStatusKey = TTableDisplayStatusKey | TTakeawayDisplayStatusKey | TDeliveryDisplayStatusKey interface IAppOrder extends Omit { batches: IAppOrderBatch[] payments: IAppPayment[] displayStatusKey: TDisplayStatusKey // 最後判斷出來要顯示的狀態 } interface IAppPayment extends Omit { isSended: boolean // 已和後端結帳 paidAmount?: string | number // 要 handle 鍵盤輸入時會暫時是 string paymentTips?: string | number // 要 handle 鍵盤輸入時會暫時是 string isManualInput?: boolean // 手動輸入金額,之後不要做自動分等分 createdAt: Date } interface IAppOrderBatch extends Omit { id: string // IOrderBatch 只有 batchId 統一用法所以會 copy 一個 id 出來 items: IAppBatchItem[] showNotCompleteSets?: boolean // 開啟後會在 BatchItem 顯示未完成套餐的錯誤 } interface IAppBatchItem extends Omit { id?: string key: string // addItem 時建立 uuid setId: string // 套餐 set id menuId: string // (in IOrderBatchItem) menu id 套餐餐點自己的 menu id setMenuId?: string // 套餐的餐點原本的 id categoryId: string // (in IOrderBatchItem) 所屬的分類,非套餐事 IAppMenuItem.categoryId、套餐中是 IAppCategoryStep.parentId desc?: string // reqeust submit batch 需要,所以點餐時要放進來,但從 order api 抓回來的就不會有 desc discount: number // 後台設定好對餐點的 menu item discount surcharge: number // 餐點的 surcharge totalDiscount: number // modifiers 統計後折多少 status: string // item 的狀態,包含 option, tag, discount, cancelled modifiers: IPriceModifier[] // 額外記錄 option group 的資訊 options: IAppBatchItemOption[] // 額外記錄 option group 的資訊 tags: IMenuTag[] setItems: IAppBatchItem[] // 套餐專用,套餐底下的餐點先放這裡 step?: string // 套餐餐點才有 isRequired?: boolean // 必點項目,不可刪除 isSplited?: boolean // 已放入分單 isSet: boolean } interface IFormatedBatchItem extends IAppBatchItem { totalDiscount: number // 總折扣 (含 discount 和 modifiers),總共扣多少錢 surcharge: number // 算完折扣後,再算上 order surcharge 總共要多付多少錢 total: number // 包含折扣、服務費和套餐中餐點價格的總價 } interface IAppBatchItemOption extends IOrderBatchItemOption { optionGroupId?: string // 選項的 id, ex.辣度 optionGroupName?: string // 選項的名稱, ex.辣度 optionItemId: string // 選項項目的 id, ex. 中辣 } }