6
0
Fork 0
jiqu-library-server/app/Enums/PayWay.php

74 lines
2.0 KiB
PHP

<?php
namespace App\Enums;
enum PayWay: string {
case Offline = 'offline';
case Balance = 'balance';
case Wallet = 'wallet';
// 微信支付
case WxpayApp = 'wxpay_app';
case WxpayH5 = 'wxpay_h5';
case WxpayJsApi = 'wxpay_jsapi';
case WxpayMiniProgram = 'wxpay_mp';
// 阿里支付
case AlipayApp = 'alipay_app';
public function color()
{
return match ($this) {
static::Offline => '#5b69bc',
static::Balance => '#dda451',
static::Wallet => '#ff8acc',
static::WxpayApp, static::WxpayH5, static::WxpayJsApi, static::WxpayMiniProgram => '#21b978',
static::AlipayApp => '#3085d6',
default => '#ea5455',
};
}
public function label()
{
return match ($this) {
static::Offline => 'offline',
static::Balance => 'balance',
static::Wallet => 'wallet',
static::WxpayApp, static::WxpayH5, static::WxpayJsApi, static::WxpayMiniProgram => 'wxpay',
static::AlipayApp => 'alipay',
};
}
public function getMallOrderText()
{
return match ($this) {
static::Offline => '线下',
static::Balance => '余额',
static::Wallet => '可提',
static::WxpayApp, static::WxpayH5, static::WxpayJsApi, static::WxpayMiniProgram => '微信支付',
static::AlipayApp => '支付宝',
default => 'Unknown',
};
}
public function getDealerOrderText()
{
return match ($this) {
static::Offline => '线下打款',
static::Wallet => '余额支付',
static::WxpayH5 => '微信支付',
default => 'Unknown',
};
}
/**
* @return string
*/
public static function dealerOrderTexts(): array
{
return [
static::Offline->value => '线下打款',
static::Wallet->value => '余额支付',
static::WxpayH5->value => '微信支付',
];
}
}