📋 Appointment 状态流转规范

状态列表

状态中文名称说明
pending待确认预约创建,等待确认
confirmed已确认预约已确认
checked_in已签到客户已到店
in_progress服务中正在服务
completed服务完成服务结束,paid_amount = 0
pending_payment待付款部分付款,paid_amount > 0 但 < total
finished已结账全额付款完成,paid_amount = total
closed已关闭最终状态
cancelled已取消预约取消,不在 Board 显示
no_show未到店客户爽约

正常业务流程

pending ──► confirmed ──► checked_in ──► in_progress ──► completed
   │            │             │              │              │
   │            │             │              │              │
   └────────────┴─────────────┴──────────────┴──────────────┘
                              │
                              ▼
                    (可从任意前置状态直接跳转到 completed)
    

付款流程

                         completed
                    (服务完成, paid_amount = 0)
                             │
           ┌─────────────────┼─────────────────┐
           ▼                 │                 ▼
      部分付款               │             全额付款
           │                 │                 │
           ▼                 │                 ▼
   pending_payment           │            finished
  (paid_amount > 0)          │       (paid_amount = total)
           │                 │                 │
           │    补齐付款     │                 │
           └────────────────►│                 │
                             │                 ▼
                             │              closed
                             │           (最终状态)
                             │
                             ▼
                         cancelled
                    (可从 completed 取消)
    

退款流程

全额退款

finished ──► 全额退款 ──► completed
              │
              ├── paid_amount = 0
              └── payment_status = pending
    

部分退款

finished ──► 部分退款 ──► pending_payment
              │
              ├── paid_amount > 0
              └── payment_status = partial
    

状态判断规则(基于 amount_due)

公式:amount_due = total_amount - paid_amount
amount_due含义statuspayment_status
= total_amount 完全没付钱 (paid_amount = 0) completed pending
> 0 且 < total_amount 付了部分,未付完 pending_payment partial
= 0 全额付清 (paid_amount = total) finished paid

付款/退款状态变化表

操作amount_due 变化statuspayment_status
服务完成(未付款)= total_amountcompletedpending
部分付款> 0 且 < totalpending_paymentpartial
全额付款= 0finishedpaid
全额退款= total_amountcompletedpending
部分退款> 0 且 < totalpending_paymentpartial
手动关闭-closed不变

取消规则

状态可取消原因
pending服务完成前
confirmed服务完成前
checked_in服务完成前
in_progress服务完成前
completedpaid_amount = 0,无欠款
pending_paymentpaid_amount > 0,有欠款
finished已结账,需先全额退款
closed最终状态,不可变更

取消流程图

┌─────────────────────────────────────────────────────────────────┐
│  可取消的状态 (paid_amount = 0)                                  │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  pending ─┬─► cancelled ──► 不在 Board 显示                     │
│  confirmed ─┤                                                   │
│  checked_in ─┤                                                  │
│  in_progress ─┤                                                 │
│  completed ──┘                                                  │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────┐
│  不可取消的状态                                                  │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  pending_payment ──► 需先退款至 paid_amount=0 ──► completed     │
│                                                  ──► 可取消     │
│                                                                 │
│  finished ──► 需先全额退款 ──► completed ──► 可取消              │
│                                                                 │
│  closed ──► 最终状态,不可变更                                   │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘
    

状态转换矩阵

从 ↓ 到 → pendingconfirmedchecked_inin_progress completedpending_paymentfinished closedcancelledno_show
pending----
confirmed----
checked_in-----
in_progress-----
completed-----部分付款全额付款--
pending_payment----全额退款-补齐付款--
finished----全额退款部分退款--
closed---------
cancelled----------
no_show----------
说明

更新日期: 2026-02-02