Files
jiu/client/lib/models/stock_summary.dart
T
wangjia a3a722689e feat(client): 出入库列表按原型重建(KPI/详情抽屉/详细搜索/工具栏/选中复制/窗口尺寸)
- 列表重建:KPI 卡、状态+时间列、操作改眼睛开右侧详情抽屉、重置右置
- 详情抽屉(order_detail_drawer) 100% 还原原型 + SelectionArea 可选中复制
- 详细搜索弹窗:ComboSearchField/滚轮日期、字段重构、白底盒子按钮
- 工具栏:搜索框×清除+占位精简、供应商/客户下拉取全部、状态菜单收窄
- 加载不白屏(半透明遮罩)、输入框与下拉等高、windows/macOS 默认窗口尺寸调大

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-02 08:48:01 +08:00

34 lines
1.2 KiB
Dart

/// 出/入库 KPI 汇总(本月 + 上月同期供环比 + 待审核)。
/// 对应后端 `GET /stock-in/summary`、`/stock-out/summary`。
class StockSummary {
final int monthCount;
final double monthAmount;
final int pendingCount;
final int lastMonthCount;
final double lastMonthAmount;
const StockSummary({
this.monthCount = 0,
this.monthAmount = 0,
this.pendingCount = 0,
this.lastMonthCount = 0,
this.lastMonthAmount = 0,
});
factory StockSummary.fromJson(Map<String, dynamic> j) => StockSummary(
monthCount: (j['month_count'] as num?)?.toInt() ?? 0,
monthAmount: (j['month_amount'] as num?)?.toDouble() ?? 0,
pendingCount: (j['pending_count'] as num?)?.toInt() ?? 0,
lastMonthCount: (j['last_month_count'] as num?)?.toInt() ?? 0,
lastMonthAmount: (j['last_month_amount'] as num?)?.toDouble() ?? 0,
);
/// 笔数环比(%);上月为 0 时返回 null(无从比较)。
double? get countDeltaPct =>
lastMonthCount == 0 ? null : (monthCount - lastMonthCount) / lastMonthCount * 100;
/// 金额环比(%);上月为 0 时返回 null。
double? get amountDeltaPct =>
lastMonthAmount == 0 ? null : (monthAmount - lastMonthAmount) / lastMonthAmount * 100;
}