Files
jiu/client/lib/models/stock_summary.dart
T
wangjia 2bf5b98ba2 feat(client): 草稿 KPI 卡(暗黄)+ 出库详情总售价列 + 明细去¥缩号 + 建单默认值 + 若干列名
- 出入库列表加草稿 KPI 卡(DsKpiTone.warn 新档,审核卡后,点击筛选草稿)
- 出库详情 7 列:售价后加总售价;明细行内价格去 ¥ 且缩一号(合计保留 ¥);
  5/7 列宽重排(系列/数量左移、进价(单瓶)不折行)
- 出库建单:数量默认=可用数量、售价默认=参考售价(product.sale_price)
- 入库详情列名:进价(单瓶)/总价;库存列表「单价」→「总价」(库存×成本);
  商品抽屉:成本价(单瓶)/总成本价
- 公开商品预览页加返回按钮(仅 App 内 canPop 时显示,扫码直达保持纯净)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JJ1g8XV1YhhmHRzhwWEW7o
2026-07-03 14:31:50 +08:00

39 lines
1.4 KiB
Dart

/// 出/入库 KPI 汇总(本月 + 上月同期供环比 + 待审核)。
/// 对应后端 `GET /stock-in/summary`、`/stock-out/summary`。
class StockSummary {
final int monthCount;
final double monthAmount;
final int pendingCount;
final int draftCount;
final int lastMonthCount;
final double lastMonthAmount;
const StockSummary({
this.monthCount = 0,
this.monthAmount = 0,
this.pendingCount = 0,
this.draftCount = 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,
draftCount: (j['draft_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;
}