Merge branch 'develop' of gitee.com:zi-chunsheng-e-commerce/mall-server into 1.x
commit
11fe2d1d1c
|
|
@ -21,7 +21,7 @@ class OrderResource extends JsonResource
|
|||
'total_amount' => $this->total_amount,
|
||||
'created_at' => $this->created_at->toDateTimeString(),
|
||||
'status' => $this->status,
|
||||
'pay_way' => $this->pay_way ?? '',
|
||||
'pay_way' => (string) $this->pay_way?->getDealerOrderLabel(),
|
||||
'pay_info' => $this->getConsignorPayInfo(),
|
||||
'pay_image'=> $this->pay_image,
|
||||
'is_consignor' => $request->user()->id == $this->consignor_id, //是否发货人身份
|
||||
|
|
|
|||
|
|
@ -19,11 +19,21 @@ enum PayWay: string {
|
|||
return match ($this) {
|
||||
static::Offline => '#5b69bc',
|
||||
static::Wallet => '#ff8acc',
|
||||
static::WxpayH5 => '#21b978',
|
||||
static::WxpayApp, static::WxpayH5, static::WxpayJs, static::WxpayMp => '#21b978',
|
||||
default => '#ea5455',
|
||||
};
|
||||
}
|
||||
|
||||
public function getDealerOrderLabel()
|
||||
{
|
||||
return match ($this) {
|
||||
static::Offline => 'offline',
|
||||
static::Wallet => 'wallet',
|
||||
static::WxpayH5 => 'wxpay',
|
||||
default => 'unknown',
|
||||
};
|
||||
}
|
||||
|
||||
public function getDealerOrderText()
|
||||
{
|
||||
return match ($this) {
|
||||
|
|
|
|||
|
|
@ -165,6 +165,14 @@ class DealerOrder extends Model
|
|||
return $this->hasMany(DealerOrderRefuseLog::class, 'order_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 属于此订单的支付记录
|
||||
*/
|
||||
public function payLogs()
|
||||
{
|
||||
return $this->morphMany(PayLog::class, 'payable');
|
||||
}
|
||||
|
||||
public function isUser($userId)
|
||||
{
|
||||
return $this->user_id == $userId;
|
||||
|
|
@ -308,12 +316,4 @@ class DealerOrder extends Model
|
|||
}
|
||||
return $payInfo ?: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 属于此订单的支付记录
|
||||
*/
|
||||
public function payLogs()
|
||||
{
|
||||
return $this->morphMany(PayLog::class, 'payable');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue