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
This commit is contained in:
wangjia
2026-07-03 14:31:50 +08:00
parent 4d1d69595b
commit 2bf5b98ba2
28 changed files with 132 additions and 35 deletions
+8 -2
View File
@@ -5,7 +5,7 @@ import '../../core/theme/app_dims.g.dart';
import '../../core/theme/app_fonts.dart';
/// 图标块 .ic 变体(软底 + 前景色)。
enum DsKpiTone { info, ok, blue, alert }
enum DsKpiTone { info, ok, blue, alert, warn }
/// 环比方向 .d.up/.down(绿/红),neutral=纯文案(muted)。
enum DsKpiDelta { up, down, neutral }
@@ -41,6 +41,8 @@ class DsKpi extends StatelessWidget {
DsKpiTone.ok => (t.okSoft, t.success),
DsKpiTone.blue => (t.infoSoft, t.brand400),
DsKpiTone.alert => (t.accentSoft, t.accent),
// 暗黄(草稿卡):icon 与数字走 warn token
DsKpiTone.warn => (t.warnBg, t.warn),
};
final deltaColor = switch (deltaTone) {
DsKpiDelta.up => t.success,
@@ -88,7 +90,11 @@ class DsKpi extends StatelessWidget {
letterSpacing: 0.3,
fontFamily: AppFonts.mono,
fontFamilyFallback: AppFonts.monoFallback,
color: tone == DsKpiTone.alert ? t.accent : t.heading)),
color: switch (tone) {
DsKpiTone.alert => t.accent,
DsKpiTone.warn => t.warn,
_ => t.heading,
})),
if (delta != null) ...[
const SizedBox(height: 5),
// 原型 .d 的箭头是文本字符 ▲/▼(非图标),gap4。
+26 -11
View File
@@ -287,6 +287,9 @@ class _LinesTable extends StatelessWidget {
: Text(amountLabel,
textAlign: TextAlign.right, style: _hStyle(t)),
c6: _withProfit
? Text('总售价', textAlign: TextAlign.right, style: _hStyle(t))
: null,
c7: _withProfit
? Text('利润', textAlign: TextAlign.right, style: _hStyle(t))
: null,
),
@@ -344,6 +347,10 @@ class _LinesTable extends StatelessWidget {
: _priceCell(context, lines[i].amount, lines[i].pending,
accent: true),
c6: _withProfit
? _priceCell(context, lines[i].amount, lines[i].pending,
accent: true)
: null,
c7: _withProfit
? _profitCell(
context, lines[i].profit ?? '', lines[i].pending)
: null,
@@ -377,31 +384,38 @@ class _LinesTable extends StatelessWidget {
color: accent ? t.text : t.text));
}
// 5 列布局(对齐原型 grid 1fr 124 40 64 78);c6 非空时为出库 6 列形态
// (数量/成本价/售价/利润,数值列等宽收窄)。
// 5 列布局(对齐原型 grid 1fr 124 40 64 78);c6/c7 非空时为出库 7 列形态
// (数量/成本价/售价/总售价/利润,数值列等宽收窄)。
Widget _lineRow(BuildContext context,
{required Widget c1,
required Widget c2,
required Widget c3,
required Widget c4,
required Widget c5,
Widget? c6}) {
final six = c6 != null;
Widget? c6,
Widget? c7}) {
final wide = c6 != null;
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: c1),
const SizedBox(width: 8),
SizedBox(width: six ? 84 : 96, child: c2),
// 5 列(入库)时中间列加宽左移:商品列不再吃掉全部余宽,
// 「进价(单瓶)」表头一行放得下(2026-07-03 用户反馈)。
SizedBox(width: wide ? 100 : 124, child: c2),
const SizedBox(width: 8),
SizedBox(width: 34, child: c3),
SizedBox(width: wide ? 32 : 40, child: c3),
const SizedBox(width: 8),
SizedBox(width: six ? 56 : 60, child: c4),
SizedBox(width: wide ? 62 : 88, child: c4),
const SizedBox(width: 8),
SizedBox(width: six ? 56 : 72, child: c5),
if (six) ...[
SizedBox(width: wide ? 62 : 88, child: c5),
if (c6 != null) ...[
const SizedBox(width: 8),
SizedBox(width: 56, child: c6),
SizedBox(width: 62, child: c6),
],
if (c7 != null) ...[
const SizedBox(width: 8),
SizedBox(width: 62, child: c7),
],
],
);
@@ -421,7 +435,8 @@ class _LinesTable extends StatelessWidget {
return Text(text,
textAlign: TextAlign.right,
style: TextStyle(
fontSize: AppDims.fsBody,
// 明细数值列缩小一号(2026-07-03 用户反馈:列多时拥挤)
fontSize: AppDims.fsSm,
fontFamily: AppFonts.mono,
fontFamilyFallback: AppFonts.monoFallback,
fontWeight: FontWeight.w600,
@@ -326,9 +326,9 @@ class _ProductEditorDrawerState extends ConsumerState<_ProductEditorDrawer> {
));
}
final cost = widget.cost ?? p.purchasePrice;
if (cost != null && cost > 0) rows.add(('成本价', b(_fmtMoney(cost))));
if (cost != null && cost > 0) rows.add(('成本价(单瓶)', b(_fmtMoney(cost))));
if (widget.qty != null && cost != null && cost > 0) {
rows.add(('库存货值', b(_fmtMoney(widget.qty! * cost))));
rows.add(('总成本价', b(_fmtMoney(widget.qty! * cost))));
}
if ((widget.status ?? '').isNotEmpty) {
rows.add((