优化批零订单数据结构
parent
f6214506ef
commit
d29b2dc1b1
|
|
@ -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, //是否发货人身份
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue