2bf5b98ba2
- 出入库列表加草稿 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
78 lines
2.6 KiB
Dart
78 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:jiu_client/core/theme/themes.dart';
|
|
import 'package:jiu_client/widgets/order_detail_drawer.dart';
|
|
|
|
/// 2026-07 定价重设计:出库详情按角色两种形态——
|
|
/// 管理员(行带 cost/profit)= 成本价/售价/利润 三数值列 + 合计利润;
|
|
/// operator(不带)= 售价/小计两列,无成本无利润。
|
|
void main() {
|
|
Widget host(OrderDetailDrawer drawer) => MaterialApp(
|
|
theme: buildTheme('a'),
|
|
home: Scaffold(body: drawer),
|
|
);
|
|
|
|
const line6 = OrderLine(
|
|
name: '汾酒青花20年',
|
|
code: 'ZXZ027232',
|
|
series: '普通/53度',
|
|
spec: '500ml*6/件',
|
|
qty: '2',
|
|
price: '¥400.00',
|
|
amount: '¥800.00',
|
|
cost: '¥355.00',
|
|
profit: '¥90.00',
|
|
);
|
|
|
|
const line4 = OrderLine(
|
|
name: '汾酒青花20年',
|
|
code: 'ZXZ027232',
|
|
series: '普通/53度',
|
|
spec: '500ml*6/件',
|
|
qty: '2',
|
|
price: '¥400.00',
|
|
amount: '¥800.00',
|
|
);
|
|
|
|
testWidgets('管理员形态:成本价/售价/利润列 + 合计利润', (tester) async {
|
|
await tester.pumpWidget(host(OrderDetailDrawer(
|
|
title: 'CK001',
|
|
infoRows: const [],
|
|
linesLabel: '出库明细',
|
|
lines: const [line6],
|
|
totalText: '¥800.00',
|
|
profitText: '¥90.00',
|
|
priceLabel: '售价',
|
|
amountLabel: '小计',
|
|
actionGroups: const [],
|
|
)));
|
|
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('¥355.00'), findsOneWidget);
|
|
expect(find.text('¥90.00'), findsNWidgets(2)); // 行利润 + 合计利润
|
|
expect(find.text('合计利润 '), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('operator 形态:售价/小计,无成本无利润', (tester) async {
|
|
await tester.pumpWidget(host(OrderDetailDrawer(
|
|
title: 'CK001',
|
|
infoRows: const [],
|
|
linesLabel: '出库明细',
|
|
lines: const [line4],
|
|
totalText: '¥800.00',
|
|
priceLabel: '售价',
|
|
amountLabel: '小计',
|
|
actionGroups: const [],
|
|
)));
|
|
expect(find.text('售价'), findsOneWidget);
|
|
expect(find.text('小计'), findsOneWidget);
|
|
expect(find.text('成本价'), findsNothing);
|
|
expect(find.text('利润'), findsNothing);
|
|
expect(find.text('合计利润 '), findsNothing);
|
|
expect(find.text('¥800.00'), findsNWidgets(2)); // 行小计 + 合计金额
|
|
});
|
|
}
|