4
0
Fork 0
dcat-admin-order/src/Enums/ShipStatus.php

60 lines
1.2 KiB
PHP

<?php
namespace Peidikeji\Order\Enums;
use Dcat\Admin\Admin;
/**
* 订单发货状态
*/
enum ShipStatus: int
{
case None = 0;
case Processing = 1;
case Finished = 3;
case Received = 4;
public static function options()
{
return [
self::None->value => '未发货',
self::Processing->value => '已发货(部分)',
self::Finished->value => '已发货(全部)',
self::Received->value => '已收货',
];
}
public function text()
{
return data_get(self::options(), $this->value);
}
public function color()
{
return match ($this) {
static::None => 'dark',
static::Processing => 'warning',
static::Finished => 'danger',
static::Received => 'success',
};
}
public function label()
{
$color = $this->color();
$name = $this->text();
return "<span class='label bg-${color}'>{$name}</span>";
}
public function dot()
{
$color = $this->color();
$name = $this->text();
return "<i class='fa fa-circle text-$color'>&nbsp;&nbsp;{$name}</span>";
}
}