diff --git a/app/Endpoint/Api/Http/Resources/Dealer/OrderResource.php b/app/Endpoint/Api/Http/Resources/Dealer/OrderResource.php index 22a01316..33c9f828 100644 --- a/app/Endpoint/Api/Http/Resources/Dealer/OrderResource.php +++ b/app/Endpoint/Api/Http/Resources/Dealer/OrderResource.php @@ -21,7 +21,7 @@ class OrderResource extends JsonResource 'total_amount' => $this->total_amount, 'created_at' => $this->created_at->toDateTimeString(), 'status' => $this->status, - 'pay_way' => (string) $this->pay_way?->getDealerOrderLabel(), + 'pay_way' => (string) $this->pay_way?->label(), 'pay_info' => $this->getConsignorPayInfo(), 'pay_image'=> $this->pay_image, 'is_consignor' => $request->user()->id == $this->consignor_id, //是否发货人身份 diff --git a/app/Enums/PayWay.php b/app/Enums/PayWay.php index 9c62a073..a35bc630 100644 --- a/app/Enums/PayWay.php +++ b/app/Enums/PayWay.php @@ -24,13 +24,14 @@ enum PayWay: string { }; } - public function getDealerOrderLabel() + public function label() { return match ($this) { static::Offline => 'offline', + static::Balance => 'balance', static::Wallet => 'wallet', - static::WxpayH5 => 'wxpay', - default => 'unknown', + static::WxpayApp, static::WxpayH5, static::WxpayJs, static::WxpayMp => 'wxpay', + static::AlipayApp => 'alipay', }; }