color(); $color = Admin::color()->get($color, $color); return ' '.$this->text() ?? 'Unknown'; } public function color() { return match ($this) { static::Offline => '#5b69bc', static::Balance => '#dda451', static::Wallet => '#ff8acc', static::WxpayApp, static::WxpayH5, static::WxpayJsApi, static::WxpayMiniProgram, static::WxpayTransfer, static::WxPayShare => '#21b978', static::AlipayApp => '#3085d6', default => '#ea5455', }; } public function label() { return match ($this) { static::None => 'none', static::Offline => 'offline', static::Balance => 'balance', static::Wallet => 'wallet', static::WxpayApp, static::WxpayH5, static::WxpayJsApi, static::WxpayMiniProgram, static::WxPayShare => 'wxpay', static::AlipayApp => 'alipay', }; } /** * 支付方式文本 * * @return string */ public function text(): string { return match ($this) { static::None => '无', static::Offline => '线下', static::Balance => '余额', static::Wallet => '钱包', static::WxpayApp, static::WxpayH5, static::WxpayJsApi, static::WxpayMiniProgram => '微信支付', static::AlipayApp => '支付宝', static::WxpayTransfer => '微信企业付款', static::WxPayShare => '微信分账', }; } /** * 支付方式对应的颜色 * * @return array */ public static function colors(): array { return [ static::Offline->value => '#5b69bc', static::Balance->value => '#dda451', static::Wallet->value => '#ff8acc', // 微信支付 static::WxpayApp->value => '#21b978', static::WxpayH5->value => '#21b978', static::WxpayJsApi->value => '#21b978', static::WxpayMiniProgram->value => '#21b978', static::WxPayShare->value => '#21b978', // 支付宝 static::AlipayApp->value => '#3085d6', ]; } }