Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d83f94f24 | |||
| 5861b9210c | |||
| a678c3806e |
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.0.81] - 2026-06-24
|
||||
|
||||
### 改进
|
||||
- 出库 / 入库单详情全屏弹窗只覆盖内容区,不再遮挡左侧菜单栏、顶栏与状态栏。
|
||||
- 出库 / 入库单详情标题栏改为浅色配色(浅蓝底 + 深色文字),观感更清爽。
|
||||
|
||||
## [1.0.80] - 2026-06-24
|
||||
|
||||
### 新功能
|
||||
- 出库单详情新增「售价」与「利润」列,利润 = 售价 − 成本,一眼看清每笔出库的盈亏。
|
||||
|
||||
### 改进
|
||||
- 出库 / 入库单详情改为全屏展示,内容更大更清晰,左上角返回箭头关闭。
|
||||
- 出库单详情自动带出商品的生产日期与批次号(明细未单独填写时回退商品资料),去掉冗余的「数量」列。
|
||||
|
||||
## [1.0.79] - 2026-06-24
|
||||
|
||||
### 改进
|
||||
- 入库单 / 出库单搜索框升级:搜索后关键词以标签形式显示在搜索框内,带一键清除(✕)按钮,输入框自动清空便于继续输入;当前仅支持单个搜索词。
|
||||
|
||||
## [1.0.78] - 2026-06-24
|
||||
|
||||
### 改进
|
||||
|
||||
@@ -61,8 +61,9 @@ class StockOutItem {
|
||||
productSeries: lineOrProduct('series', 'series'),
|
||||
productSpec: lineOrProduct('spec', 'spec'),
|
||||
productUnit: (json['product'] as Map<String, dynamic>?)?['unit'] as String?,
|
||||
batchNo: json['batch_no'] as String?,
|
||||
productionDate: json['production_date'] as String?,
|
||||
// 批次号/生产日期:优先明细行快照,回退 product 关联(App 新建单据快照列常为空)
|
||||
batchNo: lineOrProduct('batch_no', 'batch_no'),
|
||||
productionDate: lineOrProduct('production_date', 'production_date'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,8 @@ class StockInListNotifier extends AsyncNotifier<PageResult<StockInOrder>> {
|
||||
/// 当前服务端状态过滤值(供页面进入时对齐标签/下拉,避免重复拉取)
|
||||
String get currentStatus => _status;
|
||||
|
||||
String get currentKeyword => _keyword;
|
||||
|
||||
void setStatus(String status) {
|
||||
_status = status;
|
||||
_page = 1;
|
||||
|
||||
@@ -71,6 +71,8 @@ class StockOutListNotifier extends AsyncNotifier<PageResult<StockOutOrder>> {
|
||||
/// 当前服务端状态过滤值(供页面进入时对齐标签/下拉,避免重复拉取)
|
||||
String get currentStatus => _status;
|
||||
|
||||
String get currentKeyword => _keyword;
|
||||
|
||||
void setStatus(String status) {
|
||||
_status = status;
|
||||
_page = 1;
|
||||
|
||||
@@ -17,6 +17,7 @@ import '../../widgets/multi_select_dropdown.dart' show ColDef, ColumnToggleButto
|
||||
import '../../core/storage/column_prefs.dart';
|
||||
import '../../widgets/page_scaffold.dart';
|
||||
import '../../widgets/status_badge.dart';
|
||||
import '../../widgets/search_chip.dart';
|
||||
import '../../core/utils/export_util.dart';
|
||||
import '../../providers/inventory_provider.dart';
|
||||
import '../../providers/tab_state_provider.dart';
|
||||
@@ -44,6 +45,7 @@ class _StockInListScreenState extends ConsumerState<StockInListScreen> {
|
||||
Set<String> _filterSupplier = {};
|
||||
Set<String>? _hiddenCols; // null = 尚未载入本地存档(回退到 minWidth 首次默认)
|
||||
final _searchCtrl = TextEditingController();
|
||||
String _appliedKw = ''; // 已生效的搜索词(框内 chip 标签展示)
|
||||
|
||||
static const _screenId = 'stock_in_list';
|
||||
|
||||
@@ -72,6 +74,10 @@ class _StockInListScreenState extends ConsumerState<StockInListScreen> {
|
||||
final want = tab == 1 ? 'pending,draft' : _statusFilter;
|
||||
final notifier = ref.read(stockInListProvider.notifier);
|
||||
if (notifier.currentStatus != want) notifier.setStatus(want);
|
||||
// 同步已生效的搜索词到框内 chip(provider 持久化,切走再回来不丢)
|
||||
if (notifier.currentKeyword != _appliedKw) {
|
||||
setState(() => _appliedKw = notifier.currentKeyword);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -81,8 +87,19 @@ class _StockInListScreenState extends ConsumerState<StockInListScreen> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _triggerSearch() =>
|
||||
ref.read(stockInListProvider.notifier).setKeyword(_searchCtrl.text.trim());
|
||||
void _triggerSearch() {
|
||||
final kw = _searchCtrl.text.trim();
|
||||
ref.read(stockInListProvider.notifier).setKeyword(kw);
|
||||
// 仅支持单个搜索词:生效后输入框清空,搜索词转为框内 chip 标签
|
||||
setState(() => _appliedKw = kw);
|
||||
if (kw.isNotEmpty) _searchCtrl.clear();
|
||||
}
|
||||
|
||||
void _clearSearch() {
|
||||
_searchCtrl.clear();
|
||||
setState(() => _appliedKw = '');
|
||||
ref.read(stockInListProvider.notifier).setKeyword('');
|
||||
}
|
||||
|
||||
String? get _startDate => _dateRange != null
|
||||
? '${_dateRange!.start.year}-${_dateRange!.start.month.toString().padLeft(2, '0')}-${_dateRange!.start.day.toString().padLeft(2, '0')}'
|
||||
@@ -363,12 +380,29 @@ class _StockInListScreenState extends ConsumerState<StockInListScreen> {
|
||||
)
|
||||
: null;
|
||||
|
||||
final hasKw = _appliedKw.isNotEmpty;
|
||||
final searchField = TextField(
|
||||
controller: _searchCtrl,
|
||||
decoration: InputDecoration(
|
||||
hintText: '单号/往来单位/酒名,回车搜索',
|
||||
prefixIcon: const Icon(Icons.search, size: 16),
|
||||
hintText: hasKw ? '继续输入新关键词…' : '单号/往来单位/酒名,回车搜索',
|
||||
hintStyle: const TextStyle(fontSize: 12),
|
||||
// 搜索图标 +(已生效时)框内 chip 标签,仅一个词;✕ 删除即清除搜索。
|
||||
// 用 prefixIcon 而非 prefix:后者仅在聚焦/有文字时才显示,搜索后输入框为空会被隐藏。
|
||||
prefixIconConstraints:
|
||||
const BoxConstraints(minWidth: 0, minHeight: 0),
|
||||
prefixIcon: Padding(
|
||||
padding: const EdgeInsets.only(left: 8, right: 6),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.search, size: 16),
|
||||
if (hasKw) ...[
|
||||
const SizedBox(width: 6),
|
||||
SearchChip(label: _appliedKw, onDeleted: _clearSearch),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
suffixIcon: IconButton(
|
||||
icon: const Icon(Icons.search, size: 16),
|
||||
tooltip: '搜索',
|
||||
@@ -573,6 +607,8 @@ class _StockInListScreenState extends ConsumerState<StockInListScreen> {
|
||||
Future<void> _showDetail(BuildContext context, int orderId) async {
|
||||
showAppDialog(
|
||||
context: context,
|
||||
// 用分支 Navigator 承载,全屏弹窗只覆盖内容区,不盖住左侧栏/顶栏/状态栏
|
||||
useRootNavigator: false,
|
||||
builder: (ctx) => _StockInDetailDialog(
|
||||
orderId: orderId,
|
||||
repository: ref.read(stockInRepositoryProvider),
|
||||
@@ -1010,40 +1046,36 @@ class _StockInDetailDialogState extends ConsumerState<_StockInDetailDialog> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Dialog(
|
||||
child: Container(
|
||||
width: context.dialogWidth(720),
|
||||
constraints: const BoxConstraints(maxHeight: 600),
|
||||
return Dialog.fullscreen(
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
||||
decoration: const BoxDecoration(
|
||||
color: AppTheme.primary,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(12),
|
||||
topRight: Radius.circular(12),
|
||||
),
|
||||
color: AppTheme.brand50,
|
||||
border: Border(bottom: BorderSide(color: AppTheme.border)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: AppTheme.primaryDark),
|
||||
tooltip: '返回',
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
const Text('入库单详情',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white)),
|
||||
color: AppTheme.primaryDark)),
|
||||
const Spacer(),
|
||||
if (_loadedOrder != null)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.print_outlined, color: Colors.white),
|
||||
icon: const Icon(Icons.print_outlined, color: AppTheme.primaryDark),
|
||||
tooltip: '打印',
|
||||
onPressed: () => safePrint(context, () => printStockInOrder(_loadedOrder!)),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close, color: Colors.white),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -15,6 +15,7 @@ import '../../widgets/multi_select_dropdown.dart' show ColDef, ColumnToggleButto
|
||||
import '../../core/storage/column_prefs.dart';
|
||||
import '../../widgets/page_scaffold.dart';
|
||||
import '../../widgets/status_badge.dart';
|
||||
import '../../widgets/search_chip.dart';
|
||||
import '../../core/utils/export_util.dart';
|
||||
import '../../core/utils/print_util.dart';
|
||||
import '../../providers/inventory_provider.dart';
|
||||
@@ -43,6 +44,7 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
Set<String>? _hiddenCols; // null = 尚未载入本地存档(回退到 minWidth 首次默认)
|
||||
final _searchCtrl = TextEditingController();
|
||||
final _codeSearchCtrl = TextEditingController();
|
||||
String _appliedKw = ''; // 已生效的搜索词(框内 chip 标签展示)
|
||||
|
||||
static const _screenId = 'stock_out_list';
|
||||
|
||||
@@ -59,6 +61,10 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
final want = tab == 1 ? 'pending,draft' : _statusFilter;
|
||||
final notifier = ref.read(stockOutListProvider.notifier);
|
||||
if (notifier.currentStatus != want) notifier.setStatus(want);
|
||||
// 同步已生效的搜索词到框内 chip(provider 持久化,切走再回来不丢)
|
||||
if (notifier.currentKeyword != _appliedKw) {
|
||||
setState(() => _appliedKw = notifier.currentKeyword);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -82,9 +88,19 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _triggerSearch() => ref
|
||||
.read(stockOutListProvider.notifier)
|
||||
.setKeyword(_searchCtrl.text.trim());
|
||||
void _triggerSearch() {
|
||||
final kw = _searchCtrl.text.trim();
|
||||
ref.read(stockOutListProvider.notifier).setKeyword(kw);
|
||||
// 仅支持单个搜索词:生效后输入框清空,搜索词转为框内 chip 标签
|
||||
setState(() => _appliedKw = kw);
|
||||
if (kw.isNotEmpty) _searchCtrl.clear();
|
||||
}
|
||||
|
||||
void _clearSearch() {
|
||||
_searchCtrl.clear();
|
||||
setState(() => _appliedKw = '');
|
||||
ref.read(stockOutListProvider.notifier).setKeyword('');
|
||||
}
|
||||
|
||||
void _triggerCodeSearch() => ref
|
||||
.read(stockOutListProvider.notifier)
|
||||
@@ -375,12 +391,29 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
)
|
||||
: null;
|
||||
|
||||
final hasKw = _appliedKw.isNotEmpty;
|
||||
final searchField = TextField(
|
||||
controller: _searchCtrl,
|
||||
decoration: InputDecoration(
|
||||
hintText: '单号/往来单位/酒名,回车搜索',
|
||||
prefixIcon: const Icon(Icons.search, size: 16),
|
||||
hintText: hasKw ? '继续输入新关键词…' : '单号/往来单位/酒名,回车搜索',
|
||||
hintStyle: const TextStyle(fontSize: 12),
|
||||
// 搜索图标 +(已生效时)框内 chip 标签,仅一个词;✕ 删除即清除搜索。
|
||||
// 用 prefixIcon 而非 prefix:后者仅在聚焦/有文字时才显示,搜索后输入框为空会被隐藏。
|
||||
prefixIconConstraints:
|
||||
const BoxConstraints(minWidth: 0, minHeight: 0),
|
||||
prefixIcon: Padding(
|
||||
padding: const EdgeInsets.only(left: 8, right: 6),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.search, size: 16),
|
||||
if (hasKw) ...[
|
||||
const SizedBox(width: 6),
|
||||
SearchChip(label: _appliedKw, onDeleted: _clearSearch),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
suffixIcon: IconButton(
|
||||
icon: const Icon(Icons.search, size: 16),
|
||||
tooltip: '搜索',
|
||||
@@ -574,6 +607,8 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
Future<void> _showDetail(BuildContext context, int orderId) async {
|
||||
showAppDialog(
|
||||
context: context,
|
||||
// 用分支 Navigator 承载,全屏弹窗只覆盖内容区,不盖住左侧栏/顶栏/状态栏
|
||||
useRootNavigator: false,
|
||||
builder: (ctx) => _StockOutDetailDialog(
|
||||
orderId: orderId,
|
||||
repository: ref.read(stockOutRepositoryProvider),
|
||||
@@ -924,40 +959,36 @@ class _StockOutDetailDialogState extends ConsumerState<_StockOutDetailDialog> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Dialog(
|
||||
child: Container(
|
||||
width: context.dialogWidth(720),
|
||||
constraints: const BoxConstraints(maxHeight: 600),
|
||||
return Dialog.fullscreen(
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
||||
decoration: const BoxDecoration(
|
||||
color: AppTheme.primary,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(12),
|
||||
topRight: Radius.circular(12),
|
||||
),
|
||||
color: AppTheme.brand50,
|
||||
border: Border(bottom: BorderSide(color: AppTheme.border)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: AppTheme.primaryDark),
|
||||
tooltip: '返回',
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
const Text('出库单详情',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white)),
|
||||
color: AppTheme.primaryDark)),
|
||||
const Spacer(),
|
||||
if (_loadedOrder != null)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.print_outlined, color: Colors.white),
|
||||
icon: const Icon(Icons.print_outlined, color: AppTheme.primaryDark),
|
||||
tooltip: '打印',
|
||||
onPressed: () => safePrint(context, () => printStockOutOrder(_loadedOrder!)),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close, color: Colors.white),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -1040,7 +1071,7 @@ class _StockOutDetailDialogState extends ConsumerState<_StockOutDetailDialog> {
|
||||
children: [
|
||||
TableRow(
|
||||
decoration: const BoxDecoration(color: Color(0xFFF0F4FF)),
|
||||
children: ['序号', '商品编码', '名称', '系列', '规格', '生产日期', '批次号', '数量', '单价', '金额']
|
||||
children: ['序号', '商品编码', '名称', '系列', '规格', '生产日期', '批次号', '成本价', '售价', '利润']
|
||||
.map((h) => Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 10),
|
||||
child: Text(h,
|
||||
@@ -1069,9 +1100,9 @@ class _StockOutDetailDialogState extends ConsumerState<_StockOutDetailDialog> {
|
||||
: (item.productionDate ?? '-')),
|
||||
_TableCell(
|
||||
(item.batchNo?.isNotEmpty ?? false) ? item.batchNo! : '-'),
|
||||
_TableCell(item.quantity.toStringAsFixed(3)),
|
||||
_TableCell('¥${item.unitPrice.toStringAsFixed(2)}'),
|
||||
_TableCell('¥${item.totalPrice.toStringAsFixed(2)}'),
|
||||
_TableCell('¥${item.salePrice.toStringAsFixed(2)}'),
|
||||
_TableCell('¥${(item.salePrice - item.unitPrice).toStringAsFixed(2)}'),
|
||||
],
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// 搜索框内嵌的「已生效搜索词」标签:紧凑圆角 chip + ✕ 删除按钮。
|
||||
///
|
||||
/// 用于列表屏搜索框 [InputDecoration.prefix],仅展示单个搜索词;
|
||||
/// 点 ✕ 触发 [onDeleted] 清除搜索。
|
||||
class SearchChip extends StatelessWidget {
|
||||
const SearchChip({super.key, required this.label, required this.onDeleted});
|
||||
|
||||
final String label;
|
||||
final VoidCallback onDeleted;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final bg = theme.colorScheme.primary.withValues(alpha: 0.12);
|
||||
final fg = theme.colorScheme.primary;
|
||||
return Container(
|
||||
padding: const EdgeInsets.only(left: 8, right: 2, top: 2, bottom: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: bg,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 120),
|
||||
child: Text(
|
||||
label,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: fg,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
InkResponse(
|
||||
onTap: onDeleted,
|
||||
radius: 14,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(2),
|
||||
child: Icon(Icons.close, size: 14, color: fg),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user