feat(backend): 库存接口带出售价 sale_price(库存屏成本价/单价两列地基)

照原型库存表「成本价(进价)+单价(售价)」两列:
- 库存查询 SELECT 加 p.sale_price AS sale_price;成本价 unit_price 补 p.purchase_price 兜底
- inventoryRow 加 SalePrice;前端 Inventory model 加 salePrice
- 多租户隔离不变(baseWhere 仍 inv.shop_id);库存测试通过

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TSKEiHsvauyxYUW2itzUXX
This commit is contained in:
wangjia
2026-06-25 19:56:27 +08:00
parent 23a583918d
commit 5e4cc668e5
2 changed files with 8 additions and 3 deletions
+4 -1
View File
@@ -15,7 +15,8 @@ class Inventory {
final String spec;
final String unit;
final String warehouseName;
final double? unitPrice;
final double? unitPrice; // 成本价(入库进价)
final double? salePrice; // 单价(product 售价)
final String? productionDate;
final String batchNo;
final String supplierName;
@@ -37,6 +38,7 @@ class Inventory {
this.unit = '',
this.warehouseName = '',
this.unitPrice,
this.salePrice,
this.productionDate,
this.batchNo = '',
this.supplierName = '',
@@ -59,6 +61,7 @@ class Inventory {
unit: json['unit'] as String? ?? '',
warehouseName: json['warehouse_name'] as String? ?? '',
unitPrice: (json['unit_price'] as num?)?.toDouble(),
salePrice: (json['sale_price'] as num?)?.toDouble(),
productionDate: _parseDate(json['production_date'] as String?),
batchNo: json['batch_no'] as String? ?? '',
supplierName: json['supplier_name'] as String? ?? '',