添加是否有售后判断依据
parent
cf1eab7749
commit
03cba58d9c
|
|
@ -25,6 +25,7 @@ class OrderProductResource extends JsonResource
|
|||
'total_amount' => $this->total_amount,
|
||||
'quantity' => $this->quantity,
|
||||
'can_after_sale' => $this->can_after_sale,
|
||||
'has_after_sale' => $this->has_after_sale, //显示【查看售后】按钮判断
|
||||
'is_gift' => $this->isGift(),
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,6 +113,20 @@ class OrderProduct extends Model
|
|||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单商品是否有售后
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getHasAfterSaleAttribute(): bool
|
||||
{
|
||||
$res = false;
|
||||
if ($this->afterSales()->count() > 0) {
|
||||
$res =true;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单商品销售价格
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue