账单总金额

This commit is contained in:
liu
2026-09-07 23:07:12 +08:00
parent 7de51391e4
commit 58c733baa2
6 changed files with 54 additions and 2 deletions
+24
View File
@@ -741,4 +741,28 @@ class PurchaseEditTest extends ProcurementTestCase
->assertJsonPath('data.count', 0);
$this->assertSame(0, PurchaseItemCheckModel::count());
}
/** 采购单列表「应付商品金额」列 = Σ 已生成门店账单的商品金额(未生成账单为 null) */
public function test_list_includes_bill_product_amount(): void
{
[$purchase, , $stores] = $this->buildPurchase();
$this->actingAsSysUser();
// 未生成账单 → null
$this->getJson('/purchase/order')
->assertJsonPath('data.data.0.bill_product_amount', null);
// 完成采购单并生成两店账单(各店商品金额 = 数量 × 等级价 10.00)
$purchase->update(['status' => PurchaseOrderModel::STATUS_COMPLETED]);
$this->postJson("/purchase/order/{$purchase->id}/bill", [
'stores' => [
['store_id' => $stores[0]->id, 'delivery_fee' => 0, 'box_num' => 0, 'tray_num' => 0],
['store_id' => $stores[1]->id, 'delivery_fee' => 0, 'box_num' => 0, 'tray_num' => 0],
],
])->assertJsonPath('success', true);
// 列表回显:2×10.00 + 3×10.00 = 50.00
$this->getJson('/purchase/order')
->assertJsonPath('data.data.0.bill_product_amount', '50.00');
}
}