feat(client): 库存抽屉打印标签 + 修本地构建版本号不对
- 商品编辑抽屉头部「预览」旁加「打印标签」(同入库管理:QR+品牌型号版本+ 门店信息 → LabelPreviewDialog;移动端无打印不渲染) - 修版本号 bug:appVersionProvider/更新检查改为优先 APP_VERSION dart-define (本地与 iOS 手工构建不改 pubspec,PackageInfo 恒为旧值 1.0.52,App 内 显示错且误弹更新横幅);版本比较容忍 -dev/+build 后缀(每段取前导数字) - local_test.sh:版本标记 -dev(如 v1.1.4-dev)明确区分本地包;新增 --ios 模式(开发签名构建 + devicectl 装 USB iPhone),双端同一版本注入链路 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import 'package:image_picker/image_picker.dart';
|
||||
import 'package:lucide_icons_flutter/lucide_icons.dart';
|
||||
|
||||
import '../core/config/app_config.dart';
|
||||
import '../core/utils/dialog_util.dart';
|
||||
import '../core/responsive/responsive.dart';
|
||||
import '../core/theme/app_chrome.g.dart';
|
||||
import '../core/theme/app_dims.g.dart';
|
||||
@@ -20,11 +21,14 @@ import '../models/product.dart';
|
||||
import '../models/product_image.dart';
|
||||
import '../providers/product_option_provider.dart';
|
||||
import '../providers/product_provider.dart';
|
||||
import '../providers/shop_provider.dart' show shopInfoProvider;
|
||||
import 'ds/ds_atoms.dart';
|
||||
import 'ds/grid_combo_cell.dart';
|
||||
import 'ds/m_sheet.dart';
|
||||
import 'searchable_option_field.dart';
|
||||
import 'fullscreen_image_viewer.dart';
|
||||
import '../core/utils/label_data.dart';
|
||||
import 'label_preview_dialog.dart';
|
||||
import 'write_guard.dart';
|
||||
import 'ds/ds_toast.dart';
|
||||
|
||||
@@ -184,6 +188,14 @@ class _ProductEditorDrawerState extends ConsumerState<_ProductEditorDrawer> {
|
||||
onPressed: p == null || p.publicId.isEmpty
|
||||
? null
|
||||
: () => context.push('/product/${p.publicId}')),
|
||||
// 打印标签(同入库管理打印标签;移动端无打印——用户拍板)
|
||||
if (!context.isMobile) ...[
|
||||
const SizedBox(width: 10),
|
||||
DsButton('打印标签',
|
||||
icon: LucideIcons.printer,
|
||||
small: true,
|
||||
onPressed: p == null ? null : () => _printLabel(p)),
|
||||
],
|
||||
const SizedBox(width: 10),
|
||||
InkWell(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
@@ -615,6 +627,31 @@ class _ProductEditorDrawerState extends ConsumerState<_ProductEditorDrawer> {
|
||||
}
|
||||
|
||||
// ── 保存:介绍正文 +(选了的话)介绍库文档 ──
|
||||
/// 打印标签(同入库管理打印标签:QR + 品牌/型号/版本 + 门店信息)。
|
||||
Future<void> _printLabel(Product p) async {
|
||||
final qrBytes =
|
||||
await ref.read(productRepositoryProvider).getQRCodeBytes(p.id);
|
||||
final shopInfo = ref.read(shopInfoProvider).valueOrNull;
|
||||
if (!mounted) return;
|
||||
final label = LabelData(
|
||||
productId: p.id,
|
||||
qrBytes: qrBytes,
|
||||
name: p.name,
|
||||
code: p.code,
|
||||
series: (p.series ?? '').isEmpty ? null : p.series,
|
||||
spec: (p.spec ?? '').isEmpty ? null : p.spec,
|
||||
remark: (p.remark ?? '').isEmpty ? null : p.remark,
|
||||
shopName: shopInfo?.name ?? '',
|
||||
shopAddress: shopInfo?.address ?? '',
|
||||
shopPhone: shopInfo?.phone ?? '',
|
||||
);
|
||||
if (!mounted) return;
|
||||
showAppDialog(
|
||||
context: context,
|
||||
builder: (_) => LabelPreviewDialog(labels: [label]),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _save() async {
|
||||
setState(() => _saving = true);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user