-- 检查work_order表中的订单状态分布
SELECT 
    status,
    COUNT(*) as count,
    CASE 
        WHEN status = 0 THEN '待派单/待支付'
        WHEN status = 1 THEN '待接单'
        WHEN status = 2 THEN '待服务'
        WHEN status = 3 THEN '服务中'
        WHEN status = 4 THEN '已完成'
        WHEN status = -1 THEN '已取消'
        WHEN status = -2 THEN '已退款'
        ELSE '未知状态'
    END as status_name
FROM work_order
GROUP BY status
ORDER BY status;

-- 检查待支付状态的订单详情
SELECT 
    id,
    order_no,
    status,
    pay_status,
    pay_time,
    create_time
FROM work_order
WHERE status = 0
ORDER BY create_time DESC
LIMIT 10;
