预售库存状态
parent
1797c09e90
commit
48bbcb73a2
|
|
@ -36,6 +36,7 @@ class ProduckSkuResource extends JsonResource
|
|||
'growth_value' => (int) $this->growth_value,
|
||||
'sales_value' => (int) $this->sales_value,
|
||||
'is_bargaing' => $this->isBargaing() ? true : false,
|
||||
'is_pre_sale' => !!$this->is_pre_sale,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,6 +160,11 @@ class ProductSku extends Model
|
|||
*/
|
||||
public function getSaleableStockAttribute(): int
|
||||
{
|
||||
// 商品处于预售状态, 不限制库存
|
||||
$is_pre_sale = $this->spu->is_pre_sale || $this->is_pre_sale;
|
||||
if ($is_pre_sale) {
|
||||
return 9999;
|
||||
}
|
||||
if ($this->isOnline()) {
|
||||
return $this->attributes['stock'];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue