Files
nl-mall-api/app/Enum/order/OrderStatusEnum.php

66 lines
2.6 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Enum\order;
/**
* 状态码定义
*/
enum OrderStatusEnum: int
{
// 状态 0待支付 1待发货 2待收货 3已收货 4待评价 5已评价 6申请退款 7同意退款 8拒绝退款 9异常订单 10投诉订单 11已取消 12已过期
case WAIT_PAY = 0;
case WAIT_SHIP = 1;
case WAIT_RECEIVE = 2;
case WAIT_COMMENT = 3;
case WAIT_REFUND = 4;
case REFUND_APPLY = 5;
case REFUND_AGREE = 6;
case REFUND_REFUSE = 7;
case REFUND_SUCCESS = 8;
case EXCEPTION = 9;
case COMPLAIN = 10;
case CANCEL = 11;
case EXPIRED = 12;
public function description(): string
{
return match ($this) {
self::WAIT_PAY => '待支付',
self::WAIT_SHIP => '待发货',
self::WAIT_RECEIVE => '待收货',
self::WAIT_COMMENT => '待评价',
self::WAIT_REFUND => '待退款',
self::REFUND_APPLY => '申请退款',
self::REFUND_AGREE => '同意退款',
self::REFUND_REFUSE => '拒绝退款',
self::REFUND_SUCCESS => '退款成功',
self::EXCEPTION => '异常订单',
self::COMPLAIN => '投诉订单',
self::CANCEL => '取消订单',
self::EXPIRED => '订单过期',
default => '未知状态',
};
}
public function getColor()
{
return match ($this) {
self::WAIT_PAY => 'primary', // 蓝色:代表等待行动的状态
self::WAIT_SHIP => 'success', // 绿色:代表正常流程中的积极状态
self::WAIT_RECEIVE => 'warning', // 橙色:代表进行中的过渡状态
self::WAIT_COMMENT => 'info', // 浅蓝色:代表可操作但非紧急的状态
self::WAIT_REFUND => 'warning', // 橙色:代表需要关注的状态
self::REFUND_APPLY => 'danger', // 红色:代表需要紧急处理的状态
self::REFUND_AGREE => 'warning', // 橙色:代表处理中的过渡状态
self::REFUND_REFUSE => 'dark', // 深灰色:代表已处理的负面状态
self::REFUND_SUCCESS => 'success', // 绿色:代表成功完成的状态
self::EXCEPTION => 'danger', // 红色:代表需要紧急处理的异常情况
self::COMPLAIN => 'danger', // 红色:代表需要紧急处理的投诉情况
self::CANCEL => 'secondary', // 浅灰色:代表已取消的中性状态
self::EXPIRED => 'secondary', // 浅灰色:代表已过期的中性状态
default => 'secondary', // 浅灰色:代表未知状态
};
}
}