Files
SupplierSystem/docs/design/20260729-order-extra-dish-flag.md
T
Ubuntu deb3e72750
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
chore: 以 AI 生鲜配送系统 当前版本作为 SupplierSystem 起点
来源仓库:jxc/ai-fresh-delivery
来源提交:f0b1a180e2deb7e4673b9d1c8542619f7bc0f73d
快照树:  09f679334ff38f0ff25e907961c94a8223bcaedd(与来源 HEAD 工作树逐字节一致,3801 个文件)

按约定本仓库不带任何历史提交:来源仓库的历史中含真实凭据
(生产 SSH 私钥 deploy/id_rsa_tencent、server/.env、.env.tencent/.env.production/.env.gitea、
deploy/小程序AppSecret.txt,其中 MP_APPSECRET / S3 AccessKey 经哈希比对与线上同值),
整包推送会把这些凭据永久带入本仓库,故只取「当前版本」的单提交快照。
供应商系统后续开发自本提交开始。
2026-10-08 17:35:43 +08:00

65 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 订单加菜标记(明细 + 配送单打印)
日期:2026-07-29
## 目标 / 非目标
**目标**
- 在订单列表编辑订单时,通过「添加」新增的明细写入 **加菜** 标记。
- 订单明细 UI 显示「加菜」标签。
- 打印配送单时,商品名称带「【加菜】」前缀(或同列可见标记)。
- 本期仅本地验证,**不部署生产**。
**非目标**
- 不改录单/小程序首次建单明细(首单商品不加菜)。
- 不强制历史急救补采自动打加菜(历史可空)。
- 不做取消加菜开关(标记只写不改;误加可删行)。
## 方案要点
### 数据
- `order_items.is_extra_dish BOOLEAN NOT NULL DEFAULT false`(各 tenant / template / public)。
- 写入:`syncOrderManageItems` **INSERT** 新行时置 `true`;UPDATE 已有行不改该字段。
- 录单建单路径不写该字段(默认 false)。
### 展示
- Web `OrderDetailItemCard`:`is_extra_dish` 时品名旁橙色「加菜」pill。
- 配送打印:`fetchDeliveryPrintBundle` 选出字段;`DELIVERY_ITEM_COLUMNS` 的 `display_name` / `sku_name` 取值时前缀 `【加菜】`。
- 合单打印:`mergeSkuKey` 含 `is_extra_dish`,避免加菜与普通同 SKU 合并丢标记。
### 本地预览
- `npm run db:migrate` 本地/连库迁移;`dev:all` 验证添加→保存→明细标签→打印预览。
- 不执行 `deploy-*-prod.ps1`。
## 改动面
- `docs/design/20260729-order-extra-dish-flag.md`
- `migrations/20260807_order_items_is_extra_dish.sql`
- `server/src/services/orderManageItemsService.ts`
- `server/src/services/deliveryPrintLineService.ts`
- `src/pages/orders/OrderManagement.tsx`、`OrderDetailItemCard.tsx`
- `src/utils/deliveryNotePrint.ts`、`exportColumnPresets.ts`、`DeliveryNotePrintModal.tsx`
## 验收标准
- [x] 订单详情「添加」保存后,新行 `is_extra_dish=true`,UI 有「加菜」
- [x] 原有明细无标记(默认 false)
- [x] 配送单打印预览商品名含【加菜】(列取值前缀)
- [x] 未部署生产应用(仅本地代码;迁移已对本机 `.env` 指向库执行)
## 验证
- [x] 迁移 `20260807_order_items_is_extra_dish.sql` 已 apply
- [x] INSERT 新明细写 `is_extra_dish=true`;打印线 SELECT 带出字段
- [x] 订单卡 / 配送打印列展示加菜
- 偏差:无
## 风险与回滚
- 仅加可空语义的布尔列;回滚 DROP COLUMN + 还原展示逻辑。