feat(client): 出库明细成本/售价/利润三列重设计 + 建单利润列 + 入库列头统一

- 出库详情抽屉(管理员):数量/成本价/售价/利润 + 合计金额/合计利润 双行;
  operator 见 售价/小计(服务端抹零+前端隐藏双保险);利润负数 danger
- 出库建单:商品名称下带编码(字体同系列列);金额列→利润列(实时);
  底栏合计利润(仅管理员);进价列仅管理员;提交发新 key(cost_price/sale_price)
- 入库建单列头:进价(单瓶)/ 参考售价 / 总进价
- 退单弹窗金额改售价口径(与冲应收一致);打印保留待定价回退成本兼容
- models 字段随后端消歧改名;golden 重打;新增抽屉双形态 widget 测试

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JJ1g8XV1YhhmHRzhwWEW7o
This commit is contained in:
wangjia
2026-07-03 12:44:22 +08:00
parent 4fd0bb8b83
commit 979ca3c83b
20 changed files with 400 additions and 145 deletions
+12 -12
View File
@@ -3,8 +3,8 @@ class StockInItem {
final int? orderId;
final int productId;
final double quantity;
final double unitPrice;
final double totalPrice;
final double costPrice; // 进价(单瓶)
final double costAmount; // 总进价 = quantity × costPrice
final double returnedQuantity; // 0=未退;>=quantity 表示整行已退单
final String? batchNo;
final String? productionDate;
@@ -26,8 +26,8 @@ class StockInItem {
this.orderId,
required this.productId,
required this.quantity,
required this.unitPrice,
required this.totalPrice,
required this.costPrice,
required this.costAmount,
this.returnedQuantity = 0,
this.batchNo,
this.productionDate,
@@ -57,8 +57,8 @@ class StockInItem {
json['order_id'] != null ? (json['order_id'] as num).toInt() : null,
productId: (json['product_id'] as num).toInt(),
quantity: (json['quantity'] as num).toDouble(),
unitPrice: (json['unit_price'] as num).toDouble(),
totalPrice: (json['total_price'] as num).toDouble(),
costPrice: (json['cost_price'] as num?)?.toDouble() ?? 0,
costAmount: (json['cost_amount'] as num?)?.toDouble() ?? 0,
returnedQuantity: (json['returned_quantity'] as num?)?.toDouble() ?? 0,
batchNo: json['batch_no'] as String?,
productionDate: json['production_date'] as String?,
@@ -81,8 +81,8 @@ class StockInItem {
Map<String, dynamic> toJson() => {
'product_id': productId,
'quantity': quantity,
'unit_price': unitPrice,
'total_price': totalPrice,
'cost_price': costPrice,
'cost_amount': costAmount,
if (batchNo != null) 'batch_no': batchNo,
if (productionDate != null) 'production_date': productionDate,
};
@@ -104,7 +104,7 @@ class StockInOrder {
final String returnState; // none | partial | full(退单状态)
final String? orderDate;
final String? reviewedAt;
final double? totalAmount;
final double? costTotal; // 应付合计 = Σ 总进价
final String? remark;
final List<StockInItem> items;
@@ -124,7 +124,7 @@ class StockInOrder {
this.returnState = 'none',
this.orderDate,
this.reviewedAt,
this.totalAmount,
this.costTotal,
this.remark,
this.items = const [],
});
@@ -155,8 +155,8 @@ class StockInOrder {
returnState: json['return_state'] as String? ?? 'none',
orderDate: json['order_date'] as String?,
reviewedAt: json['reviewed_at'] as String?,
totalAmount: json['total_amount'] != null
? (json['total_amount'] as num).toDouble()
costTotal: json['cost_total'] != null
? (json['cost_total'] as num).toDouble()
: null,
remark: json['remark'] as String?,
items: json['items'] != null
+17 -11
View File
@@ -3,9 +3,10 @@ class StockOutItem {
final int? orderId;
final int productId;
final double quantity;
final double unitPrice;
final double salePrice;
final double totalPrice;
final double costPrice; // 成本单价(入库成本快照,仅管理员可见——operator 响应被服务端抹零)
final double salePrice; // 销售单价
final double costAmount; // 成本小计 = quantity × costPrice
final double saleAmount; // 售价小计 = quantity × salePrice(待定价=0
final double returnedQuantity;
final String? productName;
final String? productCode;
@@ -22,9 +23,10 @@ class StockOutItem {
this.orderId,
required this.productId,
required this.quantity,
required this.unitPrice,
this.costPrice = 0,
this.salePrice = 0,
required this.totalPrice,
this.costAmount = 0,
this.saleAmount = 0,
this.returnedQuantity = 0,
this.productName,
this.productCode,
@@ -51,9 +53,10 @@ class StockOutItem {
json['order_id'] != null ? (json['order_id'] as num).toInt() : null,
productId: (json['product_id'] as num).toInt(),
quantity: (json['quantity'] as num).toDouble(),
unitPrice: (json['unit_price'] as num).toDouble(),
costPrice: (json['cost_price'] as num?)?.toDouble() ?? 0,
salePrice: (json['sale_price'] as num?)?.toDouble() ?? 0,
totalPrice: (json['total_price'] as num).toDouble(),
costAmount: (json['cost_amount'] as num?)?.toDouble() ?? 0,
saleAmount: (json['sale_amount'] as num?)?.toDouble() ?? 0,
returnedQuantity: (json['returned_quantity'] as num?)?.toDouble() ?? 0,
productName: lineOrProduct('product_name', 'name'),
productCode: lineOrProduct('product_code', 'code'),
@@ -85,7 +88,8 @@ class StockOutOrder {
final String? orderDate;
final String? reviewedAt;
final String? createdAt;
final double? totalAmount;
final double? saleTotal; // 应收合计 = Σ 售价小计
final double profitTotal; // 总利润(仅管理员可见,operator 被抹零)
final String? remark;
final List<StockOutItem> items;
@@ -106,7 +110,8 @@ class StockOutOrder {
this.orderDate,
this.reviewedAt,
this.createdAt,
this.totalAmount,
this.saleTotal,
this.profitTotal = 0,
this.remark,
this.items = const [],
});
@@ -138,9 +143,10 @@ class StockOutOrder {
orderDate: json['order_date'] as String?,
reviewedAt: json['reviewed_at'] as String?,
createdAt: json['created_at'] as String?,
totalAmount: json['total_amount'] != null
? (json['total_amount'] as num).toDouble()
saleTotal: json['sale_total'] != null
? (json['sale_total'] as num).toDouble()
: null,
profitTotal: (json['profit_total'] as num?)?.toDouble() ?? 0,
remark: json['remark'] as String?,
items: json['items'] != null
? (json['items'] as List)