c1ed81dfab
后端 - 新增 shop handler:GET/PUT /shop/info(管理员权限) - 新增 finance CloseByRef:按单据 ref_type+ref_id 结清账款 - 新增 inventory UpdateRemark:PUT /inventory/:id/remark - 入库/出库审批自动生成财务应付/应收记录(去除金额>0限制) - 种子数据 S001-S003 补充真实门店信息 前端 - 设置页新增「酒行信息」Tab,管理员可编辑门店名称/地址/电话/负责人 - 入库单列表新增结清按钮(含确认弹窗),出库单同步 - 入库表单:规格、系列、生产日期、供应商、商品名称改为提交必填 - 入库/出库列表新增入库时间、出库时间、创建时间列 - 商品标签标题改为读取 shop 表门店名,扫码文案改为「扫码溯源 · TRACE」 - 标签页脚显示门店地址和电话(从 API 读取,不再依赖编译时 dart-define) - 库存备注支持点击编辑,超4字截断显示+Hover展示全文 - ApiClient 新增 patch() 方法(已改用 PUT 规避 CORS) 文档 - 新增 docs/user-manual.md 完整用户操作手册(12章) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
123 lines
3.6 KiB
Dart
123 lines
3.6 KiB
Dart
import '../core/utils/dialog_util.dart';
|
|
import 'package:flutter/material.dart';
|
|
import '../core/theme/app_theme.dart';
|
|
|
|
/// Generic dialog wrapper for forms
|
|
class FormDialog extends StatelessWidget {
|
|
final String title;
|
|
final Widget content;
|
|
final String confirmLabel;
|
|
final VoidCallback? onConfirm;
|
|
final bool loading;
|
|
final double width;
|
|
|
|
const FormDialog({
|
|
super.key,
|
|
required this.title,
|
|
required this.content,
|
|
this.confirmLabel = '保存',
|
|
this.onConfirm,
|
|
this.loading = false,
|
|
this.width = 560,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Dialog(
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4)),
|
|
child: SizedBox(
|
|
width: width,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// Title bar
|
|
Container(
|
|
height: 48,
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
decoration: const BoxDecoration(
|
|
color: AppTheme.primary,
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(4),
|
|
topRight: Radius.circular(4),
|
|
),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Text(
|
|
title,
|
|
style: const TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 15,
|
|
fontWeight: FontWeight.w500),
|
|
),
|
|
const Spacer(),
|
|
IconButton(
|
|
icon: const Icon(Icons.close, color: Colors.white, size: 18),
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
padding: EdgeInsets.zero,
|
|
constraints: const BoxConstraints(minWidth: 28, minHeight: 28),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
// Content
|
|
Flexible(
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.all(20),
|
|
child: content,
|
|
),
|
|
),
|
|
// Action bar
|
|
const Divider(height: 1),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
OutlinedButton(
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
child: const Text('取消'),
|
|
),
|
|
const SizedBox(width: 12),
|
|
ElevatedButton(
|
|
onPressed: loading ? null : onConfirm,
|
|
child: loading
|
|
? const SizedBox(
|
|
width: 16,
|
|
height: 16,
|
|
child: CircularProgressIndicator(
|
|
strokeWidth: 2, color: Colors.white))
|
|
: Text(confirmLabel),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Show a form dialog and return the result
|
|
Future<T?> showFormDialog<T>({
|
|
required BuildContext context,
|
|
required String title,
|
|
required Widget content,
|
|
String confirmLabel = '保存',
|
|
VoidCallback? onConfirm,
|
|
double width = 560,
|
|
}) {
|
|
return showDialog<T>(
|
|
context: context,
|
|
builder: (_) => FormDialog(
|
|
title: title,
|
|
content: content,
|
|
confirmLabel: confirmLabel,
|
|
onConfirm: onConfirm,
|
|
width: width,
|
|
),
|
|
);
|
|
}
|