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
@@ -4,6 +4,7 @@ class StockSummary {
|
|||||||
final int monthCount;
|
final int monthCount;
|
||||||
final double monthAmount;
|
final double monthAmount;
|
||||||
final int pendingCount;
|
final int pendingCount;
|
||||||
|
final int draftCount;
|
||||||
final int lastMonthCount;
|
final int lastMonthCount;
|
||||||
final double lastMonthAmount;
|
final double lastMonthAmount;
|
||||||
|
|
||||||
@@ -11,6 +12,7 @@ class StockSummary {
|
|||||||
this.monthCount = 0,
|
this.monthCount = 0,
|
||||||
this.monthAmount = 0,
|
this.monthAmount = 0,
|
||||||
this.pendingCount = 0,
|
this.pendingCount = 0,
|
||||||
|
this.draftCount = 0,
|
||||||
this.lastMonthCount = 0,
|
this.lastMonthCount = 0,
|
||||||
this.lastMonthAmount = 0,
|
this.lastMonthAmount = 0,
|
||||||
});
|
});
|
||||||
@@ -19,6 +21,7 @@ class StockSummary {
|
|||||||
monthCount: (j['month_count'] as num?)?.toInt() ?? 0,
|
monthCount: (j['month_count'] as num?)?.toInt() ?? 0,
|
||||||
monthAmount: (j['month_amount'] as num?)?.toDouble() ?? 0,
|
monthAmount: (j['month_amount'] as num?)?.toDouble() ?? 0,
|
||||||
pendingCount: (j['pending_count'] as num?)?.toInt() ?? 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,
|
lastMonthCount: (j['last_month_count'] as num?)?.toInt() ?? 0,
|
||||||
lastMonthAmount: (j['last_month_amount'] as num?)?.toDouble() ?? 0,
|
lastMonthAmount: (j['last_month_amount'] as num?)?.toDouble() ?? 0,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
|||||||
static const _statusOptions = ['全部', '在售', '预警', '缺货'];
|
static const _statusOptions = ['全部', '在售', '预警', '缺货'];
|
||||||
|
|
||||||
// 列序照原型 inventory.html COLS:商品/规格/系列/批次/库存/成本价/单价/生产/入库/供应商/状态/操作。
|
// 列序照原型 inventory.html COLS:商品/规格/系列/批次/库存/成本价/单价/生产/入库/供应商/状态/操作。
|
||||||
// 成本价=入库进价(unitPrice),单价=售价(salePrice)。
|
// 成本价=入库进价(unitPrice),总价=库存×成本价(2026-07-03 用户拍板:原「单价/参考售价」列换掉)。
|
||||||
// 仓库/备注原型没有 → 默认隐藏的可选列(列设置可开)。
|
// 仓库/备注原型没有 → 默认隐藏的可选列(列设置可开)。
|
||||||
static const _colDefs = [
|
static const _colDefs = [
|
||||||
ColDef('product', '商品', required: true),
|
ColDef('product', '商品', required: true),
|
||||||
@@ -59,7 +59,7 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
|||||||
ColDef('batch', '批次号'),
|
ColDef('batch', '批次号'),
|
||||||
ColDef('qty', '库存'),
|
ColDef('qty', '库存'),
|
||||||
ColDef('cost', '成本价'),
|
ColDef('cost', '成本价'),
|
||||||
ColDef('price', '单价'),
|
ColDef('price', '总价'),
|
||||||
ColDef('prodDate', '生产日期'),
|
ColDef('prodDate', '生产日期'),
|
||||||
ColDef('inTime', '入库时间'),
|
ColDef('inTime', '入库时间'),
|
||||||
ColDef('supplier', '供应商'),
|
ColDef('supplier', '供应商'),
|
||||||
@@ -274,7 +274,7 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
|||||||
'批次号',
|
'批次号',
|
||||||
'库存量',
|
'库存量',
|
||||||
'成本价',
|
'成本价',
|
||||||
'单价',
|
'总价',
|
||||||
'生产日期',
|
'生产日期',
|
||||||
'入库时间',
|
'入库时间',
|
||||||
'供应商',
|
'供应商',
|
||||||
@@ -295,7 +295,9 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
|||||||
item.batchNo,
|
item.batchNo,
|
||||||
'${item.quantity.toStringAsFixed(0)} ${item.unit}'.trim(),
|
'${item.quantity.toStringAsFixed(0)} ${item.unit}'.trim(),
|
||||||
item.unitPrice != null ? item.unitPrice!.toStringAsFixed(2) : '',
|
item.unitPrice != null ? item.unitPrice!.toStringAsFixed(2) : '',
|
||||||
item.salePrice != null ? item.salePrice!.toStringAsFixed(2) : '',
|
item.unitPrice != null
|
||||||
|
? (item.unitPrice! * item.quantity).toStringAsFixed(2)
|
||||||
|
: '',
|
||||||
item.productionDate ?? '',
|
item.productionDate ?? '',
|
||||||
item.createdAt != null && item.createdAt!.length >= 10
|
item.createdAt != null && item.createdAt!.length >= 10
|
||||||
? item.createdAt!.substring(0, 10)
|
? item.createdAt!.substring(0, 10)
|
||||||
@@ -362,11 +364,11 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
|||||||
fontFamily: AppFonts.mono,
|
fontFamily: AppFonts.mono,
|
||||||
fontFamilyFallback: AppFonts.monoFallback)),
|
fontFamilyFallback: AppFonts.monoFallback)),
|
||||||
'price' => Text(
|
'price' => Text(
|
||||||
item.salePrice != null
|
item.unitPrice != null
|
||||||
? '¥${item.salePrice!.toStringAsFixed(2)}'
|
? _fmtCost(item.unitPrice! * item.quantity)
|
||||||
: '待定价',
|
: '-',
|
||||||
style: item.salePrice == null
|
style: item.unitPrice == null
|
||||||
? TextStyle(color: t.warn, fontWeight: FontWeight.w600)
|
? TextStyle(color: t.faint)
|
||||||
: const TextStyle(
|
: const TextStyle(
|
||||||
fontFamily: AppFonts.mono,
|
fontFamily: AppFonts.mono,
|
||||||
fontFamilyFallback: AppFonts.monoFallback)),
|
fontFamilyFallback: AppFonts.monoFallback)),
|
||||||
|
|||||||
@@ -128,6 +128,17 @@ class _PublicProductScreenState extends State<PublicProductScreen> {
|
|||||||
if (_error != null || _data == null) {
|
if (_error != null || _data == null) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: _kPaper,
|
backgroundColor: _kPaper,
|
||||||
|
// 加载失败态也要能退回 App(canPop 时显示返回,扫码直达不显示)
|
||||||
|
appBar: Navigator.of(context).canPop()
|
||||||
|
? AppBar(
|
||||||
|
backgroundColor: _kPaper,
|
||||||
|
elevation: 0,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: const Icon(LucideIcons.arrowLeft, color: _kBurgundy),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
body: Center(
|
body: Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(32),
|
padding: const EdgeInsets.all(32),
|
||||||
@@ -199,10 +210,14 @@ class _PublicProductScreenState extends State<PublicProductScreen> {
|
|||||||
_parseQuickSpecs(spec, batch?['production_date'] as String?);
|
_parseQuickSpecs(spec, batch?['production_date'] as String?);
|
||||||
final productionDate = batch?['production_date'] as String?;
|
final productionDate = batch?['production_date'] as String?;
|
||||||
|
|
||||||
|
// App 内「预览」推入时可返回(canPop);顾客扫码/网页直达无返回栈则不渲染,
|
||||||
|
// 页面对外保持纯净(本页为独立品牌样式,按钮用自有暖纸/酒红配色)。
|
||||||
|
final canPop = Navigator.of(context).canPop();
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: _kPaperDeep,
|
backgroundColor: _kPaperDeep,
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Center(
|
child: Stack(children: [
|
||||||
|
Center(
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: const BoxConstraints(maxWidth: 520),
|
constraints: const BoxConstraints(maxWidth: 520),
|
||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
@@ -286,7 +301,28 @@ class _PublicProductScreenState extends State<PublicProductScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (canPop)
|
||||||
|
Positioned(
|
||||||
|
top: 12,
|
||||||
|
left: 12,
|
||||||
|
child: Material(
|
||||||
|
color: _kPaper.withValues(alpha: 0.92),
|
||||||
|
shape: const CircleBorder(
|
||||||
|
side: BorderSide(color: _kBurgundyLight)),
|
||||||
|
elevation: 2,
|
||||||
|
child: InkWell(
|
||||||
|
customBorder: const CircleBorder(),
|
||||||
|
onTap: () => Navigator.of(context).pop(),
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.all(9),
|
||||||
|
child:
|
||||||
|
Icon(LucideIcons.arrowLeft, size: 20, color: _kBurgundy),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -498,6 +498,14 @@ class _StockInListScreenState extends ConsumerState<StockInListScreen> {
|
|||||||
: DsKpiDelta.neutral,
|
: DsKpiDelta.neutral,
|
||||||
onTap: () => _setStatus('pending'),
|
onTap: () => _setStatus('pending'),
|
||||||
),
|
),
|
||||||
|
DsKpi(
|
||||||
|
title: '草稿单数 · 点击筛选',
|
||||||
|
value: '${summary?.draftCount ?? 0}',
|
||||||
|
icon: LucideIcons.filePen,
|
||||||
|
tone: DsKpiTone.warn, // 暗黄(用户拍板)
|
||||||
|
delta: (summary?.draftCount ?? 0) > 0 ? '待提交审核' : '点击筛选',
|
||||||
|
onTap: () => _setStatus('draft'),
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
final mobile = context.isMobile;
|
final mobile = context.isMobile;
|
||||||
@@ -861,6 +869,8 @@ class _StockInListScreenState extends ConsumerState<StockInListScreen> {
|
|||||||
|
|
||||||
static final _money =
|
static final _money =
|
||||||
NumberFormat.currency(locale: 'zh_CN', symbol: '¥', decimalDigits: 0);
|
NumberFormat.currency(locale: 'zh_CN', symbol: '¥', decimalDigits: 0);
|
||||||
|
// 明细行内数字(去 ¥,符号只留在合计)
|
||||||
|
static final _num = NumberFormat('#,##0');
|
||||||
static String _fmtQty(double q) =>
|
static String _fmtQty(double q) =>
|
||||||
q == q.roundToDouble() ? q.toStringAsFixed(0) : q.toString();
|
q == q.roundToDouble() ? q.toStringAsFixed(0) : q.toString();
|
||||||
|
|
||||||
@@ -896,13 +906,14 @@ class _StockInListScreenState extends ConsumerState<StockInListScreen> {
|
|||||||
series: it.productSeries ?? '—',
|
series: it.productSeries ?? '—',
|
||||||
spec: it.productSpec ?? '',
|
spec: it.productSpec ?? '',
|
||||||
qty: _fmtQty(it.quantity),
|
qty: _fmtQty(it.quantity),
|
||||||
price: it.costPrice == 0 ? '待定价' : _money.format(it.costPrice),
|
price: it.costPrice == 0 ? '待定价' : _num.format(it.costPrice),
|
||||||
amount:
|
amount: it.costAmount == 0 ? '待定价' : _num.format(it.costAmount),
|
||||||
it.costAmount == 0 ? '待定价' : _money.format(it.costAmount),
|
|
||||||
pending: it.costPrice == 0,
|
pending: it.costPrice == 0,
|
||||||
))
|
))
|
||||||
.toList(),
|
.toList(),
|
||||||
totalText: o.costTotal != null ? _money.format(o.costTotal) : '—',
|
totalText: o.costTotal != null ? _money.format(o.costTotal) : '—',
|
||||||
|
priceLabel: '进价(单瓶)',
|
||||||
|
amountLabel: '总价',
|
||||||
actionGroups: _detailActionGroups(o),
|
actionGroups: _detailActionGroups(o),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class _PickerItem {
|
|||||||
final String spec;
|
final String spec;
|
||||||
final String unit;
|
final String unit;
|
||||||
final double? costPrice; // 进价(成本,仅管理员可见列)
|
final double? costPrice; // 进价(成本,仅管理员可见列)
|
||||||
|
final double? salePrice; // 参考售价(入库时填写,存 product.sale_price)
|
||||||
final double availableQty;
|
final double availableQty;
|
||||||
const _PickerItem({
|
const _PickerItem({
|
||||||
required this.productId,
|
required this.productId,
|
||||||
@@ -45,6 +46,7 @@ class _PickerItem {
|
|||||||
required this.spec,
|
required this.spec,
|
||||||
required this.unit,
|
required this.unit,
|
||||||
this.costPrice,
|
this.costPrice,
|
||||||
|
this.salePrice,
|
||||||
required this.availableQty,
|
required this.availableQty,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -64,6 +66,7 @@ List<_PickerItem> _aggregatePickerItems(List<Inventory> rows) {
|
|||||||
spec: existing.spec,
|
spec: existing.spec,
|
||||||
unit: existing.unit,
|
unit: existing.unit,
|
||||||
costPrice: existing.costPrice ?? inv.unitPrice,
|
costPrice: existing.costPrice ?? inv.unitPrice,
|
||||||
|
salePrice: existing.salePrice ?? inv.salePrice,
|
||||||
availableQty: existing.availableQty + inv.quantity,
|
availableQty: existing.availableQty + inv.quantity,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -75,6 +78,7 @@ List<_PickerItem> _aggregatePickerItems(List<Inventory> rows) {
|
|||||||
spec: inv.spec,
|
spec: inv.spec,
|
||||||
unit: inv.unit,
|
unit: inv.unit,
|
||||||
costPrice: inv.unitPrice,
|
costPrice: inv.unitPrice,
|
||||||
|
salePrice: inv.salePrice,
|
||||||
availableQty: inv.quantity,
|
availableQty: inv.quantity,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -264,7 +268,7 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
for (final item in selected) {
|
for (final item in selected) {
|
||||||
if (_items.any((row) => row.productId == item.productId)) continue;
|
if (_items.any((row) => row.productId == item.productId)) continue;
|
||||||
_items.add(_ItemRow(
|
final row = _ItemRow(
|
||||||
productId: item.productId,
|
productId: item.productId,
|
||||||
productCode: item.productCode,
|
productCode: item.productCode,
|
||||||
productName: item.productName,
|
productName: item.productName,
|
||||||
@@ -272,7 +276,11 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
|||||||
spec: item.spec,
|
spec: item.spec,
|
||||||
costPrice: item.costPrice,
|
costPrice: item.costPrice,
|
||||||
availableQty: item.availableQty,
|
availableQty: item.availableQty,
|
||||||
));
|
salePrice: item.salePrice, // 售价默认带出入库时填的参考售价
|
||||||
|
);
|
||||||
|
// 数量默认带出可用数量(整箱出为主,改少比补多顺手)
|
||||||
|
row.qtyCtrl.text = item.availableQty.toStringAsFixed(0);
|
||||||
|
_items.add(row);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -532,6 +532,17 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
|||||||
ref.read(stockOutListProvider.notifier).setStatus('pending');
|
ref.read(stockOutListProvider.notifier).setStatus('pending');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
DsKpi(
|
||||||
|
title: '草稿单数 · 点击筛选',
|
||||||
|
value: '${summary?.draftCount ?? 0}',
|
||||||
|
icon: LucideIcons.filePen,
|
||||||
|
tone: DsKpiTone.warn, // 暗黄(用户拍板)
|
||||||
|
delta: (summary?.draftCount ?? 0) > 0 ? '待提交审核' : '点击筛选',
|
||||||
|
onTap: () {
|
||||||
|
setState(() => _statusFilter = 'draft');
|
||||||
|
ref.read(stockOutListProvider.notifier).setStatus('draft');
|
||||||
|
},
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
final mobile = context.isMobile;
|
final mobile = context.isMobile;
|
||||||
@@ -845,6 +856,8 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
|||||||
|
|
||||||
static final _money =
|
static final _money =
|
||||||
NumberFormat.currency(locale: 'zh_CN', symbol: '¥', decimalDigits: 0);
|
NumberFormat.currency(locale: 'zh_CN', symbol: '¥', decimalDigits: 0);
|
||||||
|
// 明细行内数字(去 ¥:列多时更紧凑,符号只留在合计)
|
||||||
|
static final _num = NumberFormat('#,##0');
|
||||||
static String _fmtQty(double q) =>
|
static String _fmtQty(double q) =>
|
||||||
q == q.roundToDouble() ? q.toStringAsFixed(0) : q.toString();
|
q == q.roundToDouble() ? q.toStringAsFixed(0) : q.toString();
|
||||||
|
|
||||||
@@ -885,10 +898,10 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
|||||||
series: it.productSeries ?? '—',
|
series: it.productSeries ?? '—',
|
||||||
spec: it.productSpec ?? '',
|
spec: it.productSpec ?? '',
|
||||||
qty: _fmtQty(it.quantity),
|
qty: _fmtQty(it.quantity),
|
||||||
price: pending ? '待定价' : _money.format(it.salePrice),
|
price: pending ? '待定价' : _num.format(it.salePrice),
|
||||||
amount: pending ? '待定价' : _money.format(it.saleAmount),
|
amount: pending ? '待定价' : _num.format(it.saleAmount),
|
||||||
cost: admin ? _money.format(it.costPrice) : null,
|
cost: admin ? _num.format(it.costPrice) : null,
|
||||||
profit: admin ? (pending ? '待定价' : _money.format(profit)) : null,
|
profit: admin ? (pending ? '待定价' : _num.format(profit)) : null,
|
||||||
pending: pending,
|
pending: pending,
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import '../../core/theme/app_dims.g.dart';
|
|||||||
import '../../core/theme/app_fonts.dart';
|
import '../../core/theme/app_fonts.dart';
|
||||||
|
|
||||||
/// 图标块 .ic 变体(软底 + 前景色)。
|
/// 图标块 .ic 变体(软底 + 前景色)。
|
||||||
enum DsKpiTone { info, ok, blue, alert }
|
enum DsKpiTone { info, ok, blue, alert, warn }
|
||||||
|
|
||||||
/// 环比方向 .d.up/.down(绿/红),neutral=纯文案(muted)。
|
/// 环比方向 .d.up/.down(绿/红),neutral=纯文案(muted)。
|
||||||
enum DsKpiDelta { up, down, neutral }
|
enum DsKpiDelta { up, down, neutral }
|
||||||
@@ -41,6 +41,8 @@ class DsKpi extends StatelessWidget {
|
|||||||
DsKpiTone.ok => (t.okSoft, t.success),
|
DsKpiTone.ok => (t.okSoft, t.success),
|
||||||
DsKpiTone.blue => (t.infoSoft, t.brand400),
|
DsKpiTone.blue => (t.infoSoft, t.brand400),
|
||||||
DsKpiTone.alert => (t.accentSoft, t.accent),
|
DsKpiTone.alert => (t.accentSoft, t.accent),
|
||||||
|
// 暗黄(草稿卡):icon 与数字走 warn token
|
||||||
|
DsKpiTone.warn => (t.warnBg, t.warn),
|
||||||
};
|
};
|
||||||
final deltaColor = switch (deltaTone) {
|
final deltaColor = switch (deltaTone) {
|
||||||
DsKpiDelta.up => t.success,
|
DsKpiDelta.up => t.success,
|
||||||
@@ -88,7 +90,11 @@ class DsKpi extends StatelessWidget {
|
|||||||
letterSpacing: 0.3,
|
letterSpacing: 0.3,
|
||||||
fontFamily: AppFonts.mono,
|
fontFamily: AppFonts.mono,
|
||||||
fontFamilyFallback: AppFonts.monoFallback,
|
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) ...[
|
if (delta != null) ...[
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
// 原型 .d 的箭头是文本字符 ▲/▼(非图标),gap4。
|
// 原型 .d 的箭头是文本字符 ▲/▼(非图标),gap4。
|
||||||
|
|||||||
@@ -287,6 +287,9 @@ class _LinesTable extends StatelessWidget {
|
|||||||
: Text(amountLabel,
|
: Text(amountLabel,
|
||||||
textAlign: TextAlign.right, style: _hStyle(t)),
|
textAlign: TextAlign.right, style: _hStyle(t)),
|
||||||
c6: _withProfit
|
c6: _withProfit
|
||||||
|
? Text('总售价', textAlign: TextAlign.right, style: _hStyle(t))
|
||||||
|
: null,
|
||||||
|
c7: _withProfit
|
||||||
? Text('利润', textAlign: TextAlign.right, style: _hStyle(t))
|
? Text('利润', textAlign: TextAlign.right, style: _hStyle(t))
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
@@ -344,6 +347,10 @@ class _LinesTable extends StatelessWidget {
|
|||||||
: _priceCell(context, lines[i].amount, lines[i].pending,
|
: _priceCell(context, lines[i].amount, lines[i].pending,
|
||||||
accent: true),
|
accent: true),
|
||||||
c6: _withProfit
|
c6: _withProfit
|
||||||
|
? _priceCell(context, lines[i].amount, lines[i].pending,
|
||||||
|
accent: true)
|
||||||
|
: null,
|
||||||
|
c7: _withProfit
|
||||||
? _profitCell(
|
? _profitCell(
|
||||||
context, lines[i].profit ?? '—', lines[i].pending)
|
context, lines[i].profit ?? '—', lines[i].pending)
|
||||||
: null,
|
: null,
|
||||||
@@ -377,31 +384,38 @@ class _LinesTable extends StatelessWidget {
|
|||||||
color: accent ? t.text : t.text));
|
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,
|
Widget _lineRow(BuildContext context,
|
||||||
{required Widget c1,
|
{required Widget c1,
|
||||||
required Widget c2,
|
required Widget c2,
|
||||||
required Widget c3,
|
required Widget c3,
|
||||||
required Widget c4,
|
required Widget c4,
|
||||||
required Widget c5,
|
required Widget c5,
|
||||||
Widget? c6}) {
|
Widget? c6,
|
||||||
final six = c6 != null;
|
Widget? c7}) {
|
||||||
|
final wide = c6 != null;
|
||||||
return Row(
|
return Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: c1),
|
Expanded(child: c1),
|
||||||
const SizedBox(width: 8),
|
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),
|
const SizedBox(width: 8),
|
||||||
SizedBox(width: 34, child: c3),
|
SizedBox(width: wide ? 32 : 40, child: c3),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
SizedBox(width: six ? 56 : 60, child: c4),
|
SizedBox(width: wide ? 62 : 88, child: c4),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
SizedBox(width: six ? 56 : 72, child: c5),
|
SizedBox(width: wide ? 62 : 88, child: c5),
|
||||||
if (six) ...[
|
if (c6 != null) ...[
|
||||||
const SizedBox(width: 8),
|
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,
|
return Text(text,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: AppDims.fsBody,
|
// 明细数值列缩小一号(2026-07-03 用户反馈:列多时拥挤)
|
||||||
|
fontSize: AppDims.fsSm,
|
||||||
fontFamily: AppFonts.mono,
|
fontFamily: AppFonts.mono,
|
||||||
fontFamilyFallback: AppFonts.monoFallback,
|
fontFamilyFallback: AppFonts.monoFallback,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
|
|||||||
@@ -326,9 +326,9 @@ class _ProductEditorDrawerState extends ConsumerState<_ProductEditorDrawer> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
final cost = widget.cost ?? p.purchasePrice;
|
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) {
|
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) {
|
if ((widget.status ?? '').isNotEmpty) {
|
||||||
rows.add((
|
rows.add((
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 423 KiB After Width: | Height: | Size: 420 KiB |
|
Before Width: | Height: | Size: 416 KiB After Width: | Height: | Size: 414 KiB |
|
Before Width: | Height: | Size: 424 KiB After Width: | Height: | Size: 422 KiB |
|
Before Width: | Height: | Size: 301 KiB After Width: | Height: | Size: 301 KiB |
|
Before Width: | Height: | Size: 296 KiB After Width: | Height: | Size: 296 KiB |
|
Before Width: | Height: | Size: 302 KiB After Width: | Height: | Size: 302 KiB |
|
Before Width: | Height: | Size: 291 KiB After Width: | Height: | Size: 294 KiB |
|
Before Width: | Height: | Size: 287 KiB After Width: | Height: | Size: 289 KiB |
|
Before Width: | Height: | Size: 292 KiB After Width: | Height: | Size: 295 KiB |
|
Before Width: | Height: | Size: 434 KiB After Width: | Height: | Size: 438 KiB |
|
Before Width: | Height: | Size: 423 KiB After Width: | Height: | Size: 426 KiB |
|
Before Width: | Height: | Size: 435 KiB After Width: | Height: | Size: 439 KiB |
|
Before Width: | Height: | Size: 400 KiB After Width: | Height: | Size: 402 KiB |
|
Before Width: | Height: | Size: 388 KiB After Width: | Height: | Size: 392 KiB |
|
Before Width: | Height: | Size: 401 KiB After Width: | Height: | Size: 404 KiB |
|
Before Width: | Height: | Size: 398 KiB After Width: | Height: | Size: 400 KiB |
|
Before Width: | Height: | Size: 388 KiB After Width: | Height: | Size: 388 KiB |
|
Before Width: | Height: | Size: 400 KiB After Width: | Height: | Size: 401 KiB |
@@ -19,6 +19,7 @@ void main() {
|
|||||||
spec: '500ml*6/件',
|
spec: '500ml*6/件',
|
||||||
qty: '2',
|
qty: '2',
|
||||||
price: '¥400.00',
|
price: '¥400.00',
|
||||||
|
amount: '¥800.00',
|
||||||
cost: '¥355.00',
|
cost: '¥355.00',
|
||||||
profit: '¥90.00',
|
profit: '¥90.00',
|
||||||
);
|
);
|
||||||
@@ -47,6 +48,8 @@ void main() {
|
|||||||
)));
|
)));
|
||||||
expect(find.text('成本价'), findsOneWidget);
|
expect(find.text('成本价'), findsOneWidget);
|
||||||
expect(find.text('售价'), findsOneWidget);
|
expect(find.text('售价'), findsOneWidget);
|
||||||
|
expect(find.text('总售价'), findsOneWidget);
|
||||||
|
expect(find.text('¥800.00'), findsNWidgets(2)); // 行总售价 + 合计金额
|
||||||
expect(find.text('利润'), findsOneWidget);
|
expect(find.text('利润'), findsOneWidget);
|
||||||
expect(find.text('¥355.00'), findsOneWidget);
|
expect(find.text('¥355.00'), findsOneWidget);
|
||||||
expect(find.text('¥90.00'), findsNWidgets(2)); // 行利润 + 合计利润
|
expect(find.text('¥90.00'), findsNWidgets(2)); // 行利润 + 合计利润
|
||||||
|
|||||||