优化批零订单数据结构
parent
f6214506ef
commit
d29b2dc1b1
|
|
@ -21,7 +21,7 @@ class OrderResource extends JsonResource
|
||||||
'total_amount' => $this->total_amount,
|
'total_amount' => $this->total_amount,
|
||||||
'created_at' => $this->created_at->toDateTimeString(),
|
'created_at' => $this->created_at->toDateTimeString(),
|
||||||
'status' => $this->status,
|
'status' => $this->status,
|
||||||
'pay_way' => (string) $this->pay_way?->getDealerOrderLabel(),
|
'pay_way' => (string) $this->pay_way?->label(),
|
||||||
'pay_info' => $this->getConsignorPayInfo(),
|
'pay_info' => $this->getConsignorPayInfo(),
|
||||||
'pay_image'=> $this->pay_image,
|
'pay_image'=> $this->pay_image,
|
||||||
'is_consignor' => $request->user()->id == $this->consignor_id, //是否发货人身份
|
'is_consignor' => $request->user()->id == $this->consignor_id, //是否发货人身份
|
||||||
|
|
|
||||||
|
|
@ -24,13 +24,14 @@ enum PayWay: string {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDealerOrderLabel()
|
public function label()
|
||||||
{
|
{
|
||||||
return match ($this) {
|
return match ($this) {
|
||||||
static::Offline => 'offline',
|
static::Offline => 'offline',
|
||||||
|
static::Balance => 'balance',
|
||||||
static::Wallet => 'wallet',
|
static::Wallet => 'wallet',
|
||||||
static::WxpayH5 => 'wxpay',
|
static::WxpayApp, static::WxpayH5, static::WxpayJs, static::WxpayMp => 'wxpay',
|
||||||
default => 'unknown',
|
static::AlipayApp => 'alipay',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue