59 lines
1.2 KiB
PHP
59 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Peidikeji\Order\Enums;
|
|
|
|
enum PayStatus: int
|
|
{
|
|
case None = 0;
|
|
case Processing = 1;
|
|
case Success = 2;
|
|
case Fail = 3;
|
|
case Refund = 4;
|
|
|
|
public static function options()
|
|
{
|
|
return [
|
|
self::None->value => '未付款',
|
|
self::Processing->value => '付款中',
|
|
self::Success->value => '已付款',
|
|
self::Fail->value => '支付失败',
|
|
self::Refund->value => '已退款',
|
|
];
|
|
}
|
|
|
|
public function text()
|
|
{
|
|
return data_get(self::options(), $this->value);
|
|
}
|
|
|
|
public function label()
|
|
{
|
|
$color = $this->color();
|
|
|
|
$name = $this->text();
|
|
|
|
return "<span class='label bg-${color}'>{$name}</span>";
|
|
}
|
|
|
|
public function color()
|
|
{
|
|
return match ($this) {
|
|
static::None => 'secondary',
|
|
static::Processing => 'primary',
|
|
self::Success => 'success',
|
|
self::Fail => 'danger',
|
|
self::Refund => 'secondary',
|
|
default => 'dark',
|
|
};
|
|
}
|
|
|
|
public function dot()
|
|
{
|
|
$color = $this->color();
|
|
|
|
$name = $this->text();
|
|
|
|
return "<i class='fa fa-circle text-$color'> {$name}</span>";
|
|
}
|
|
}
|