账单价格

This commit is contained in:
liu
2026-09-13 23:13:09 +08:00
parent 3d1ec9c833
commit 5784875939
+4 -3
View File
@@ -22,6 +22,7 @@ class BillDetailService
{
$items = StoreOrderItemModel::query()
->where('bill_id', $bill->id)
->where('quantity', '>', 0)
->orderBy('id')
->get();
@@ -39,6 +40,7 @@ class BillDetailService
{
$items = StoreOrderItemModel::query()
->whereIn('bill_id', $billIds)
->where('quantity', '>', 0)
->orderBy('id')
->get();
@@ -73,15 +75,14 @@ class BillDetailService
$weight = bcadd($weight, (string) $item->weight, 3);
$amount = bcadd($amount, (string) $item->amount, 2);
}
$price = bcdiv($amount, (string) $quantity, 2);
$rows[] = [
'product_id' => (int) $productId,
'product_name' => $first->product_name,
'product_spec' => $first->product_spec,
'unit' => $first->unit,
'price' => $quantity > 0
? bcdiv($amount, (string) $quantity, 2)
: (string) $first->price,
'price' => $price,
'quantity' => $quantity,
'weight' => $weight,
'amount' => $amount,