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

73 lines
1.7 KiB
PHP

<?php
namespace Peidikeji\Order\Enums;
/**
* 发货单物流状态
*/
enum OrderShipStatus: int
{
case Ontheway = 0;
case Wait = 1;
case Question = 2;
case Check = 3;
case Refund = 4;
case Distribute = 5;
case Refuse = 6;
case Other = 10;
case Autocheck = 11;
public static function options()
{
return [
static::Ontheway->value => '途中',
static::Wait->value => '揽收',
static::Question->value => '问题包裹',
static::Check->value => '签收',
static::Refund->value => '退签',
static::Distribute->value => '派送',
static::Refuse->value => '拒签',
static::Other->value => '其他',
static::Autocheck->value => '自动签收',
];
}
public function text()
{
return data_get(self::options(), $this->value);
}
public function color()
{
return match ($this) {
static::Wait => 'primary',
static::Ontheway => 'primary',
static::Distribute => 'primary',
static::Check => 'success',
static::Question => 'danger',
static::Refund => 'danger',
static::Refuse => 'danger',
static::Other => 'warning',
static::Autocheck => '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>";
}
}