feat: 面单标签设计与仓内操作页优化,接通模板打印链路

完善标签设计器/销售产品模板绑定与打印面单 UX,统一入库出库到仓扫码页布局,并补充库存绑定与相关文档配置。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zzh 2026-07-18 17:49:18 +08:00
parent 7b7ce3dd75
commit c4979a1fb4
44 changed files with 6013 additions and 2327 deletions

View File

@ -208,15 +208,37 @@ OMS 业务表中的 **`CustomerId`** 指向 **`t_customer.Id`**(客户业务
#### 3.1.2 必备字段(所有表)
> **强制**:凡继承 `OmsAuditedAggregateRoot` / Fake `AggregateRoot` 的 OMS 实体表,建表与增量迁移 **必须**包含下表全部字段。漏列会导致 SqlSugar 生成 SQL 时报错,例如:`Unknown column 'ConcurrencyStamp' in 'field list'`。
| 字段名 | 字段类型 | 说明 |
| --- | --- | --- |
| Id | BIGINT | 主键,自增,步长 1 |
| Id | INT / BIGINT | 主键,自增(实现侧多为 `INT` IDENTITY) |
| IsDeleted | TINYINT | 软删除:0-否,1-是,默认 0 |
| **ConcurrencyStamp** | **CHAR(36)** | **并发戳(乐观锁版本)**;来自 Fake `AggregateRoot`,ORM 读写自动带上;更新时校验/轮换,防止并发覆盖写。业务代码一般无需手写。库表默认值用**固定 GUID**(见下),**禁止**迁移脚本写 `DEFAULT (UUID())` |
| CreateUserId | INT | 创建人 |
| CreateTime | DATETIME | 创建时间 |
| UpdateUserId | INT | 更新人 |
| UpdateTime | DATETIME | 更新时间 |
| UpdateUserId | INT | 更新人(可空) |
| UpdateTime | DATETIME | 更新时间(可空) |
**建表 / 迁移检查清单**
1. 新建表:`CREATE TABLE` 必须含 `ConcurrencyStamp CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`(建议放在 `IsDeleted` 之后)。
2. 增量脚本:若实体已有该属性而库表没有,须 `ALTER TABLE ... ADD COLUMN ConcurrencyStamp ...`(可参考 `sql/fix_concurrency_stamp_missing.sql`)。
3. **复制安全(Error/Note 1674)**:`DEFAULT (UUID())` / `UPDATE ... SET x = UUID()` 在 STATEMENT/MIXED binlog 下会被判为 unsafe(主从可能得到不同值)。迁移 DDL **一律用常量默认值**;真实 UUID 由应用插入/更新时写入。若必须用 `UUID()` 回填历史行,会话临时 `SET SESSION binlog_format='ROW'`(需权限)或接受仅在 ROW 复制拓扑执行。
4. 评审:新迁移 PR 对照本节必备字段,禁止再出现「实体有列、库表无列」。
5. 典型报错定位:接口返回 `Unknown column 'ConcurrencyStamp'` → 查 SQL 中的表名 → 对该表补列后重试。
**DDL 示例片段**
```sql
`IsDeleted` TINYINT NOT NULL DEFAULT 0 COMMENT '软删除:0-否,1-是',
-- 禁止:DEFAULT (UUID()) → 复制环境 1674
`ConcurrencyStamp` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000' COMMENT '并发戳',
`CreateUserId` INT NOT NULL DEFAULT 0 COMMENT '创建人',
`CreateTime` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`UpdateUserId` INT NULL COMMENT '更新人',
`UpdateTime` DATETIME NULL COMMENT '更新时间',
```
#### 3.1.3 字段命名规范
| 规范 | 说明 | 示例 |
@ -617,6 +639,67 @@ JWT → mapId(user.userid INT)
| idx_csa_customer | KEY | CustomerId, IsDeleted, Id | 客户列表 |
| idx_csa_customer_default | KEY | CustomerId, IsDefault | 默认地址查询 |
#### 4.2.11 物流单仓储绑定表 `t_order_stock_bind`
> **用途**:客户在「我的订单」对**已创建成功**的物流单(`t_order`)绑定仓储 **包裹行** 或 **库存 SKU**,用于代发出库占用。
> **与店铺 `match-inventory` 区别**:店铺链路是「店铺订单 → 扣库存 → **创建**物流单」;本表是「物流单已存在 → **挂载**包裹/库存」。
> **数量**:绑定数量**不要求**与 `t_order_declaration` 申报件数对齐。
> **冻结**:绑定保存时冻结(`C_inventory` / `C_parcel_item` 的 `FrozenQty`↑、`AvailableQty`↓);确认出库/预报钩子再扣实物 `Qty`/`Quantity` 并释放冻结。
> **迁移脚本**:`sql/migrate_t_order_stock_bind.sql`。
| 字段名 | 字段类型 | 长度 | 主键/外键 | 非空 | 说明 |
| --- | --- | --- | --- | --- | --- |
| Id | INT | - | 主键 | 是 | 自增 |
| OrderId | INT | - | 外键 → `t_order.Id` | 是 | 物流单 |
| CustomerId | INT | - | 外键 → `t_customer.Id` | 是 | 归属客户(隔离键) |
| WarehouseId | INT | - | - | 是 | 仓库;须与订单 `WarehouseId` 一致(订单无仓库时以本字段写入为准) |
| BindType | VARCHAR | 20 | - | 是 | `inventory` / `parcelItem` |
| SkuId | INT | - | - | 否 | 库存必填;包裹行可空(未上架) |
| InventoryId | INT | - | → `C_inventory.Id` | 否 | 指定库位行;空则按 SKU 自动分摊冻结 |
| BinLocationId | INT | - | - | 否 | 库位快照 |
| ParcelId | INT | - | → `C_parcel.Id` | 否 | `BindType=parcelItem` 时必填 |
| ParcelItemId | INT | - | → `C_parcel_item.Id` | 否 | `BindType=parcelItem` 时必填 |
| BindQty | INT | - | - | 是 | 绑定数量,>0 |
| Status | VARCHAR | 20 | - | 是 | `bound` 已冻结 / `deducted` 已扣实物 / `released` 已释放 |
| SkuCode | VARCHAR | 64 | - | 否 | 展示快照 |
| SkuName | VARCHAR | 128 | - | 否 | 展示快照 |
| TrackingNo | VARCHAR | 64 | - | 否 | 包裹运单号快照 |
| ProductName | VARCHAR | 256 | - | 否 | 包裹品名快照 |
| ImageUrl | VARCHAR | 512 | - | 否 | 图片快照 |
| AttributeText | VARCHAR | 256 | - | 否 | 规格快照 |
| Remark | VARCHAR | 512 | - | 否 | 备注 |
| IsDeleted | TINYINT | - | - | 是 | 软删,默认 0 |
| ConcurrencyStamp | CHAR | 36 | - | 是 | 并发戳;见 **§3.1.2**,默认 UUID |
| CreateUserId | INT | - | - | 是 | 创建人 |
| CreateTime | DATETIME | - | - | 是 | 创建时间 |
| UpdateUserId | INT | - | - | 否 | 更新人 |
| UpdateTime | DATETIME | - | - | 否 | 更新时间 |
**索引**
| 索引名 | 类型 | 字段 | 说明 |
| --- | --- | --- | --- |
| idx_osb_order | KEY | OrderId, IsDeleted, Status | 订单绑定明细 |
| idx_osb_parcel_item | KEY | ParcelItemId, Status, IsDeleted | 包裹行占用汇总 |
| idx_osb_sku | KEY | CustomerId, WarehouseId, SkuId, Status | 库存占用查询 |
**仓储表字段增量(同迁移脚本)**
| 表 | 新增字段 | 说明 |
| --- | --- | --- |
| `C_inventory` | `FrozenQty` INT NOT NULL DEFAULT 0 | 已绑定未出库冻结量 |
| `C_inventory` | `AvailableQty` INT NOT NULL DEFAULT 0 | 可用 = `Qty - FrozenQty`(应用层维护) |
| `C_parcel_item` | `FrozenQty` INT NOT NULL DEFAULT 0 | 已被物流单占用数量 |
| `C_parcel_item` | `AvailableQty` INT NOT NULL DEFAULT 0 | 可用 = `Quantity - FrozenQty`(应用层维护) |
**不变量**
1. `AvailableQty = Qty(或 Quantity) - FrozenQty`,且三者均 ≥ 0。
2. 绑定保存:校验 `BindQty ≤ AvailableQty`(对本单原占用先释放再算)。
3. 包裹 Tab **允许全部生命周期**(`inTransit` / `arrived` / `stored`)。
4. 已上架包裹行(有 `SkuId`)绑定包裹时**同时**冻结对应库存,避免重复售卖。
5. 保存采用**全量覆盖**:提交 `items[]` 为最终态。
### 4.3 下单计费与版本策略(配置 → 运行时 → 下单)
> 本节约定**销售产品**维度的规则/卖价如何进入线上算价链路,以及与 `t_order` 版本字段的对应关系;与渠道模块中「运营发布 → 生成版本」接口衔接。
@ -2563,6 +2646,141 @@ t_order(OrderSource=pickup, PickupTime, CustomerSenderAddressId)
| 权限 | `Order.SenderAddress.Query` / `.Create` / `.Update` / `.Delete` |
| 联动 | 揽收创建页下拉刷新本列表;删除已占用地址 **允许**(订单已快照) |
#### 4.4.6 物流单绑定包裹/库存(我的订单)
> **入口**:我的订单 → 选中一单 →「绑定包裹/库存」弹窗(左:包裹/库存 Tab;右:已选明细,可调数量)。
> **权限**:`Order.MyOrders.StockBind`。
> **实现状态**:设计落地中(oms0414-back `OrderService.StockBind` + 前端 `StockBindModal`)。
##### 4.4.6.1 接口清单
| 接口名称 | 请求方式 | 请求路径 | 说明 |
| --- | --- | --- | --- |
| 当前绑定 | GET | /order/stock-bind/detail | `orderId`;右侧已选 |
| 库存候选 | POST | /order/stock-bind/inventory-candidates | 左侧库存 Tab |
| 包裹候选 | POST | /order/stock-bind/parcel-candidates | 左侧包裹 Tab(**全部生命周期**) |
| 保存绑定 | POST | /order/stock-bind/save | 全量覆盖;冻结 |
| 清空绑定 | POST | /order/stock-bind/clear | 释放全部 `bound` |
| 确认扣减 | POST | /order/stock-bind/confirm-deduct | 扣实物并 `deducted`;可由预报/出库钩子调用 |
##### 4.4.6.2 当前绑定(GET /order/stock-bind/detail)
**请求**:`orderId`(必填)。
**响应**
```json
{
"orderId": 1001,
"warehouseId": 3,
"warehouseName": "华南仓",
"bindStatus": "bound",
"items": [
{
"id": 11,
"bindType": "inventory",
"skuId": 88,
"skuCode": "SKU-A",
"skuName": "T恤",
"inventoryId": null,
"binLocationId": 5,
"binCode": "A-01",
"bindQty": 2,
"availableQty": 10,
"imageUrl": null,
"status": "bound"
},
{
"id": 12,
"bindType": "parcelItem",
"parcelId": 50,
"parcelItemId": 501,
"trackingNo": "YT123",
"productName": "配件",
"attributeText": "红/L",
"skuId": 88,
"skuCode": "SKU-A",
"bindQty": 1,
"availableQty": 3,
"imageUrl": "",
"status": "bound"
}
]
}
```
`bindStatus`:`none` / `bound` / `deducted`(存在任意 `deducted` 优先;否则有 `bound` 为 `bound`)。
##### 4.4.6.3 库存候选(POST /order/stock-bind/inventory-candidates)
```json
{
"orderId": 1001,
"warehouseId": 3,
"keyword": "",
"page": 1,
"pageSize": 30
}
```
- 默认仓库:入参 `warehouseId` 优先,否则取订单 `WarehouseId`。
- 仅返回 `AvailableQty > 0` 的 SKU 汇总。
- 响应:`total` + `items[]`:`skuId`, `skuCode`, `skuName`, `skuImageUrl`, `warehouseId`, `totalQty`, `frozenQty`, `availableQty`, `binCount`。
##### 4.4.6.4 包裹候选(POST /order/stock-bind/parcel-candidates)
```json
{
"orderId": 1001,
"warehouseId": 3,
"lifecycleStatus": "",
"keyword": "",
"page": 1,
"pageSize": 20
}
```
- `lifecycleStatus` 空或 `all`:全部生命周期均可。
- 包裹下行:`parcelItemId`, `productName`, `attributeText`, `imageUrl`, `skuId`, `skuCode`, `quantity`, `frozenQty`, `availableQty`。
- 仅下行 `availableQty > 0` 的包裹进入列表(包裹头仍可展示)。
##### 4.4.6.5 保存绑定(POST /order/stock-bind/save)
```json
{
"orderId": 1001,
"items": [
{ "bindType": "inventory", "skuId": 88, "bindQty": 2, "inventoryId": null },
{ "bindType": "parcelItem", "parcelId": 50, "parcelItemId": 501, "bindQty": 1 }
]
}
```
**服务端步骤**
1. 校验订单归属;`OrderStatus` 为已删除/已取消则拒绝;若已有 `deducted` 明细则拒绝改绑(须先业务回滚,本期不做回滚接口)。
2. 解析仓库;无仓库且候选依赖仓库时拒绝。
3. 读取现有 `Status=bound` 明细 → 全部释放冻结 → 软删/标 `released`。
4. 按 `items[]` 重新冻结并插入 `bound` 明细(空数组等价清空)。
5. `inventory`:按 `inventoryId` 或 SKU 多库位分摊冻结 `C_inventory`。
6. `parcelItem`:冻结 `C_parcel_item`;若行上已有 `SkuId`,同步按 SKU 冻结库存。
7. **不**校验申报明细数量。
8. 事务提交;响应同 detail。
##### 4.4.6.6 清空 / 确认扣减
- `POST /order/stock-bind/clear`:`{ "orderId" }`,仅释放 `bound`。
- `POST /order/stock-bind/confirm-deduct`:对 `bound` 行:`Qty`/`Quantity` 与 `FrozenQty` 同减 `BindQty`,`AvailableQty` 重算,明细改 `deducted`。
##### 4.4.6.7 前端(itfx-front)
| 项 | 说明 |
| --- | --- |
| 入口 | `/order/myOrders` 工具栏/更多:「绑定包裹/库存」 |
| 组件 | `StockBindModal.vue`:左右两卡片;左 Tab 包裹/库存;右已选 + 数量步进 |
| 权限 | `Order.MyOrders.StockBind` |
| 规范 | `docs/前端页面设计规范.md`;主色 `var(--app-primary-color)` |
## 5 渠道模块
### 5.1 核心需求说明

View File

@ -0,0 +1,626 @@
# OMS 面单标签模板设计与 PDF 生成方案
> **版本**:v0.4(开工核对版)
> **日期**:2026-07-18
> **基线文档**:`docs/oms系统设计-050801.md`(§5.1 标签设计 / §5.2.20 `t_label_template` / §6 操作打印 / §9~10 订单 `labelUrl`)
### 已确认决策
| 项 | 结论 |
| --- | --- |
| 出 PDF 时机 | **异步**(Pending → Ready / Failed) |
| 产品「客户面单」 | **下拉选具体模板**(`LabelTemplateId`),去掉写死「系统面单/客户面单」枚举作为出单依据 |
| 渲染引擎 | **纯 .NET**:`HiprintJson → QuestPDF`;vg-print **只做设计** |
| 默认模板 | 产品未选时回落 **全局默认模板 Id**(配置项) |
| 模板归属(一期) | **仅运营/管理员**设计与维护(客户自助 → 二期) |
| 默认纸张(一期) | **100×150 mm**(模板可改;未填时用此默认) |
### 落地进度(相对本文)
| 模块 | 状态 | 说明 |
| --- | --- | --- |
| 标签设计列表 + 新建弹窗 + 懒加载设计器 | **已做** | `labelDesign`:list/get/save/delete;新建弹窗填名称/类型再进设计 |
| 模板 CRUD API | **已做** | `GET list` / `GET {id}` / `POST save` / `POST delete` |
| Hiprint→QuestPDF 渲染器 | **已做** | Parser/IR/QuestPDF + 样本单测 |
| 异步出 PDF + 订单状态字段 | **已做** | Pending/Ready/Failed;创单投递 `generate-label-pdf` |
| 替换 HTML stub / 批量&仓内打 PDF | **已做** | print / batch / 仓内返回 PDF `printUrl`;无模板时回落 HTML |
| `IsEnabled` / 纸张字段 / enable API | **一期可砍** | 用「有无模板」即可;纸张从 JSON panel 读 |
| 独立 `labelTemplate` 列表页 | **取消** | 已并入 `labelDesign`,勿再建 |
| 设计器字段字典注入 | **已做** | `field-dictionary` + 设计器左侧字段 |
| 销售产品绑 `LabelTemplateId` | **已做** | 下拉接模板列表 |
---
## 0. 一期开工范围(核对无遗漏后按此做)
### 0.1 必须做(闭环)
1. **导出真实 TemplateJson 样本** + 单位校准单测(pt/mm)。
2. **`ILabelPdfRenderer`**:Parser → IR → QuestPDF;一期元素:text / barcode / qrcode / longText / hline / vline / rect / image。
3. **`LabelPrintDataBuilder`**:订单 → PrintData(附录 B 字段)。
4. **订单字段**:`LabelUrl`(复用/确认)、`LabelTemplateId`、`LabelGenerateStatus`、`LabelGenerateError`;SQL 迁移。
5. **异步任务** `generateLabelPdf`(复用现有批量队列机制)。
6. **创单投递任务**;`POST /order/print`、`batch/print` 返回 PDF `printUrl`;Pending/Failed 前端提示。
7. **销售产品**:`LabelTemplateId` + 下拉接 `label-template/list`;废弃枚举出单逻辑。
8. **全局默认模板配置**(配置表或 appsettings 键均可,先简单)。
9. **设计器字段字典**:`GET field-dictionary` + vg-print 左侧可拖字段(至少单号/收件/重量常用组)。
10. **仓内 print-label**:返回 `printUrl`;模板下拉改真实列表(可选覆盖)。
### 0.2 一期明确不做(避免范围膨胀)
- Playwright / 浏览器渲染
- table / html 元素、页眉页脚高级规则
- 模板启停 API、预览图、客户自助设计
- PDF 合并下载、地址变更自动 stale(二期)
- 平台店铺 ShippingLabelUrl
### 0.3 建议实施顺序
```text
① JSON 样本 + Renderer 单测
② PrintDataBuilder + preview-pdf(管理端验收版式)
③ 订单字段迁移 + 异步 generateLabelPdf + 创单挂钩
④ 销售产品 LabelTemplateId 下拉
⑤ 设计器字段字典
⑥ order/print + batch/print + 仓内 printUrl
```
---
## 1. 背景与目标
### 1.1 要解决的问题
1. **标签样式不可配置**:订单创建后的「面单」目前是固定 HTML stub,无法按客户/产品定制版式。
2. **设计器与打印链路断开**:`vg-print` 已能设计并保存 `TemplateJson`,但创建订单、单票打印、批量打印均未消费该模板。
3. **批量打印需要稳定文件**:仓内/客服批量出单希望拿到 **PDF**(可下载、可静默打印、可归档),而不是临时拼 HTML。
4. **产品「客户面单」未绑模板**:字段名虽叫客户面单,下拉却是写死的「系统面单/客户面单」,与 `t_label_template` 无关。
### 1.2 目标(一期)
| 目标 | 说明 |
| --- | --- |
| 可设计 | vg-print 设计,拖拽绑定订单字段,保存 `TemplateJson` |
| 可保存 | 模板 CRUD(名称、类型;列表浏览/删除)— **已有** |
| 可绑定 | 销售产品「客户面单」改为 **模板下拉**(`LabelTemplateId`) |
| 可出 PDF | 纯 .NET 解析 `TemplateJson` + PrintData → 异步生成 PDF |
| 可批量 | 按 `labelUrl` 批量静默打 / 下载 |
### 1.3 非目标(一期不做)
- 平台店铺面单(Shopee 等)仍走平台 URL。
- 不在服务端跑 Playwright/Chromium。
- 不保证 hiprint 全部高级特性 100% 还原(见 §3.3 支持矩阵);一期覆盖面单常用元素。
- 不做模板审批流 / 模板市场 / 客户自助设计。
---
## 2. 现状结论(Gap)
```mermaid
flowchart LR
A[vg-print 设计器] -->|保存 TemplateJson| B[(t_label_template)]
C[销售产品 CustomerWaybill] -.->|仅枚举字符串| X[未关联模板]
D[创建订单 / 打单] -->|CreateOrderPrintFileAsync| E[极简 HTML]
F[仓内 print-label] -->|只写记录| G[(t_label_print_record)]
H[批量 print] --> E
B -.->|未消费| D
```
| 能力 | 现状 | 缺口 |
| --- | --- | --- |
| 设计器 | 列表+懒加载设计器 **已有**;新建弹窗 **已有** | 字段字典未注入 |
| 模板存储 | `t_label_template` CRUD **已有** | 纸张可读 panel;启停可砍 |
| 产品绑定 | `CustomerWaybill` 写死两枚举 | → `LabelTemplateId` |
| 渲染 | HTML stub | HiprintJson→PDF |
| 仓内打印 | 记日志 | 返回/打开 PDF |
| 批量 | 有框架 | 依赖真实 `labelUrl`(PDF) |
---
## 3. 总体方案
### 3.1 核心思路
把链路拆成四段,职责清晰:
| 阶段 | 做什么 | 产物 |
| --- | --- | --- |
| **① 设计** | vg-print 配置版式,左侧拖订单字段占位符 | `TemplateJson` |
| **② 绑定** | 销售产品「客户面单」下拉选模板 | `SalesProduct.LabelTemplateId` |
| **③ 灌数出 PDF** | 异步:.NET 解析 TemplateJson + PrintData → PDF | `Order.LabelUrl` |
| **④ 打印** | 单票 / 批量 / 仓内,统一打 `labelUrl` | 打印机 / 下载 |
### 3.2 架构(纯 .NET 渲染 + 客户端静默打)
```mermaid
sequenceDiagram
participant Designer as vg-print 设计器
participant API as OMS API (.NET)
participant DB as DB
participant Worker as 异步 Worker
participant FE as 订单/仓内前端
participant Hiprint as 本地 hiprint 客户端
Designer->>API: 保存 TemplateJson
API->>DB: t_label_template
Note over API,DB: 产品「客户面单」下拉存 LabelTemplateId
FE->>API: 创建订单
API->>DB: 落单 + Pending + 投递 generateLabelPdf
Worker->>DB: 读模板 JSON + 组 PrintData
Worker->>Worker: HiprintJsonRenderer → QuestPDF
Worker->>DB: 写 PDF + Ready/labelUrl
FE->>API: 打印(Ready)
API-->>FE: printUrl (PDF)
FE->>Hiprint: 静默打印 PDF
```
- **设计**:继续 vg-print(前端)。
- **出文件**:纯 .NET,**不**起浏览器。
- **送打印机**:前端 hiprint 客户端打已生成的 PDF(与现网批量打印一致)。
### 3.3 纯 .NET 如何「转化使用」vg-print 保存的 JSON(已确认)
#### 3.3.1 思路
vg-print / hiprint 的 `TemplateJson` 本质是 **声明式版式**:纸张尺寸 + 绝对定位元素列表(文本/条码/线/图/表…)。
我们不在服务端执行 JS,而是:
1. **反序列化** JSON → C# 模型(`HiprintTemplate` / `HiprintPanel` / `HiprintElement`)
2. **灌数**:按 `options.field` 从 `PrintData` 取值(无 field 则用 `title` 静态文案)
3. **绘制**:用 **QuestPDF**(或 PdfSharp)按 left/top/width/height 绝对定位画到页面
4. **条码/二维码**:`options.textType = barcode | qrcode` 时用 **ZXing.Net** 生成图片再嵌入
```text
TemplateJson (hiprint)
│
▼
HiprintTemplateParser ← 只认我们支持的元素子集
│
▼
Intermediate IR ← 统一:PageSize + List<DrawOp>
│
▼
QuestPdfEmitter ← 输出 PDF bytes
```
中间 IR 的好处:以后若换 PdfSharp,只换 Emitter;Parser 不动。
#### 3.3.2 JSON 结构(需解析的关键部分)
典型形态(示意):
```json
{
"panels": [
{
"index": 0,
"width": 100,
"height": 150,
"printElements": [
{
"printElementType": { "type": "text" },
"options": {
"left": 20, "top": 30, "width": 120, "height": 20,
"field": "serviceNo",
"title": "运单号",
"fontSize": 12,
"fontWeight": "bold",
"textAlign": "left",
"textType": "text"
}
},
{
"printElementType": { "type": "text" },
"options": {
"left": 20, "top": 60, "width": 160, "height": 40,
"field": "serviceNo",
"textType": "barcode"
}
}
]
}
]
}
```
坐标约定(实现时用真实样本校准一次):
| 项 | hiprint 常见单位 | .NET 处理 |
| --- | --- | --- |
| 纸张 width/height | **mm** | QuestPDF `PageSizes` / 自定义 mm |
| 元素 left/top/width/height | **pt**(1 inch = 72 pt) | 换算:`pt → mm = pt * 25.4 / 72` |
| fontSize | pt | 直接用 |
> 落地第一步:从设计器导出 1~2 份真实 JSON 做单元测试,校准单位(不同 vg-print 版本偶有差异)。
#### 3.3.3 元素支持矩阵(一期 / 二期)
| 元素 type / textType | 一期 | 实现要点 |
| --- | --- | --- |
| text(普通文本) | ✅ | 灌 field;字体/对齐/颜色/粗体 |
| text + barcode | ✅ | ZXing Code128(可配置) |
| text + qrcode | ✅ | ZXing QR |
| longText | ✅ | 多行换行、超出裁剪或缩小 |
| hline / vline | ✅ | 线宽、颜色 |
| rect | ✅ | 边框/填充(简化) |
| image | ✅ | 静态图 URL/相对路径;或 field 指向图片地址 |
| table | 二期 | 按 columns + items[] 画表;一期可用「多行 text」凑合 |
| html | ❌ 一期跳过 | 设计规范禁止用自定义 HTML 做面单关键信息 |
| 页眉页脚/页码高级规则 | 二期 | 面单多为单页,一期可忽略 |
**设计规范(避免踩坑)**:面单模板只用支持矩阵内的控件;保存模板时可做服务端校验,遇到不支持类型给出警告。
#### 3.3.4 关键代码落点(建议)
| 组件 | 位置(建议) |
| --- | --- |
| `HiprintTemplateDocument` 等模型 | `Oms.Application/Labeling/Hiprint/` |
| `HiprintTemplateParser` | 同上 |
| `ILabelPdfRenderer` / `QuestPdfLabelRenderer` | 同上 |
| `LabelPrintDataBuilder` | 订单 → PrintData 字典 |
| `GenerateLabelPdfJobHandler` | 异步队列 Worker |
| NuGet | `QuestPDF`、`ZXing.Net`(及 ImageSharp 如需) |
接口形态:
```csharp
public interface ILabelPdfRenderer
{
Task<byte[]> RenderAsync(string templateJson, IReadOnlyDictionary<string, object?> printData, CancellationToken ct = default);
}
```
#### 3.3.5 与「设计预览」的对齐策略
| 手段 | 说明 |
| --- | --- |
| 设计器预览 | 仍用 vg-print 前端预览(设计时) |
| 服务端预览 API | `POST .../preview-pdf` 走同一套 `ILabelPdfRenderer`,给产品配置/验收用 |
| 回归用例 | 固定 TemplateJson + PrintData → 对比 PDF 哈希或关键区域截图 |
预期:**常用面单元素**视觉接近;像素级与浏览器 hiprint 不完全一致(字体 hinting 等),以「可扫码、信息齐全、布局不错位」为验收标准。
#### 3.3.6 为何仍划算(相对 Playwright)
- 无 Chromium 运维,部署与现有 API 一致。
- 异步高峰更可控(线程池而非浏览器池)。
- 设计器继续复用,**不是**推倒重做;成本在「解析器 + 支持矩阵」,可控且可测。
### 3.4 异步出 PDF(已确认)
创单:落单 → 解析产品 `LabelTemplateId`(空则全局默认)→ `LabelGenerateStatus=Pending` → 投递 `generateLabelPdf` → 立即返回。
Worker:`PrintData` → `ILabelPdfRenderer` → 落盘 → `Ready` / `Failed`。
打印:Ready 用 `labelUrl`;Pending 提示生成中或短等补生成;Failed 可「重新生成」。
### 3.5 产品「客户面单」字段改造(已确认)
**现状**:`customerWaybillOptions` 写死:
```ts
{ label: '系统面单', value: '系统面单' },
{ label: '客户面单', value: '客户面单' },
```
与模板库无关,不能表达「用哪张版式」。
**改造**:
| 项 | 做法 |
| --- | --- |
| UI | 「客户面单」下拉改为拉 `GET /channel/label-template/list`(启用中的模板),展示 `Name` |
| 存储 | 新增/使用 `LabelTemplateId`(long,可空) |
| 旧字段 `CustomerWaybill` | 迁移期可废弃写入,或仅作展示兼容;**出 PDF 只认 LabelTemplateId** |
| 未选模板 | 使用系统配置的 **全局默认模板 Id**;若默认也没有 → 异步任务 Failed,并提示去配置 |
仓内打印页的模板下拉同理:不要写死 `lastMile/customer/...` 类型枚举当「模板」,应拉真实模板列表(类型可作筛选)。
平台店铺面单 URL 仍独立,不进该下拉。
## 4. 领域模型
### 4.1 模板 `t_label_template`
| 字段 | 一期 | 说明 |
| --- | --- | --- |
| Id / Name / TemplateType / TemplateJson | ✅ 已有 | CRUD 已通 |
| PaperWidthMm / PaperHeightMm | 可选 | **优先从 TemplateJson.panels[0] 读**;缺省 100×150 |
| IsEnabled / PreviewImageUrl / Remark | 二期 | 一期不做启停 |
### 4.2 销售产品绑定
| 字段 | 说明 |
| --- | --- |
| LabelTemplateId | **主字段**:客户面单下拉选中的模板 Id |
| CustomerWaybill | 旧枚举;迁移后停止作为出单依据(可留列不清) |
解析:`产品.LabelTemplateId` → 否则 → `全局默认模板Id` → 否则 Failed。
### 4.3 订单侧产物
| 字段 | 说明 |
| --- | --- |
| `LabelUrl` | PDF 路径(替换 HTML stub) |
| `LabelTemplateId` | 实际模板 Id |
| `LabelGenerateStatus` | `Pending` / `Ready` / `Failed` |
| `LabelGenerateError` | 失败原因 |
| PrintData 快照 | 建议一期就落 json 列或扩展表,便于重打 |
### 4.4 仓内打印记录
- `print-label/print` 返回 `printUrl`;可选写 `PrintFileUrl` 到记录表。
### 设计页交互(已落地)
- 默认列表;新建弹窗(名称+类型)→ 懒加载设计器;返回卸载。
- API:list / get / save / delete。
- **待补**:字段字典注入。
---
## 5. 字段字典(设计器左侧可拖字段)
设计器不应让业务人员手写字段名。一期提供 **标准 PrintData Schema**,前端注入 vg-print 的元素/字段面板。
### 5.1 命名约定
- 全部 **camelCase**,与前端/hiprint `print(data)` 一致。
- 地址类同时提供分行字段与 `recipientAddressFull`。
### 5.2 字段分组(初稿)
#### A. 单号
| 字段 | 说明 |
| --- | --- |
| serviceNo | 运单号 / 服务商单号 |
| clientNo | 客户单号 |
| trackNo | 跟踪号 |
| otherNo | 其他单号(若有) |
| requestId | 请求号 |
#### B. 产品 / 渠道 / 仓库
| 字段 | 说明 |
| --- | --- |
| productCode | 销售产品编码 |
| salesProductName | 销售产品名称 |
| channelCode | 渠道编码 |
| channelName | 渠道名称 |
| warehouseName | 仓库名称 |
| customerCode / customerName | 客户(管理端场景) |
#### C. 收件人
| 字段 | 说明 |
| --- | --- |
| recipientName | 姓名 |
| recipientCompany | 公司 |
| recipientPhone | 电话 |
| recipientEmail | 邮箱 |
| recipientZip | 邮编 |
| recipientCountry / recipientCountryName | 国家 |
| recipientProvince / City / Street1/2/3 | 省市区街道 |
| recipientAddressFull | 拼接地址 |
| recipientTaxNo / vatNo / eori | 税号类 |
#### D. 发件人
对称字段:`senderName`、`senderCompany`、`senderPhone`、`senderAddressFull` …
#### E. 重量尺寸
| 字段 | 说明 |
| --- | --- |
| actualWeight | 实重 |
| volumetricWeight | 体积重 |
| chargeableWeight | 计费重 |
| length / width / height | 长宽高 |
| weightUnit | 默认 KG |
| dimUnit | 默认 CM |
#### F. 货品明细(表格 — 二期)
```json
"items": [
{ "skuCode": "", "skuName": "", "qty": 1, "weight": 0.1, "declareNameEn": "", "declareValue": 0 }
]
```
一期可用多个 text 字段代替。
#### G. 系统
| 字段 | 说明 |
| --- | --- |
| printTime | 出 PDF 时间 |
| operatorName | 操作人(仓内打印时) |
### 5.3 设计器待补
1. `GET /channel/label-template/field-dictionary`
2. 注入 vg-print provider / 可拖字段分组
3. 预览可用 Mock PrintData
(列表/新建弹窗/保存/删除已完成,勿重复建设独立列表页。)
---
## 6. 关键业务流程
### 6.1 设计与发布
1. 运营「标签设计」→ 新建弹窗 / 设计 → 拖字段 → 预览 → 保存。
2. 销售产品「客户面单」下拉选模板(`LabelTemplateId`)。
3. 配置全局默认模板(产品未选时回落)。
### 6.2 创建订单 → 生成 PDF
| 触发 | 建议 |
| --- | --- |
| 订单创建成功 | **主路径**:异步 `generateLabelPdf` |
| 预报/生成包裹 | 地址重量补全后可 **重生** |
| 地址变更 | 二期:`labelStale` |
```
resolveTemplate(product) → buildPrintData(order) → renderPdf
→ /uploads/prints/orders/xxx.pdf → labelUrl + Ready
```
### 6.3 单票 / 批量打印
- 单票 / 批量:返回 PDF `printUrl`;Pending 提示生成中;Failed 可重生。
- 合并下载 → 二期。
### 6.4 仓内「打印标签」
1. lookup(已有)→ 确认打印。
2. 优先订单 `labelUrl`;无则现场生成。
3. 返回 `printUrl`;模板下拉接真实列表。
---
## 7. API 设计(增量)
### 7.1 模板
| 方法 | 路径 | 一期 |
| --- | --- | --- |
| POST save | `/channel/label-template/save` | ✅ |
| GET list | `/channel/label-template/list` | ✅ |
| GET detail | `/channel/label-template/{id}` | ✅ |
| POST delete | `/channel/label-template/delete` | ✅ |
| GET field-dictionary | `/channel/label-template/field-dictionary` | 待做 |
| POST preview-pdf | `/channel/label-template/preview-pdf` | 待做 |
| POST enable | `/channel/label-template/enable` | 砍掉(二期) |
### 7.2 销售产品
- Save/Detail 增加 `labelTemplateId`;下拉接 list。
### 7.3 订单 / 打印
| 方法 | 说明 |
| --- | --- |
| 创单内部 | 投递 `generateLabelPdf`(非同步堵接口) |
| `POST /order/print` | PDF `printUrl` |
| `POST /order/batch/print` | 每单 PDF url |
| `POST /order/label/regenerate` | 强制重生 |
### 7.4 仓内
| 方法 | 说明 |
| --- | --- |
| `POST /operation/print-label/print` | 返回 `printUrl` |
### 7.5 渲染(进程内)
```csharp
Task<byte[]> RenderAsync(string templateJson, IReadOnlyDictionary<string, object?> printData, CancellationToken ct = default);
```
---
## 8. 前端改造清单
| 页面/模块 | 状态 |
| --- | --- |
| `channel/labelDesign` | ✅ 列表+弹窗+懒加载;⏳ 字段字典 |
| `channel/labelTemplate` 独立页 | ❌ 取消 |
| `channel/salesProducts` | ⏳ 模板下拉 |
| `OrderPrintModal` / 我的订单批量 | ⏳ PDF + Pending 提示 |
| `operation/printLabel` | ⏳ printUrl + 真实模板下拉 |
| 权限文案 | 随菜单既有资源即可 |
---
## 9. 分阶段落地
### 一期(按 §0.3 顺序)
见文首 **§0**。
### 二期
1. table 元素、启停、预览图。
2. 地址变更 stale / 重生;PDF 合并。
3. 客户自助设计;保存时不支持元素强校验。
### 三期(可选)
- 仅当 QuestPDF 还原成本过高时再评估 Playwright 兜底。
---
## 10. 风险与对策
| 风险 | 对策 |
| --- | --- |
| JSON 与 PDF 视觉偏差 | 支持矩阵;preview-pdf;pt/mm 单测 |
| 中文字体 | 服务端嵌入 Noto Sans SC / 雅黑 |
| 创单后立刻打印 | Pending 短等或提示稍后 |
| 旧枚举数据 | 出单只认 LabelTemplateId |
| 批量高峰 | 异步队列限流 |
---
## 11. 验收标准(一期)
1. 设计器模板(文本+条码+线框)经 .NET 出可扫码 PDF。
2. 销售产品下拉为真实模板,存 `LabelTemplateId`。
3. 创单异步后 Ready + `labelUrl` 可打开。
4. 单票/批量/仓内能打该 PDF;Pending 有提示。
5. 无产品模板且无全局默认 → Failed + 明确提示。
---
## 12. 决策状态
| # | 项 | 状态 |
| --- | --- | --- |
| 1 | 渲染:纯 .NET + Hiprint JSON | **已确认** |
| 2 | 出 PDF:异步 | **已确认** |
| 3 | 产品:模板下拉 | **已确认** |
| 4 | 模板归属 | **一期:仅运营**(已拍板默认) |
| 5 | 默认纸张 | **一期:100×150 mm**(已拍板默认) |
**结论:方案可开工。** 无阻塞性遗漏;下一刀从 §0.3 ①「真实 JSON 样本 + Renderer」开始。
---
## 附录 A. 与现有文档章节映射
| 本方案 | 设计总册 |
| --- | --- |
| 设计器 / TemplateJson | §5.1、§5.2.20、§5.3.12 |
| 仓内打印记录 | §6.1、§6.2.3、§6.3.3 |
| 订单 labelUrl / batch print | §4.4.1.8、§9.6.3、§10 |
| 批量异步 | `订单批量处理与异步队列方案0707.md` |
## 附录 B. PrintData 示例(节选)
```json
{
"serviceNo": "S202607180001",
"clientNo": "C-10086",
"trackNo": "YT1234567890",
"salesProductName": "专线-普货",
"warehouseName": "SZ-01",
"recipientName": "John Lee",
"recipientPhone": "+1-xxx",
"recipientCountryName": "United States",
"recipientAddressFull": "xxx Street, City, CA 90001",
"actualWeight": 1.25,
"length": 30,
"width": 20,
"height": 10,
"items": [
{ "skuCode": "SKU001", "skuName": "T-Shirt", "qty": 2 }
],
"printTime": "2026-07-18 14:00:00"
}
```

View File

@ -116,6 +116,9 @@ server {
location ^~ /order/myOrders {
try_files /index.html =200;
}
location ^~ /order/waybillManage {
try_files /index.html =200;
}
location ^~ /order/pickupOrder {
try_files /index.html =200;
}

View File

@ -45,6 +45,7 @@ server {
location ^~ /order/priceCheck { try_files /index.html =200; }
location ^~ /order/placeOrder { try_files /index.html =200; }
location ^~ /order/myOrders { try_files /index.html =200; }
location ^~ /order/waybillManage { try_files /index.html =200; }
location ^~ /order/pickupOrder { try_files /index.html =200; }
location ^~ /order/batchJobs { try_files /index.html =200; }
location ^~ /order/templateMapping { try_files /index.html =200; }

View File

@ -1,6 +1,78 @@
import { axiosInstance } from '@/api/rbac'
import { assertBusinessOk, omsUrl, unwrapData } from '@/api/oms/common'
export type LabelTemplateListItem = {
id: number
name: string
templateType?: string
createTime?: string
updateTime?: string
}
export type LabelTemplateDetail = LabelTemplateListItem & {
templateJson?: unknown
}
export type LabelFieldItem = { field: string; title: string }
export type LabelFieldGroup = { code: string; title: string; fields: LabelFieldItem[] }
export async function getLabelTemplateList(params?: {
keyword?: string
templateType?: string
}) {
const res = await axiosInstance.get(omsUrl('/channel/label-template/list'), { params })
assertBusinessOk(res.data)
const data = unwrapData<any>(res.data)
const items = (data?.items ?? data?.Items ?? []) as any[]
return items.map((row) => ({
id: Number(row.id ?? row.Id),
name: String(row.name ?? row.Name ?? ''),
templateType: row.templateType ?? row.TemplateType,
createTime: row.createTime ?? row.CreateTime,
updateTime: row.updateTime ?? row.UpdateTime,
})) as LabelTemplateListItem[]
}
export async function getLabelTemplate(id: number) {
const res = await axiosInstance.get(omsUrl(`/channel/label-template/${id}`))
assertBusinessOk(res.data)
const row = unwrapData<any>(res.data) || {}
return {
id: Number(row.id ?? row.Id),
name: String(row.name ?? row.Name ?? ''),
templateType: row.templateType ?? row.TemplateType,
templateJson: row.templateJson ?? row.TemplateJson,
createTime: row.createTime ?? row.CreateTime,
updateTime: row.updateTime ?? row.UpdateTime,
} as LabelTemplateDetail
}
export async function getLabelFieldDictionary() {
const res = await axiosInstance.get(omsUrl('/channel/label-template/field-dictionary'))
assertBusinessOk(res.data)
const data = unwrapData<any>(res.data)
const items = (data?.items ?? data?.Items ?? []) as any[]
return items.map((g) => ({
code: String(g.code ?? g.Code ?? ''),
title: String(g.title ?? g.Title ?? ''),
fields: ((g.fields ?? g.Fields ?? []) as any[]).map((f) => ({
field: String(f.field ?? f.Field ?? ''),
title: String(f.title ?? f.Title ?? ''),
})),
})) as LabelFieldGroup[]
}
export async function previewLabelTemplatePdf(body: {
templateId?: number
templateJson?: unknown
printData?: Record<string, unknown>
}) {
const res = await axiosInstance.post(omsUrl('/channel/label-template/preview-pdf'), body, {
responseType: 'blob',
})
return res.data as Blob
}
export async function saveLabelTemplate(body: {
id?: number
name: string
@ -11,3 +83,8 @@ export async function saveLabelTemplate(body: {
assertBusinessOk(res.data)
return unwrapData<any>(res.data)
}
export async function deleteLabelTemplate(id: number) {
const res = await axiosInstance.post(omsUrl('/channel/label-template/delete'), { id })
assertBusinessOk(res.data)
}

View File

@ -80,6 +80,58 @@ export async function outboundRecentList(params?: { limit?: number; warehouseId?
return parseListPayload(res.data)
}
export async function printLabelLookup(params: { number: string; numberType?: string }) {
const res = await axiosInstance.get(omsUrl('/operation/print-label/lookup'), { params })
assertBusinessOk(res.data)
return unwrapData(res.data) as PrintLabelLookupResult
}
export type PrintLabelBindItem = {
bindType?: string
skuCode?: string
skuName?: string
trackingNo?: string
productName?: string
attributeText?: string
imageUrl?: string
binCode?: string
bindQty?: number
status?: string
}
export type PrintLabelLookupCandidate = {
orderId: number
serviceNo?: string
clientNo?: string
trackNo?: string
orderStatusName?: string
bindQtyTotal?: number
matchedHint?: string
}
export type PrintLabelLookupResult = {
matched?: boolean
matchedNumberType?: string
warnings?: string[]
orderId?: number
serviceNo?: string
clientNo?: string
trackNo?: string
productCode?: string
salesProductName?: string
destinationCountry?: string
destinationCountryName?: string
orderStatus?: string
orderStatusName?: string
warehouseId?: number
warehouseName?: string
bindStatus?: string
bindQtyTotal?: number
bindLineCount?: number
bindItems?: PrintLabelBindItem[]
candidates?: PrintLabelLookupCandidate[]
}
export async function printLabelPrint(body: {
number: string
numberType: string

View File

@ -1280,3 +1280,101 @@ export async function postOrderFeeAdd(body: OrderFeeAddRequest): Promise<any> {
assertBusinessOk(res.data)
return res.data?.data ?? res.data?.Data ?? res.data
}
export interface OrderStockBindItem {
id?: number
bindType: 'inventory' | 'parcelItem' | string
skuId?: number
skuCode?: string
skuName?: string
inventoryId?: number
binLocationId?: number
binCode?: string
parcelId?: number
parcelItemId?: number
trackingNo?: string
productName?: string
attributeText?: string
imageUrl?: string
bindQty: number
availableQty?: number
status?: string
}
export interface OrderStockBindDetail {
orderId: number
warehouseId?: number
warehouseName?: string
bindStatus: string
items: OrderStockBindItem[]
}
function unwrapData<T = any>(body: any): T {
return (body?.data ?? body?.Data ?? body) as T
}
/** GET /order/stock-bind/detail */
export async function getOrderStockBindDetail(orderId: number): Promise<OrderStockBindDetail> {
const res = await axiosInstance.get(orderUrl('/order/stock-bind/detail'), { params: { orderId } })
assertBusinessOk(res.data)
return unwrapData(res.data)
}
/** POST /order/stock-bind/inventory-candidates */
export async function postOrderStockBindInventoryCandidates(body: {
orderId: number
warehouseId?: number
keyword?: string
page?: number
pageSize?: number
}): Promise<{ items: any[]; total: number }> {
const res = await axiosInstance.post(orderUrl('/order/stock-bind/inventory-candidates'), body)
assertBusinessOk(res.data)
const data = unwrapData<any>(res.data)
return {
items: data?.items ?? data?.Items ?? [],
total: data?.total ?? data?.Total ?? 0,
}
}
/** POST /order/stock-bind/parcel-candidates */
export async function postOrderStockBindParcelCandidates(body: {
orderId: number
warehouseId?: number
lifecycleStatus?: string
keyword?: string
page?: number
pageSize?: number
}): Promise<{ items: any[]; total: number }> {
const res = await axiosInstance.post(orderUrl('/order/stock-bind/parcel-candidates'), body)
assertBusinessOk(res.data)
const data = unwrapData<any>(res.data)
return {
items: data?.items ?? data?.Items ?? [],
total: data?.total ?? data?.Total ?? 0,
}
}
/** POST /order/stock-bind/save */
export async function postOrderStockBindSave(body: {
orderId: number
items: Array<{
bindType: string
skuId?: number
inventoryId?: number
parcelId?: number
parcelItemId?: number
bindQty: number
}>
}): Promise<OrderStockBindDetail> {
const res = await axiosInstance.post(orderUrl('/order/stock-bind/save'), body)
assertBusinessOk(res.data)
return unwrapData(res.data)
}
/** POST /order/stock-bind/clear */
export async function postOrderStockBindClear(orderId: number): Promise<OrderStockBindDetail> {
const res = await axiosInstance.post(orderUrl('/order/stock-bind/clear'), { orderId })
assertBusinessOk(res.data)
return unwrapData(res.data)
}

View File

@ -87,3 +87,5 @@ export const getWarehouseInventoryBinDetail = (skuId: number, warehouseId: numbe
getData('/warehouse/inventory/bin-detail', { skuId, warehouseId, customerId })
export const relocateWarehouseInventory = (body: Record<string, unknown>) =>
postOk('/warehouse/inventory/relocate', body)
export const getWarehouseInventoryHistory = (body: Record<string, unknown>) =>
postList('/warehouse/inventory/history', body)

View File

@ -17,7 +17,7 @@
position="bl"
:popup-offset="0"
:mouse-enter-delay="80"
:mouse-leave-delay="400"
:mouse-leave-delay="120"
unmount-on-close
>
<span

View File

@ -82,6 +82,7 @@ export const PERMISSION_ACTION_LABELS: Record<string, string> = {
MarkClaimed: '创建理赔件',
MarkProcessed: '标记已处理',
EditOrder: '修改订单',
StockBind: '绑定包裹/库存',
AddMapping: '添加映射',
AddInterface: '新增接口',
RefreshList: '刷新列表',
@ -487,6 +488,7 @@ const CORE_GROUPS: PageButtonGroup[] = [
{ code: 'MarkClaimed', name: '创建理赔件' },
{ code: 'MarkProcessed', name: '标记已处理' },
{ code: 'EditOrder', name: '修改订单' },
{ code: 'StockBind', name: '绑定包裹/库存' },
{ code: 'View', name: '查看详情' },
{ code: 'More', name: '更多' },
{ code: 'DownstreamForecastResult', name: '下游预报结果' },

View File

@ -90,6 +90,8 @@ export default {
'warehouse.common.detail': 'Detail',
'warehouse.common.warehouse': 'Warehouse',
'warehouse.common.customer': 'Customer',
'warehouse.common.customerName': 'Customer Name',
'warehouse.common.customerCode': 'Customer Code',
'warehouse.common.selectCustomer': 'All customers',
'warehouse.common.selectCustomerRequired': 'Select a customer before create/update',
'warehouse.common.yes': 'Yes',
@ -102,6 +104,7 @@ export default {
'warehouse.sku.table.weightG': 'Weight(g)',
'warehouse.sku.table.remark': 'Remark',
'warehouse.sku.search.keyword': 'Code / Name',
'warehouse.sku.tip': 'Manage warehouse SKUs. Stock qty is aggregated across warehouses — check Available on My Inventory before shipping.',
'warehouse.sku.form.skuCode': 'SKU Code',
'warehouse.sku.form.skuName': 'SKU Name',
'warehouse.sku.form.weightG': 'Weight(g)',
@ -141,13 +144,28 @@ export default {
'warehouse.inventory.table.skuName': 'SKU Name',
'warehouse.inventory.table.warehouseId': 'Warehouse',
'warehouse.inventory.table.totalQty': 'Total Qty',
'warehouse.inventory.table.availableQty': 'Available',
'warehouse.inventory.table.frozenQty': 'Frozen',
'warehouse.inventory.table.binCount': 'Bins',
'warehouse.inventory.table.binCode': 'Bin',
'warehouse.inventory.table.qty': 'Qty',
'warehouse.inventory.search.keyword': 'Code / Name',
'warehouse.inventory.actions.binDetail': 'Bin Detail',
'warehouse.inventory.actions.history': 'History',
'warehouse.inventory.actions.relocate': 'Relocate',
'warehouse.inventory.drawer.binDetail': 'Bin Detail',
'warehouse.inventory.drawer.history': 'Stock history',
'warehouse.inventory.history.all': 'All',
'warehouse.inventory.history.inbound': 'Inbound',
'warehouse.inventory.history.deduct': 'Deduct',
'warehouse.inventory.history.type': 'Type',
'warehouse.inventory.history.qty': 'Qty',
'warehouse.inventory.history.refNo': 'Ref No.',
'warehouse.inventory.history.remark': 'Remark',
'warehouse.inventory.history.time': 'Time',
'warehouse.inventory.history.empty': 'No history yet',
'warehouse.inventory.history.loadFailed': 'Failed to load history',
'warehouse.inventory.tip': 'Available = ready to ship; Frozen = reserved by orders. Use History for inbound & deductions.',
'warehouse.inventory.modal.relocate': 'Relocate',
'warehouse.inventory.form.sourceBin': 'Source Bin',
'warehouse.inventory.form.targetBin': 'Target Bin',
@ -196,11 +214,16 @@ export default {
'warehouse.parcel.table.image': 'Image',
'warehouse.parcel.table.imagePreviewTip': 'Click to enlarge',
'warehouse.parcel.table.attribute': 'Attributes',
'warehouse.parcel.table.quantity': 'Qty',
'warehouse.parcel.table.quantity': 'Total',
'warehouse.parcel.table.availableQty': 'Available',
'warehouse.parcel.table.frozenQty': 'Frozen',
'warehouse.parcel.badge.multiTip': 'Multi-item parcel. Click Items / Attributes / Qty for details.',
'warehouse.parcel.drawer.itemsTitle': 'Item details',
'warehouse.parcel.drawer.totalQty': 'Total qty',
'warehouse.parcel.drawer.availableQty': 'Available',
'warehouse.parcel.drawer.frozenQty': 'Frozen',
'warehouse.parcel.drawer.itemCount': '{n} line(s)',
'warehouse.parcel.tip': 'Available = ready to bind; Frozen = reserved by orders. Use status tabs to filter.',
'warehouse.parcel.drawer.edit': 'Edit parcel',
'warehouse.parcel.drawer.empty': 'No items',
'warehouse.parcel.table.arrivalTime': 'Arrival Time',
@ -237,6 +260,11 @@ export default {
'warehouse.parcel.message.imageTooLarge': 'Image must be under 5MB',
'warehouse.parcelArrival.form.trackingNo': 'Domestic tracking No.',
'warehouse.parcelArrival.form.placeholder.scanOrInput': 'Scan or enter domestic tracking number',
'warehouse.parcelArrival.scan.title': 'Scan arrival',
'warehouse.parcelArrival.tip': 'Scan domestic tracking to confirm arrival. Check the current warehouse first.',
'warehouse.parcelArrival.preview.title': 'Confirm arrival',
'warehouse.parcelArrival.preview.empty': 'Verify warehouse and tracking, then press Enter or Confirm arrival.',
'warehouse.parcelArrival.recent.title': 'Arrival records',
'warehouse.parcelArrival.search.trackingNo': 'Domestic tracking No.',
'warehouse.parcelArrival.table.trackingNo': 'Domestic tracking No.',
'warehouse.parcelArrival.table.warehouse': 'Warehouse',
@ -266,6 +294,7 @@ export default {
'warehouse.inbound.table.plannedQty': 'Planned Qty',
'warehouse.inbound.table.createTime': 'Created',
'warehouse.inbound.search.keyword': 'Notice / Mark',
'warehouse.inbound.tip': 'Forecast inbound goods. Stock increases after receive & putaway. Status: Forecasted → Received → Completed.',
'warehouse.inbound.form.markReference': 'Mark Ref',
'warehouse.inbound.form.markBoxNo': 'Box No',
'warehouse.inbound.form.sku': 'SKU',
@ -968,6 +997,47 @@ export default {
'order.myOrders.batch.partialSuccess': '{success} succeeded, {fail} failed. {detail}',
'order.myOrders.actions.more': 'More',
'order.myOrders.actions.viewTrack': 'Track',
'order.myOrders.actions.stockBind': 'Bind parcel / inventory',
'order.myOrders.stockBind.title': 'Bind parcel / inventory',
'order.myOrders.stockBind.tabInventory': 'Warehouse stock',
'order.myOrders.stockBind.tabParcel': 'My parcels',
'order.myOrders.stockBind.searchPlaceholder': 'Search SKU / tracking no.',
'order.myOrders.stockBind.searchSku': 'Search SKU code or name',
'order.myOrders.stockBind.searchParcel': 'Search tracking no.',
'order.myOrders.stockBind.warehouse': 'Warehouse',
'order.myOrders.stockBind.forOrder': 'Order',
'order.myOrders.stockBind.tipFreeze': 'Pick stock or parcels on the left. Saving only freezes qty; it does not deduct yet.',
'order.myOrders.stockBind.tipDeducted': 'This order is already deducted. Binding is read-only.',
'order.myOrders.stockBind.pickTitle': 'Available to pick',
'order.myOrders.stockBind.cartTitle': 'Will use for this order',
'order.myOrders.stockBind.cartSummary': '{lines} line(s) · {qty} pcs',
'order.myOrders.stockBind.emptyInventory': 'No available stock in this warehouse',
'order.myOrders.stockBind.emptyParcel': 'No available parcel items',
'order.myOrders.stockBind.available': 'Available',
'order.myOrders.stockBind.total': 'Total',
'order.myOrders.stockBind.selected': 'Selected',
'order.myOrders.stockBind.clear': 'Clear all',
'order.myOrders.stockBind.save': 'Confirm binding',
'order.myOrders.stockBind.emptySelected': 'Tap items on the left to add',
'order.myOrders.stockBind.maxAvailable': 'Max available',
'order.myOrders.stockBind.qtyExceed': 'Exceeds available quantity',
'order.myOrders.stockBind.singleOnly': 'Select exactly one order to bind',
'order.myOrders.stockBind.loadFailed': 'Failed to load binding data',
'order.myOrders.stockBind.saveSuccess': 'Binding saved',
'order.myOrders.stockBind.saveFailed': 'Failed to save binding',
'order.myOrders.stockBind.clearSuccess': 'Binding cleared',
'order.myOrders.stockBind.clearFailed': 'Failed to clear binding',
'order.myOrders.stockBind.alreadyDeducted': 'Already deducted; cannot rebind',
'order.myOrders.stockBind.viewEmpty': 'No bound parcels or inventory',
'order.myOrders.stockBind.bindQty': 'Bound qty',
'order.myOrders.stockBind.bindCount': '{count} item(s)',
'order.myOrders.stockBind.bin': 'Bin',
'order.myOrders.stockBind.status.none': 'None',
'order.myOrders.stockBind.status.bound': 'Bound',
'order.myOrders.stockBind.status.deducted': 'Deducted',
'order.myOrders.stockBind.status.released': 'Released',
'common.cancel': 'Cancel',
'common.loading': 'Loading...',
'order.myOrders.latestTrack.loading': 'Loading track…',
'order.myOrders.latestTrack.empty': 'No tracking yet',
@ -1032,6 +1102,7 @@ export default {
'order.myOrders.drawer.tabs.weight': 'Weight/Dimensions',
'order.myOrders.drawer.tabs.fee': 'Receivables/Payables',
'order.myOrders.drawer.tabs.track': 'Tracking',
'order.myOrders.drawer.tabs.stockBind': 'Bound stock',
'order.myOrders.drawer.orderBasic': 'Basic Info',
'order.myOrders.drawer.basic.viewAll': 'All',
'order.myOrders.drawer.basic.group.identity': 'Order IDs',
@ -2232,11 +2303,15 @@ export default {
// Operation Module - Inbound Scan
'operation.inbound.pageTitle': 'Waybill Information',
'operation.inbound.broadcastSettings': 'Broadcast Settings',
'operation.inbound.scan.title': 'Scan inbound',
'operation.inbound.tip': 'Scan to verify product and country, then enter received weight and dimensions before inbound.',
'operation.inbound.preview.title': 'Verify',
'operation.inbound.preview.empty': 'Scan a number to show order info and enter weight / dimensions',
'operation.inbound.form.scanNumber': 'Scan Number:',
'operation.inbound.form.receivedWeight': 'Received Weight:',
'operation.inbound.form.dimensions': 'Length × Width × Height:',
'operation.inbound.form.salesProduct': 'Sales Product:',
'operation.inbound.form.destinationCountry': 'Destination Country:',
'operation.inbound.form.receivedWeight': 'Received Weight',
'operation.inbound.form.dimensions': 'L × W × H',
'operation.inbound.form.salesProduct': 'Sales Product',
'operation.inbound.form.destinationCountry': 'Destination Country',
'operation.inbound.form.remarks': 'Remarks:',
'operation.inbound.form.placeholder.scanOrInput': 'Scan or enter number',
'operation.inbound.form.placeholder.input': 'Please enter',
@ -2247,10 +2322,11 @@ export default {
'operation.inbound.form.placeholder.scanFirst': 'Auto-filled after scanning',
'operation.inbound.form.hint.supportedTypes': 'Supported: Waybill number, Service provider number, Channel transfer number, Platform order number',
'operation.inbound.actions.reset': 'Reset',
'operation.inbound.actions.lookup': 'Lookup',
'operation.inbound.actions.inbound': 'Inbound',
'operation.inbound.recentOrders.title': 'Recent Orders',
'operation.inbound.recentOrders.title': 'Recent inbound',
'operation.inbound.recentOrders.subtitle': 'Maximum 50 recent orders displayed here',
'operation.inbound.recentOrders.empty': 'No data',
'operation.inbound.recentOrders.empty': 'No records',
'operation.inbound.table.index': 'Index',
'operation.inbound.table.waybillNumber': 'Waybill Number',
'operation.inbound.table.weight': 'Weight',
@ -2269,12 +2345,16 @@ export default {
// Operation Module - Outbound Scan
'operation.outbound.pageTitle': 'Waybill Information',
'operation.outbound.broadcastSettings': 'Broadcast Settings',
'operation.outbound.scan.title': 'Scan outbound',
'operation.outbound.tip': 'Scan waybill to verify product, country and channel. Weight and dimensions are optional.',
'operation.outbound.preview.title': 'Verify',
'operation.outbound.preview.empty': 'Scan a number to show order info; weight / dimensions are optional',
'operation.outbound.form.scanNumber': 'Scan Number:',
'operation.outbound.form.shipWeight': 'Shipped weight:',
'operation.outbound.form.dimensions': 'L × W × H:',
'operation.outbound.form.salesProduct': 'Sales product:',
'operation.outbound.form.destinationCountry': 'Destination country:',
'operation.outbound.form.serviceChannel': 'Service channel:',
'operation.outbound.form.shipWeight': 'Shipped weight',
'operation.outbound.form.dimensions': 'L × W × H',
'operation.outbound.form.salesProduct': 'Sales product',
'operation.outbound.form.destinationCountry': 'Destination country',
'operation.outbound.form.serviceChannel': 'Service channel',
'operation.outbound.form.placeholder.scanOrInput': 'Scan or enter number',
'operation.outbound.form.placeholder.input': 'Enter',
'operation.outbound.form.placeholder.length': 'L / CM',
@ -2284,10 +2364,11 @@ export default {
'operation.outbound.form.placeholder.scanFirst': 'Auto-filled after scan',
'operation.outbound.form.hint.supportedTypes': 'Supported: Waybill number only',
'operation.outbound.actions.reset': 'Reset',
'operation.outbound.actions.lookup': 'Lookup',
'operation.outbound.actions.outbound': 'Outbound',
'operation.outbound.recentOrders.title': 'Recent orders',
'operation.outbound.recentOrders.title': 'Recent outbound',
'operation.outbound.recentOrders.subtitle': 'Maximum 50 recent orders displayed here',
'operation.outbound.recentOrders.empty': 'No data',
'operation.outbound.recentOrders.empty': 'No records',
'operation.outbound.table.index': 'Index',
'operation.outbound.table.waybillNumber': 'Waybill Number',
'operation.outbound.table.weight': 'Weight',
@ -2306,24 +2387,46 @@ export default {
// Operation Module - Print Label
'operation.printLabel.pageTitle': 'Print Label',
'operation.printLabel.broadcastSettings': 'Broadcast Settings',
'operation.printLabel.form.scanNumber': 'Number:',
'operation.printLabel.form.placeholder.scanOrInput': 'Scan or enter number',
'operation.printLabel.form.placeholder.numberType': 'Select number type',
'operation.printLabel.tip': 'Scan any number to load the order and bound goods. Verify qty before printing to avoid wrong/missing shipments.',
'operation.printLabel.scan.title': 'Scan & print',
'operation.printLabel.form.scanNumber': 'Scan number',
'operation.printLabel.form.placeholder.scanOrInput': 'Waybill / Client / Track / Parcel / SKU',
'operation.printLabel.form.placeholder.numberType': 'Number type',
'operation.printLabel.form.placeholder.labelTemplate': 'Select label template',
'operation.printLabel.form.hint.supportedTypes': 'Supported: Waybill, Customer order, Tracking, Other',
'operation.printLabel.form.hint.supportedTypes': 'Supports: Waybill, Client order, Tracking, Other, Parcel tracking, SKU',
'operation.printLabel.actions.reset': 'Reset',
'operation.printLabel.actions.print': 'Print',
'operation.printLabel.actions.lookup': 'Lookup',
'operation.printLabel.actions.print': 'Confirm print',
'operation.printLabel.recentOrders.subtitle': 'Maximum 50 recent records displayed here',
'operation.printLabel.recentOrders.empty': 'No data',
'operation.printLabel.recentOrders.title': 'Recent prints',
'operation.printLabel.recentOrders.empty': 'No records',
'operation.printLabel.numberType.auto': 'Auto detect',
'operation.printLabel.numberType.waybill': 'Waybill Number',
'operation.printLabel.numberType.customerOrder': 'Customer Order Number',
'operation.printLabel.numberType.tracking': 'Tracking Number',
'operation.printLabel.numberType.other': 'Other Number',
'operation.printLabel.numberType.parcel': 'Parcel tracking',
'operation.printLabel.numberType.sku': 'SKU code',
'operation.printLabel.labelTemplate.lastMile': 'Last Mile Label',
'operation.printLabel.labelTemplate.customer': 'Customer Label',
'operation.printLabel.labelTemplate.inbound': 'Inbound Label',
'operation.printLabel.labelTemplate.outbound': 'Outbound Label',
'operation.printLabel.labelTemplate.sku': 'SKU Label',
'operation.printLabel.preview.title': 'Verify before print',
'operation.printLabel.preview.empty': 'Scan a number to show order and bound goods',
'operation.printLabel.preview.order': 'Order',
'operation.printLabel.preview.bindSummary': '{lines} line(s) · {qty} pcs',
'operation.printLabel.preview.lines': 'Lines',
'operation.printLabel.preview.noneBind': 'No parcel/inventory bound — verify physical goods carefully',
'operation.printLabel.preview.multiMatch': 'Multiple orders matched — pick one to continue',
'operation.printLabel.preview.bindInventory': 'Stock',
'operation.printLabel.preview.bindParcel': 'Parcel',
'operation.printLabel.preview.bindQty': 'Ship qty',
'operation.printLabel.preview.bin': 'Bin',
'operation.printLabel.preview.sku': 'SKU',
'operation.printLabel.preview.tracking': 'Tracking',
'operation.printLabel.preview.attr': 'Spec',
'operation.printLabel.preview.selectCandidate': 'Select',
'operation.printLabel.table.index': 'Index',
'operation.printLabel.table.waybillNumber': 'Waybill Number',
'operation.printLabel.table.customerOrderNumber': 'Customer Order Number',
@ -2335,6 +2438,8 @@ export default {
'operation.printLabel.table.operateTime': 'Operate Time',
'operation.printLabel.table.operator': 'Operator',
'operation.printLabel.message.waybillNumberRequired': 'Please enter or scan number',
'operation.printLabel.message.lookupSuccess': 'Order found — verify bound goods',
'operation.printLabel.message.lookupFirst': 'Lookup and verify the order first',
'operation.printLabel.message.printSuccess': 'Print successful',
'operation.printLabel.printSuccess.yes': 'Yes',
'operation.printLabel.printSuccess.no': 'No',
@ -3088,6 +3193,34 @@ export default {
'channel.labelDesign.noContent': 'No content',
'channel.labelDesign.applySuccess': 'Config applied',
'channel.labelDesign.resetSuccess': 'Config reset',
'channel.labelDesign.searchPlaceholder': 'Search by name',
'channel.labelDesign.typePlaceholder': 'Template type',
'channel.labelDesign.namePlaceholder': 'Template name',
'channel.labelDesign.loadingDesigner': 'Loading designer…',
'channel.labelDesign.total': '{n} total',
'channel.labelDesign.table.name': 'Name',
'channel.labelDesign.table.type': 'Type',
'channel.labelDesign.table.updateTime': 'Updated',
'channel.labelDesign.table.actions': 'Actions',
'channel.labelDesign.actions.search': 'Search',
'channel.labelDesign.actions.create': 'New template',
'channel.labelDesign.actions.edit': 'Design',
'channel.labelDesign.actions.delete': 'Delete',
'channel.labelDesign.actions.back': 'Back',
'channel.labelDesign.actions.preview': 'Preview',
'channel.labelDesign.actions.print': 'Print',
'channel.labelDesign.actions.save': 'Save',
'channel.labelDesign.actions.startDesign': 'Start design',
'channel.labelDesign.actions.cancel': 'Cancel',
'channel.labelDesign.message.loadFailed': 'Failed to load templates',
'channel.labelDesign.message.saveSuccess': 'Template saved',
'channel.labelDesign.message.saveFailed': 'Save failed',
'channel.labelDesign.message.deleteSuccess': 'Deleted',
'channel.labelDesign.message.nameRequired': 'Template name is required',
'channel.labelDesign.fieldDictionary': 'Order fields',
'channel.labelDesign.message.fieldCopied': 'Copied field: {field}',
'channel.labelDesign.message.previewEmpty': 'Nothing to preview',
'channel.labelDesign.message.previewFailed': 'PDF preview failed',
// Channel - Sales Products
'channel.salesProducts.search.placeholder': 'Enter product name',
@ -3152,6 +3285,7 @@ export default {
'channel.salesProducts.form.group': 'Group',
'channel.salesProducts.form.efficiency': 'Transit time',
'channel.salesProducts.form.customerWaybill': 'Customer waybill',
'channel.salesProducts.form.placeholder.labelTemplate': 'Select label template (global default if empty)',
'channel.salesProducts.form.blacklistArea': 'Blacklist area',
'channel.salesProducts.form.remoteAreaDivision': 'Remote area division',
'channel.salesProducts.form.priceArea': 'Price area',

View File

@ -90,6 +90,8 @@ export default {
'warehouse.common.detail': '详情',
'warehouse.common.warehouse': '仓库',
'warehouse.common.customer': '客户',
'warehouse.common.customerName': '客户名称',
'warehouse.common.customerCode': '客户编码',
'warehouse.common.selectCustomer': '全部客户',
'warehouse.common.selectCustomerRequired': '新增/修改请先选择客户',
'warehouse.common.yes': '是',
@ -102,6 +104,7 @@ export default {
'warehouse.sku.table.weightG': '重量(g)',
'warehouse.sku.table.remark': '备注',
'warehouse.sku.search.keyword': '编码/名称',
'warehouse.sku.tip': '维护库内 SKU 主数据;库存数量来自各仓库汇总,下单发货前请先在「我的库存」确认可用量。',
'warehouse.sku.form.skuCode': 'SKU 编码',
'warehouse.sku.form.skuName': 'SKU 名称',
'warehouse.sku.form.weightG': '重量(g)',
@ -140,14 +143,29 @@ export default {
'warehouse.inventory.table.skuCode': 'SKU 编码',
'warehouse.inventory.table.skuName': 'SKU 名称',
'warehouse.inventory.table.warehouseId': '仓库',
'warehouse.inventory.table.totalQty': '总数量',
'warehouse.inventory.table.totalQty': '总量',
'warehouse.inventory.table.availableQty': '可用',
'warehouse.inventory.table.frozenQty': '冻结',
'warehouse.inventory.table.binCount': '库位数',
'warehouse.inventory.table.binCode': '库位',
'warehouse.inventory.table.qty': '数量',
'warehouse.inventory.search.keyword': '编码/名称',
'warehouse.inventory.actions.binDetail': '库位明细',
'warehouse.inventory.actions.history': '出入库记录',
'warehouse.inventory.actions.relocate': '换库位',
'warehouse.inventory.drawer.binDetail': '库位明细',
'warehouse.inventory.drawer.history': '出入库记录',
'warehouse.inventory.history.all': '全部',
'warehouse.inventory.history.inbound': '入库',
'warehouse.inventory.history.deduct': '扣减',
'warehouse.inventory.history.type': '类型',
'warehouse.inventory.history.qty': '数量',
'warehouse.inventory.history.refNo': '关联单号',
'warehouse.inventory.history.remark': '说明',
'warehouse.inventory.history.time': '时间',
'warehouse.inventory.history.empty': '暂无出入库记录',
'warehouse.inventory.history.loadFailed': '加载出入库记录失败',
'warehouse.inventory.tip': '可用=可发货;冻结=已被订单占用;点「出入库记录」可查看历史入库与扣减。',
'warehouse.inventory.modal.relocate': '换库位',
'warehouse.inventory.form.sourceBin': '源库位',
'warehouse.inventory.form.targetBin': '目标库位',
@ -196,11 +214,16 @@ export default {
'warehouse.parcel.table.image': '图片',
'warehouse.parcel.table.imagePreviewTip': '点击放大',
'warehouse.parcel.table.attribute': '属性',
'warehouse.parcel.table.quantity': '数量',
'warehouse.parcel.table.quantity': '总量',
'warehouse.parcel.table.availableQty': '可用',
'warehouse.parcel.table.frozenQty': '冻结',
'warehouse.parcel.badge.multiTip': '多商品包裹,点击商品/属性/数量可查看明细',
'warehouse.parcel.drawer.itemsTitle': '商品明细',
'warehouse.parcel.drawer.totalQty': '合计数量',
'warehouse.parcel.drawer.availableQty': '可用',
'warehouse.parcel.drawer.frozenQty': '冻结',
'warehouse.parcel.drawer.itemCount': '共 {n} 项',
'warehouse.parcel.tip': '可用=可绑定发货;冻结=已被订单占用。点状态 Tab 快速筛选在途/到仓/已上架。',
'warehouse.parcel.drawer.edit': '编辑包裹',
'warehouse.parcel.drawer.empty': '暂无商品明细',
'warehouse.parcel.table.arrivalTime': '到仓时间',
@ -237,6 +260,11 @@ export default {
'warehouse.parcel.message.imageTooLarge': '图片不能超过 5MB',
'warehouse.parcelArrival.form.trackingNo': '国内快递单号',
'warehouse.parcelArrival.form.placeholder.scanOrInput': '扫描或输入国内快递单号',
'warehouse.parcelArrival.scan.title': '扫码到仓',
'warehouse.parcelArrival.tip': '扫描国内快递单号确认到仓;请确认当前仓库正确后再操作。',
'warehouse.parcelArrival.preview.title': '到仓确认',
'warehouse.parcelArrival.preview.empty': '确认仓库与单号无误后,回车或点击确认到仓。',
'warehouse.parcelArrival.recent.title': '到仓记录',
'warehouse.parcelArrival.search.trackingNo': '国内快递单号',
'warehouse.parcelArrival.table.trackingNo': '国内快递单号',
'warehouse.parcelArrival.table.warehouse': '仓库',
@ -266,6 +294,7 @@ export default {
'warehouse.inbound.table.plannedQty': '计划数量',
'warehouse.inbound.table.createTime': '创建时间',
'warehouse.inbound.search.keyword': '单号/唛头',
'warehouse.inbound.tip': '预报到仓货物;收货上架后库存会增加。关注状态:预报 → 待入库 → 已完成。',
'warehouse.inbound.form.markReference': '唛头',
'warehouse.inbound.form.markBoxNo': '箱号',
'warehouse.inbound.form.sku': 'SKU',
@ -719,6 +748,47 @@ export default {
'order.myOrders.actions.markProcessed': '标记已处理',
'order.myOrders.actions.more': '更多',
'order.myOrders.actions.viewTrack': '轨迹',
'order.myOrders.actions.stockBind': '绑定包裹/库存',
'order.myOrders.stockBind.title': '绑定包裹/库存',
'order.myOrders.stockBind.tabInventory': '仓库库存',
'order.myOrders.stockBind.tabParcel': '我的包裹',
'order.myOrders.stockBind.searchPlaceholder': '搜索 SKU / 运单号',
'order.myOrders.stockBind.searchSku': '搜索 SKU 编码或名称',
'order.myOrders.stockBind.searchParcel': '搜索快递单号',
'order.myOrders.stockBind.warehouse': '发货仓',
'order.myOrders.stockBind.forOrder': '当前订单',
'order.myOrders.stockBind.tipFreeze': '点选左侧可用库存或包裹加入右侧;保存后仅冻结数量,不会立刻扣减出库。',
'order.myOrders.stockBind.tipDeducted': '该订单已确认扣减,绑定明细只读,无法再修改。',
'order.myOrders.stockBind.pickTitle': '可选资源',
'order.myOrders.stockBind.cartTitle': '本单将使用',
'order.myOrders.stockBind.cartSummary': '{lines} 种 · 共 {qty} 件',
'order.myOrders.stockBind.emptyInventory': '当前仓库暂无可用库存',
'order.myOrders.stockBind.emptyParcel': '暂无可用包裹明细',
'order.myOrders.stockBind.available': '可用',
'order.myOrders.stockBind.total': '总量',
'order.myOrders.stockBind.selected': '已选明细',
'order.myOrders.stockBind.clear': '清空全部',
'order.myOrders.stockBind.save': '确认绑定',
'order.myOrders.stockBind.emptySelected': '从左侧点选要发的库存或包裹',
'order.myOrders.stockBind.maxAvailable': '最多可用',
'order.myOrders.stockBind.qtyExceed': '超出可用数量',
'order.myOrders.stockBind.singleOnly': '请只选择一笔订单进行绑定',
'order.myOrders.stockBind.loadFailed': '加载绑定数据失败',
'order.myOrders.stockBind.saveSuccess': '绑定已保存',
'order.myOrders.stockBind.saveFailed': '保存绑定失败',
'order.myOrders.stockBind.clearSuccess': '已清空绑定',
'order.myOrders.stockBind.clearFailed': '清空绑定失败',
'order.myOrders.stockBind.alreadyDeducted': '已确认扣减,不能再改绑',
'order.myOrders.stockBind.viewEmpty': '暂无绑定的包裹或库存',
'order.myOrders.stockBind.bindQty': '绑定数量',
'order.myOrders.stockBind.bindCount': '共 {count} 条',
'order.myOrders.stockBind.bin': '库位',
'order.myOrders.stockBind.status.none': '未绑定',
'order.myOrders.stockBind.status.bound': '已绑定',
'order.myOrders.stockBind.status.deducted': '已扣减',
'order.myOrders.stockBind.status.released': '已释放',
'common.cancel': '取消',
'common.loading': '加载中...',
'order.myOrders.latestTrack.loading': '轨迹加载中…',
'order.myOrders.latestTrack.empty': '暂无轨迹',
@ -919,6 +989,7 @@ export default {
'order.myOrders.drawer.tabs.weight': '件重尺',
'order.myOrders.drawer.tabs.fee': '应收应付',
'order.myOrders.drawer.tabs.track': '轨迹',
'order.myOrders.drawer.tabs.stockBind': '绑定包裹/库存',
'order.myOrders.drawer.orderBasic': '基本信息',
'order.myOrders.drawer.basic.viewAll': '全部',
'order.myOrders.drawer.basic.group.identity': '单号信息',
@ -2251,11 +2322,15 @@ export default {
// 操作模块 - 入库扫描
'operation.inbound.pageTitle': '运单信息',
'operation.inbound.broadcastSettings': '播报设置',
'operation.inbound.scan.title': '扫码入库',
'operation.inbound.tip': '扫描单号核对产品与国家后,填写收货实重与尺寸再入库,避免录错。',
'operation.inbound.preview.title': '核对信息',
'operation.inbound.preview.empty': '扫描单号后显示订单信息,并填写收货实重与尺寸',
'operation.inbound.form.scanNumber': '扫描单号:',
'operation.inbound.form.receivedWeight': '收货实重:',
'operation.inbound.form.dimensions': '长*宽*高:',
'operation.inbound.form.salesProduct': '销售产品:',
'operation.inbound.form.destinationCountry': '目的国家:',
'operation.inbound.form.receivedWeight': '收货实重',
'operation.inbound.form.dimensions': '长*宽*高',
'operation.inbound.form.salesProduct': '销售产品',
'operation.inbound.form.destinationCountry': '目的国家',
'operation.inbound.form.remarks': '备注:',
'operation.inbound.form.placeholder.scanOrInput': '请扫描或输入单号',
'operation.inbound.form.placeholder.input': '请输入',
@ -2266,10 +2341,11 @@ export default {
'operation.inbound.form.placeholder.scanFirst': '扫描单号后自动带出',
'operation.inbound.form.hint.supportedTypes': '支持:运单号,服务商单号,渠道转单号,平台订单号',
'operation.inbound.actions.reset': '重置',
'operation.inbound.actions.lookup': '查询核对',
'operation.inbound.actions.inbound': '入库',
'operation.inbound.recentOrders.title': '最近操作的订单',
'operation.inbound.recentOrders.title': '最近入库',
'operation.inbound.recentOrders.subtitle': '此处最多显示最近操作的50张订单',
'operation.inbound.recentOrders.empty': '暂无数据',
'operation.inbound.recentOrders.empty': '暂无记录',
'operation.inbound.table.index': '序号',
'operation.inbound.table.waybillNumber': '运单号',
'operation.inbound.table.weight': '重量',
@ -2288,12 +2364,16 @@ export default {
// 操作模块 - 出库扫描
'operation.outbound.pageTitle': '运单信息',
'operation.outbound.broadcastSettings': '播报设置',
'operation.outbound.scan.title': '扫码出库',
'operation.outbound.tip': '扫描运单号核对产品、国家与渠道后,可按需补录发货实重尺寸再出库。',
'operation.outbound.preview.title': '核对信息',
'operation.outbound.preview.empty': '扫描单号后显示订单信息,可填写发货实重与尺寸',
'operation.outbound.form.scanNumber': '扫描单号:',
'operation.outbound.form.shipWeight': '发货实重:',
'operation.outbound.form.dimensions': '长*宽*高:',
'operation.outbound.form.salesProduct': '销售产品:',
'operation.outbound.form.destinationCountry': '目的国家:',
'operation.outbound.form.serviceChannel': '服务渠道:',
'operation.outbound.form.shipWeight': '发货实重',
'operation.outbound.form.dimensions': '长*宽*高',
'operation.outbound.form.salesProduct': '销售产品',
'operation.outbound.form.destinationCountry': '目的国家',
'operation.outbound.form.serviceChannel': '服务渠道',
'operation.outbound.form.placeholder.scanOrInput': '请扫描或输入单号',
'operation.outbound.form.placeholder.input': '请输入',
'operation.outbound.form.placeholder.length': '长/CM',
@ -2303,10 +2383,11 @@ export default {
'operation.outbound.form.placeholder.scanFirst': '扫描单号后自动带出',
'operation.outbound.form.hint.supportedTypes': '支持:仅支持运单号',
'operation.outbound.actions.reset': '重置',
'operation.outbound.actions.lookup': '查询核对',
'operation.outbound.actions.outbound': '出库',
'operation.outbound.recentOrders.title': '最近操作的订单',
'operation.outbound.recentOrders.title': '最近出库',
'operation.outbound.recentOrders.subtitle': '此处最多显示最近操作的50张订单',
'operation.outbound.recentOrders.empty': '暂无数据',
'operation.outbound.recentOrders.empty': '暂无记录',
'operation.outbound.table.index': '序号',
'operation.outbound.table.waybillNumber': '运单号',
'operation.outbound.table.weight': '重量',
@ -2322,27 +2403,48 @@ export default {
'operation.outbound.message.outboundFailed': '出库失败',
'operation.outbound.message.loadRecentFailed': '加载最近出库记录失败',
// 操作模块 - 打印标签
'operation.printLabel.pageTitle': '打印标签',
'operation.printLabel.broadcastSettings': '播报设置',
'operation.printLabel.form.scanNumber': '单号:',
'operation.printLabel.form.placeholder.scanOrInput': '请扫描或输入单号',
'operation.printLabel.form.placeholder.numberType': '请选择单号类型',
'operation.printLabel.tip': '扫描任一号码拉出订单与绑定货品,核对数量无误后再打印面单,避免发错、发漏。',
'operation.printLabel.scan.title': '扫码打印',
'operation.printLabel.form.scanNumber': '扫描号码',
'operation.printLabel.form.placeholder.scanOrInput': '运单号 / 客户单号 / 跟踪号 / 包裹单号 / SKU',
'operation.printLabel.form.placeholder.numberType': '号码类型',
'operation.printLabel.form.placeholder.labelTemplate': '请选择标签模板',
'operation.printLabel.form.hint.supportedTypes': '支持: 运单号、客户单号、跟踪号、其他单号',
'operation.printLabel.form.hint.supportedTypes': '支持: 运单号、客户单号、跟踪号、其他单号、包裹快递单号、SKU',
'operation.printLabel.actions.reset': '重置',
'operation.printLabel.actions.print': '打印',
'operation.printLabel.actions.lookup': '查询核对',
'operation.printLabel.actions.print': '确认打印',
'operation.printLabel.recentOrders.subtitle': '此处最多显示最近操作的50条记录',
'operation.printLabel.recentOrders.empty': '暂无数据',
'operation.printLabel.recentOrders.title': '最近打印',
'operation.printLabel.recentOrders.empty': '暂无记录',
'operation.printLabel.numberType.auto': '智能识别',
'operation.printLabel.numberType.waybill': '运单号',
'operation.printLabel.numberType.customerOrder': '客户单号',
'operation.printLabel.numberType.tracking': '跟踪号',
'operation.printLabel.numberType.other': '其他单号',
'operation.printLabel.numberType.parcel': '包裹快递单号',
'operation.printLabel.numberType.sku': 'SKU 编码',
'operation.printLabel.labelTemplate.lastMile': '尾程标签',
'operation.printLabel.labelTemplate.customer': '客户标签',
'operation.printLabel.labelTemplate.inbound': '入库标签',
'operation.printLabel.labelTemplate.outbound': '出库标签',
'operation.printLabel.labelTemplate.sku': 'sku标签',
'operation.printLabel.preview.title': '核对信息',
'operation.printLabel.preview.empty': '扫描号码后显示订单与绑定货品',
'operation.printLabel.preview.order': '订单',
'operation.printLabel.preview.bindSummary': '{lines} 种货 · 共 {qty} 件',
'operation.printLabel.preview.lines': '货品种类',
'operation.printLabel.preview.noneBind': '未绑定包裹/库存,请与实物仔细核对后再打印',
'operation.printLabel.preview.multiMatch': '命中多笔订单,请点选一笔再核对',
'operation.printLabel.preview.bindInventory': '库存',
'operation.printLabel.preview.bindParcel': '包裹',
'operation.printLabel.preview.bindQty': '应发',
'operation.printLabel.preview.bin': '库位',
'operation.printLabel.preview.sku': 'SKU',
'operation.printLabel.preview.tracking': '快递单号',
'operation.printLabel.preview.attr': '规格',
'operation.printLabel.preview.selectCandidate': '选择此单',
'operation.printLabel.table.index': '序号',
'operation.printLabel.table.waybillNumber': '运单号',
'operation.printLabel.table.customerOrderNumber': '客户单号',
@ -2354,6 +2456,8 @@ export default {
'operation.printLabel.table.operateTime': '操作时间',
'operation.printLabel.table.operator': '操作人',
'operation.printLabel.message.waybillNumberRequired': '请输入或扫描单号',
'operation.printLabel.message.lookupSuccess': '已找到订单,请核对绑定货品',
'operation.printLabel.message.lookupFirst': '请先查询并核对订单信息',
'operation.printLabel.message.printSuccess': '打印成功',
'operation.printLabel.printSuccess.yes': '是',
'operation.printLabel.printSuccess.no': '否',
@ -3109,6 +3213,34 @@ export default {
'channel.labelDesign.noContent': '无内容',
'channel.labelDesign.applySuccess': '配置已应用',
'channel.labelDesign.resetSuccess': '配置已重置',
'channel.labelDesign.searchPlaceholder': '搜索模板名称',
'channel.labelDesign.typePlaceholder': '模板类型',
'channel.labelDesign.namePlaceholder': '模板名称',
'channel.labelDesign.loadingDesigner': '正在加载设计器…',
'channel.labelDesign.total': '共 {n} 条',
'channel.labelDesign.table.name': '名称',
'channel.labelDesign.table.type': '类型',
'channel.labelDesign.table.updateTime': '更新时间',
'channel.labelDesign.table.actions': '操作',
'channel.labelDesign.actions.search': '查询',
'channel.labelDesign.actions.create': '新建模板',
'channel.labelDesign.actions.edit': '设计',
'channel.labelDesign.actions.delete': '删除',
'channel.labelDesign.actions.back': '返回列表',
'channel.labelDesign.actions.preview': '预览',
'channel.labelDesign.actions.print': '打印',
'channel.labelDesign.actions.save': '保存',
'channel.labelDesign.actions.startDesign': '开始设计',
'channel.labelDesign.actions.cancel': '取消',
'channel.labelDesign.message.loadFailed': '加载模板失败',
'channel.labelDesign.message.saveSuccess': '模板已保存',
'channel.labelDesign.message.saveFailed': '保存失败',
'channel.labelDesign.message.deleteSuccess': '已删除',
'channel.labelDesign.message.nameRequired': '请填写模板名称',
'channel.labelDesign.fieldDictionary': '订单字段',
'channel.labelDesign.message.fieldCopied': '已复制字段:{field}',
'channel.labelDesign.message.previewEmpty': '暂无可预览的模板',
'channel.labelDesign.message.previewFailed': '预览 PDF 失败',
// 渠道 - 销售产品
'channel.salesProducts.search.placeholder': '请输入产品名称',
@ -3179,6 +3311,7 @@ export default {
'channel.salesProducts.form.weightRounding': '计重进位',
'channel.salesProducts.form.productDescription': '产品说明',
'channel.salesProducts.form.preStorageScript': '落库前执行脚本',
'channel.salesProducts.form.placeholder.labelTemplate': '请选择标签模板(未选则用全局默认)',
'channel.salesProducts.form.placeholder.input': '请输入',
'channel.salesProducts.form.placeholder.min': '最小值',
'channel.salesProducts.form.placeholder.max': '最大值',

View File

@ -41,7 +41,7 @@ const OPERATION: AppRouteRecordRaw = {
meta: {
locale: 'menu.operation.printLabel',
requiresAuth: true,
permission: 'Operation.PrintLabel.Query',
permission: 'Operation.PrintLabel',
order: 3,
},
},

View File

@ -310,9 +310,19 @@ export const useRbacUserStore = defineStore('rbacUser', () => {
initAuth()
// 检查权限
// 检查权限(与 @/utils/rbac-permission 规则一致:资源码 ↔ Query 互通)
function hasPermission(permission: string): boolean {
return permissions.value.includes(permission)
if (!permission?.trim()) return true
const code = permission.trim()
const granted = permissions.value
if (granted.includes(code)) return true
if (/\.Query$/i.test(code)) {
const resource = code.replace(/\.Query$/i, '')
if (resource && granted.includes(resource)) return true
} else if (granted.includes(`${code}.Query`)) {
return true
}
return false
}
// 检查角色

View File

@ -23,6 +23,18 @@
overflow: hidden;
}
.warehouse-list-page-card .wh-page-tip {
margin: 16px 16px 0;
padding: 10px 12px;
border-radius: 6px;
background: color-mix(in srgb, var(--app-primary-color) 8%, #fff);
border: 1px solid color-mix(in srgb, var(--app-primary-color) 22%, #e5e6eb);
color: #4e5969;
font-size: 13px;
line-height: 1.5;
flex-shrink: 0;
}
.warehouse-list-page-card .status-tabs {
padding: 16px 16px 0;
flex-shrink: 0;
@ -98,7 +110,9 @@
.warehouse-list-page-card .list-wrap :deep(.wh-action-btn--relocate:hover),
.warehouse-list-page-card .list-wrap :deep(.wh-action-btn--receive:hover),
.warehouse-list-page-card .list-wrap :deep(.wh-action-btn--star:hover),
.warehouse-list-page-card .list-wrap :deep(.wh-action-btn--pay:hover) {
.warehouse-list-page-card .list-wrap :deep(.wh-action-btn--pay:hover),
.warehouse-list-page-card .list-wrap :deep(.wh-action-btn--history:hover),
.warehouse-list-page-card .list-wrap :deep(.wh-action-btn--track:hover) {
color: var(--app-primary-color);
background: var(--app-primary-color-light, #e6f7f7);
}

View File

@ -1,12 +1,29 @@
import { useRbacUserStore } from '@/store/modules/rbac-user'
import { normalizeResourcePermissionCode } from '@/constants/pageButtonCatalog'
/**
* 检查是否有权限(三级按钮 / 路由 meta.permission)
*
* 兼容菜单同步后的编码差异:
* - 二级菜单可能是资源码 `Operation.PrintLabel`
* - 路由 meta 可能是 `Operation.PrintLabel.Query`
* 二者互相视为可访问页面。
*/
export function hasPermission(permission: string): boolean {
const userStore = useRbacUserStore()
if (!permission?.trim()) return true
return userStore.permissions.includes(permission)
const code = permission.trim()
const granted = userStore.permissions
if (granted.includes(code)) return true
if (/\.Query$/i.test(code)) {
const resource = normalizeResourcePermissionCode(code)
if (resource && granted.includes(resource)) return true
} else if (granted.includes(`${code}.Query`)) {
return true
}
return false
}
/**

View File

@ -182,10 +182,15 @@ async function ensurePageMenu(
): Promise<{ menu: MenuTreeDto; created: boolean }> {
const existing = findPageChildMenu(parentMenu, pageDef.route, pageDef.permissionCode);
if (existing?.id) {
// 已有二级菜单但未配 permissionCode 时,用路由目录补齐,便于同步三级按钮
// 已有二级菜单:补齐或纠正 permissionCode(Xxx.Query → Xxx),便于同步「查询」等三级按钮
const existingCode = existing.permissionCode?.trim() || '';
const nextCode = pageDef.permissionCode?.trim() || '';
if (!existingCode && nextCode) {
const shouldPatchCode =
!!nextCode &&
(!existingCode ||
existingCode === nextCode ||
normalizeResourcePermissionCode(existingCode) === nextCode);
if (shouldPatchCode && existingCode !== nextCode) {
try {
await MenuService.putRbacMenuUpdate(existing.id, {
name: existing.name || pageDef.name,
@ -248,7 +253,7 @@ export async function syncMenuLevel3Buttons(
menu: MenuTreeDto,
options?: SyncLevel3Options,
): Promise<SyncLevel3ButtonsResult> {
const parentPermissionCode = menu.permissionCode?.trim() || '';
let parentPermissionCode = menu.permissionCode?.trim() || '';
if (!parentPermissionCode) {
throw new Error('当前菜单未配置权限编码,无法同步三级按钮');
}
@ -259,6 +264,28 @@ export async function syncMenuLevel3Buttons(
throw new Error('仅支持对页面菜单同步三级按钮');
}
// 二级菜单若误存为 Xxx.Query,纠正为资源码,使「查询」可作为三级按钮同步
const resourceCode = normalizeResourcePermissionCode(parentPermissionCode);
if (resourceCode && resourceCode !== parentPermissionCode) {
try {
await MenuService.putRbacMenuUpdate(menu.id, {
name: menu.name,
permissionCode: resourceCode,
icon: menu.icon,
route: menu.route,
component: menu.component,
order: menu.order ?? 0,
isHidden: menu.isHidden ?? false,
isCached: menu.isCached ?? false,
description: menu.description || `同步二级菜单权限码: ${resourceCode}`,
});
parentPermissionCode = resourceCode;
menu = { ...menu, permissionCode: resourceCode };
} catch {
// 纠正失败时仍按原编码尝试同步(查询按钮可能被过滤)
}
}
const catalogButtons = getCatalogButtons(parentPermissionCode);
let permissionTreeButtons: PageButtonDef[] = [];
try {

View File

@ -2,6 +2,7 @@ import i18n from '@/locale';
import { appRoutes } from '@/router/routes';
import type { AppRouteRecordRaw } from '@/router/routes/types';
import type { MenuTreeDto } from '@/api/rbac';
import { normalizeResourcePermissionCode } from '@/constants/pageButtonCatalog';
export interface RoutePageMenuDef {
name: string;
@ -88,11 +89,15 @@ export function getPageRoutesFromModule(moduleRoute: AppRouteRecordRaw): RoutePa
if (!child.meta || child.meta.hideInMenu) return;
const routePath = joinRoutePath(parentPath, child.path);
// 二级菜单存资源码(Operation.PrintLabel),查询等动作作为三级按钮同步
const rawPermission = (child.meta.permission as string | undefined)?.trim() || undefined;
pages.push({
name: resolveRouteMenuTitle(child),
route: routePath,
component: extractComponentPath(child.component),
permissionCode: (child.meta.permission as string | undefined)?.trim() || undefined,
permissionCode: rawPermission
? normalizeResourcePermissionCode(rawPermission) || rawPermission
: undefined,
icon: (child.meta.icon as string | undefined)?.trim() || undefined,
order: (child.meta.order as number | undefined) ?? 0,
isHidden: false,

View File

@ -11,6 +11,7 @@ export const warehouseActionIcons = {
star: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" style="${ICON_STYLE}"><path d="M12 2.8 14.7 9l6.8.6-5.2 4.5 1.6 6.6L12 17.8 6.1 20.7l1.6-6.6L2.5 9.6 9.3 9Z"/></svg>`,
pay: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" style="${ICON_STYLE}"><rect x="2" y="5" width="20" height="14" rx="2"/><path d="M2 10h20"/><path d="M6 15h2"/></svg>`,
track: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" style="${ICON_STYLE}"><path d="M12 21s7-4.5 7-11a7 7 0 1 0-14 0c0 6.5 7 11 7 11Z"/><circle cx="12" cy="10" r="2.5"/></svg>`,
history: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" style="${ICON_STYLE}"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg>`,
} as const
export type WarehouseActionVariant = keyof typeof warehouseActionIcons

View File

@ -75,6 +75,8 @@ export type ParcelItemLine = {
attributeText: string
imageUrl: string
quantity: number
availableQty: number
frozenQty: number
remark: string
}
@ -96,11 +98,20 @@ export function normalizeParcelItemLines(items: unknown): ParcelItemLine[] {
return list.map((item) => {
const row = item as Row
const q = Number(pickField(row, 'quantity', 'Quantity') ?? 1)
const qty = q > 0 ? q : 1
const frozen = Math.max(0, Number(pickField(row, 'frozenQty', 'FrozenQty') ?? 0))
const availableRaw = pickField(row, 'availableQty', 'AvailableQty')
const available =
availableRaw != null && availableRaw !== ''
? Number(availableRaw)
: Math.max(0, qty - frozen)
return {
productName: String(pickField(row, 'productName', 'ProductName') ?? '').trim() || '-',
attributeText: String(pickField(row, 'attributeText', 'AttributeText') ?? '').trim() || '-',
imageUrl: String(pickField(row, 'imageUrl', 'ImageUrl', 'image', 'Image') ?? '').trim(),
quantity: q > 0 ? q : 1,
quantity: qty,
availableQty: Number.isFinite(available) ? available : 0,
frozenQty: frozen,
remark: String(pickField(row, 'remark', 'Remark') ?? '').trim() || '-',
}
})

View File

@ -1330,6 +1330,7 @@ import { IconClose, IconEdit, IconPlus, IconSearch, IconMore, IconMinus, IconRef
</script>
<template>
<div class="upstream-interface-page">
<div class="interface-layout">
<!-- 左侧上游接口列表:自定义左菜单 -->
<CustomLeftMenu
@ -1614,11 +1615,21 @@ import { IconClose, IconEdit, IconPlus, IconSearch, IconMore, IconMinus, IconRef
</div>
</ModalPro>
</div>
</template>
<style scoped lang="less">
.interface-layout {
.upstream-interface-page {
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
}
.interface-layout {
display: flex;
flex: 1;
min-height: 0;
height: calc(100vh - 86px);
max-height: calc(100vh - 86px);
padding: 16px;

View File

@ -0,0 +1,385 @@
<template>
<div v-if="visible" class="ld-designer">
<div class="ld-designer__bar">
<a-space :size="8" wrap>
<a-button @click="emit('back')">{{ $t('channel.labelDesign.actions.back') }}</a-button>
<a-input
v-model="form.name"
class="ld-name"
:placeholder="$t('channel.labelDesign.namePlaceholder')"
allow-clear
/>
<a-select v-model="form.templateType" class="ld-type">
<a-option v-for="opt in typeOptions" :key="opt.value" :value="opt.value">
{{ opt.label }}
</a-option>
</a-select>
</a-space>
<a-space :size="8">
<a-button :loading="previewing" @click="handleServerPreview">
{{ $t('channel.labelDesign.actions.preview') }}
</a-button>
<a-button @click="handlePrint">{{ $t('channel.labelDesign.actions.print') }}</a-button>
<a-button type="primary" :loading="saving" @click="handleSaveClick">
{{ $t('channel.labelDesign.actions.save') }}
</a-button>
</a-space>
</div>
<div class="ld-designer__body">
<aside class="ld-fields">
<div class="ld-fields__title">{{ $t('channel.labelDesign.fieldDictionary') }}</div>
<a-spin :loading="fieldsLoading" class="ld-fields__spin">
<div v-for="group in fieldGroups" :key="group.code" class="ld-fields__group">
<div class="ld-fields__group-title">{{ group.title }}</div>
<div class="ld-fields__chips">
<button
v-for="f in group.fields"
:key="f.field"
type="button"
class="ld-fields__chip"
:title="f.field"
@click="copyField(f.field)"
>
{{ f.title }}
</button>
</div>
</div>
</a-spin>
<div ref="omsEpContainerRef" class="ld-oms-ep hiprint-ep-oms" />
</aside>
<a-spin :loading="booting" class="ld-spin">
<FullDesigner
v-if="ready"
ref="designerRef"
default-lang="cn"
:hi-auto-connect="false"
:initial-template="initialTemplate"
@save="onDesignerSave"
>
<template #headerLeft></template>
<template #headerRight></template>
</FullDesigner>
</a-spin>
</div>
</div>
</template>
<script lang="ts" setup>
import { computed, nextTick, onMounted, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { Message } from '@arco-design/web-vue'
import { FullDesigner, hiprint } from 'vg-print'
import 'vg-print/style.css'
import {
getLabelFieldDictionary,
previewLabelTemplatePdf,
saveLabelTemplate,
type LabelFieldGroup,
} from '@/api/channel/labelTemplate'
const props = defineProps<{
visible: boolean
templateId?: number
name?: string
templateType?: string
templateJson?: unknown
}>()
const emit = defineEmits<{
(e: 'back'): void
(e: 'saved'): void
}>()
const { t } = useI18n()
const designerRef = ref<any>(null)
const omsEpContainerRef = ref<HTMLElement | null>(null)
const booting = ref(true)
const ready = ref(false)
const saving = ref(false)
const previewing = ref(false)
const fieldsLoading = ref(false)
const editingId = ref(0)
const fieldGroups = ref<LabelFieldGroup[]>([])
const form = reactive({
name: '',
templateType: 'lastMile',
})
const initialTemplate = ref<unknown>(undefined)
const typeOptions = computed(() => [
{ value: 'lastMile', label: t('operation.printLabel.labelTemplate.lastMile') },
{ value: 'customer', label: t('operation.printLabel.labelTemplate.customer') },
{ value: 'inbound', label: t('operation.printLabel.labelTemplate.inbound') },
{ value: 'outbound', label: t('operation.printLabel.labelTemplate.outbound') },
{ value: 'sku', label: t('operation.printLabel.labelTemplate.sku') },
])
let hiprintRegistered = false
function ensureHiprintAuth() {
if (hiprintRegistered) return
hiprint.register({
authKey: 'eyJrIjoiZ21jNTc2MDMzNyJ9',
})
hiprintRegistered = true
}
function createOmsFieldProvider(groups: LabelFieldGroup[]) {
return {
addElementTypes(context: any) {
context.removePrintElementTypes('omsLabelFields')
const typeGroups = groups.map(
(g) =>
new hiprint.PrintElementTypeGroup(
g.title,
g.fields.map((f) => ({
tid: `omsLabelFields.${f.field}`,
title: f.title,
type: 'text',
options: {
title: f.title,
field: f.field,
testData: f.field,
height: 16,
width: 120,
fontSize: 10,
hideTitle: true,
},
})),
),
)
context.addPrintElementTypes('omsLabelFields', typeGroups)
},
}
}
async function injectOmsFields(groups: LabelFieldGroup[]) {
if (!groups.length || !omsEpContainerRef.value) return
try {
const provider = createOmsFieldProvider(groups)
const manager = (hiprint as any).PrintElementTypeManager
if (!manager) return
provider.addElementTypes(manager)
omsEpContainerRef.value.innerHTML = ''
manager.build(omsEpContainerRef.value, 'omsLabelFields')
} catch {
// vg-print 版本差异时仍保留字段 chip 列表
}
}
async function loadFieldDictionary() {
fieldsLoading.value = true
try {
fieldGroups.value = await getLabelFieldDictionary()
} catch {
fieldGroups.value = []
} finally {
fieldsLoading.value = false
}
}
function copyField(field: string) {
navigator.clipboard?.writeText(field).then(
() => Message.success(t('channel.labelDesign.message.fieldCopied', { field })),
() => Message.info(field),
)
}
onMounted(async () => {
editingId.value = props.templateId || 0
form.name = props.name || `label-${Date.now()}`
form.templateType = props.templateType || 'lastMile'
initialTemplate.value = props.templateJson || undefined
ensureHiprintAuth()
await loadFieldDictionary()
await nextTick()
requestAnimationFrame(async () => {
ready.value = true
booting.value = false
await nextTick()
// FullDesigner init 之后再注入 OMS 字段面板
setTimeout(() => injectOmsFields(fieldGroups.value), 400)
})
})
function getTemplateJson(): unknown {
try {
return designerRef.value?.template?.getJson?.() ?? designerRef.value?.getJson?.()
} catch {
return undefined
}
}
async function handleServerPreview() {
const templateJson = getTemplateJson() ?? props.templateJson
if (!templateJson && !editingId.value) {
Message.warning(t('channel.labelDesign.message.previewEmpty'))
return
}
previewing.value = true
try {
const blob = await previewLabelTemplatePdf({
templateId: editingId.value || undefined,
templateJson: editingId.value ? undefined : templateJson,
})
const url = URL.createObjectURL(blob)
window.open(url, '_blank')
setTimeout(() => URL.revokeObjectURL(url), 60_000)
} catch (e: any) {
Message.error(e?.message || t('channel.labelDesign.message.previewFailed'))
} finally {
previewing.value = false
}
}
function handlePrint() {
designerRef.value?.printView?.()
}
function handleSaveClick() {
designerRef.value?.save?.()
}
async function onDesignerSave(payload: { template: unknown; data: unknown }) {
const name = form.name?.trim()
if (!name) {
Message.warning(t('channel.labelDesign.message.nameRequired'))
return
}
saving.value = true
try {
const saved = await saveLabelTemplate({
id: editingId.value || 0,
name,
templateType: form.templateType || 'lastMile',
templateJson: payload.template,
})
editingId.value = Number(saved?.id ?? saved?.Id ?? editingId.value) || editingId.value
Message.success(t('channel.labelDesign.message.saveSuccess'))
emit('saved')
} catch (e: any) {
Message.error(e?.message || t('channel.labelDesign.message.saveFailed'))
} finally {
saving.value = false
}
}
</script>
<style scoped lang="less">
.ld-designer {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
background: #fff;
border-radius: 8px;
overflow: hidden;
}
.ld-designer__bar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
padding: 10px 12px;
border-bottom: 1px solid #f2f3f5;
background: #fafbfc;
flex-shrink: 0;
}
.ld-name {
width: 220px;
}
.ld-type {
width: 140px;
}
.ld-designer__body {
flex: 1;
min-height: 0;
display: flex;
--vg-header-bg: var(--app-primary-color, rgb(var(--arcoblue-6)));
--vg-header-text: #fff;
}
.ld-fields {
width: 220px;
flex-shrink: 0;
border-right: 1px solid #f2f3f5;
background: #fafbfc;
padding: 10px 8px;
overflow: auto;
display: flex;
flex-direction: column;
gap: 10px;
}
.ld-fields__title {
font-size: 13px;
font-weight: 600;
color: #1d2129;
padding: 0 4px;
}
.ld-fields__spin {
width: 100%;
}
.ld-fields__group-title {
font-size: 12px;
color: #86909c;
margin: 8px 4px 6px;
}
.ld-fields__chips {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.ld-fields__chip {
border: 1px solid #e5e6eb;
background: #fff;
border-radius: 4px;
padding: 2px 8px;
font-size: 12px;
color: #4e5969;
cursor: pointer;
line-height: 22px;
}
.ld-fields__chip:hover {
border-color: var(--app-primary-color, rgb(var(--arcoblue-6)));
color: var(--app-primary-color, rgb(var(--arcoblue-6)));
}
.ld-oms-ep {
min-height: 40px;
}
.ld-spin {
flex: 1;
min-width: 0;
height: 100%;
min-height: 420px;
}
.ld-designer__body :deep(.header-left),
.ld-designer__body :deep(.btn-feedback) {
display: none !important;
}
.ld-designer__body :deep(.vg-print),
.ld-designer__body :deep(.full-designer),
.ld-designer__body :deep(.fullDesigner),
.ld-designer__body :deep(.designer-root) {
height: 100%;
min-height: 0;
}
</style>

View File

@ -1,103 +1,324 @@
<template>
<div class="labelDesign-container">
<div class="labelDesign-page-card">
<FullDesigner
ref="designerRef"
default-lang="cn"
:hi-auto-connect="false"
@save="onSave"
<!-- 默认:轻量列表,不加载 vg-print -->
<div v-show="!designerOpen" class="ld-list-card">
<div class="table-toolbar">
<div class="toolbar-left">
<a-space :size="8" wrap>
<a-input
v-model="keyword"
allow-clear
style="width: 200px"
:placeholder="$t('channel.labelDesign.searchPlaceholder')"
@press-enter="loadList"
/>
<a-select
v-model="filterType"
allow-clear
style="width: 140px"
:placeholder="$t('channel.labelDesign.typePlaceholder')"
@change="loadList"
>
<a-option v-for="opt in typeOptions" :key="opt.value" :value="opt.value">
{{ opt.label }}
</a-option>
</a-select>
<a-button type="primary" @click="loadList">
{{ $t('channel.labelDesign.actions.search') }}
</a-button>
<a-button type="primary" @click="openCreateModal">
{{ $t('channel.labelDesign.actions.create') }}
</a-button>
</a-space>
</div>
<div class="toolbar-right">
<span class="ld-count">{{ $t('channel.labelDesign.total', { n: rows.length }) }}</span>
</div>
</div>
<a-table
class="ld-table"
row-key="id"
:loading="loading"
:data="rows"
:pagination="false"
:bordered="false"
:scroll="{ y: '100%' }"
>
<!-- 覆盖默认左侧区域,隐藏 logo + 标题(插槽可能不生效,配合 CSS 隐藏 .header-left) -->
<template #headerLeft></template>
<!-- 覆盖默认右侧按钮区域,彻底隐藏“反馈”等按钮 -->
<template #headerRight></template>
</FullDesigner>
<template #columns>
<a-table-column
:title="$t('channel.labelDesign.table.name')"
data-index="name"
:width="220"
/>
<a-table-column
:title="$t('channel.labelDesign.table.type')"
data-index="templateType"
:width="140"
>
<template #cell="{ record }">
{{ typeLabel(record.templateType) }}
</template>
</a-table-column>
<a-table-column
:title="$t('channel.labelDesign.table.updateTime')"
data-index="updateTime"
:width="180"
>
<template #cell="{ record }">
{{ record.updateTime || record.createTime || '-' }}
</template>
</a-table-column>
<a-table-column
:title="$t('channel.labelDesign.table.actions')"
:width="200"
fixed="right"
>
<template #cell="{ record }">
<a-space :size="8">
<a-button type="text" @click="openEdit(record)">
{{ $t('channel.labelDesign.actions.edit') }}
</a-button>
<a-button type="text" status="danger" @click="handleDelete(record)">
{{ $t('channel.labelDesign.actions.delete') }}
</a-button>
</a-space>
</template>
</a-table-column>
</template>
</a-table>
</div>
<a-modal
v-model:visible="createModalVisible"
:title="$t('channel.labelDesign.actions.create')"
:ok-text="$t('channel.labelDesign.actions.startDesign')"
:cancel-text="$t('channel.labelDesign.actions.cancel')"
unmount-on-close
:on-before-ok="confirmCreate"
>
<a-form :model="createForm" layout="horizontal" :label-col-props="{ span: 6 }" :wrapper-col-props="{ span: 16 }">
<a-form-item
field="name"
:label="$t('channel.labelDesign.table.name')"
:rules="[{ required: true, message: $t('channel.labelDesign.message.nameRequired') }]"
>
<a-input
v-model="createForm.name"
allow-clear
:placeholder="$t('channel.labelDesign.namePlaceholder')"
/>
</a-form-item>
<a-form-item field="templateType" :label="$t('channel.labelDesign.table.type')">
<a-select v-model="createForm.templateType">
<a-option v-for="opt in typeOptions" :key="opt.value" :value="opt.value">
{{ opt.label }}
</a-option>
</a-select>
</a-form-item>
</a-form>
</a-modal>
<!-- 设计器:按需异步加载,返回列表后卸载以释放内存 -->
<LabelDesignerPanel
v-if="designerOpen"
:visible="true"
:template-id="editing.id"
:name="editing.name"
:template-type="editing.templateType"
:template-json="editing.templateJson"
@back="closeDesigner"
@saved="onSaved"
/>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { Message } from '@arco-design/web-vue';
import { FullDesigner, hiprint } from 'vg-print';
import 'vg-print/style.css';
import { saveLabelTemplate } from '@/api/channel/labelTemplate';
import dayjs from 'dayjs';
import { computed, defineAsyncComponent, onMounted, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { Modal, Message, Spin } from '@arco-design/web-vue'
import {
deleteLabelTemplate,
getLabelTemplate,
getLabelTemplateList,
type LabelTemplateListItem,
} from '@/api/channel/labelTemplate'
import { h } from 'vue'
defineOptions({ name: 'LabelDesign' });
defineOptions({ name: 'LabelDesign' })
// 仅在显式开启本地打印客户端时,才注册 hiprint(避免全站无意义的本地 WebSocket 连接)
const enableHiprintClient = import.meta.env.VITE_ENABLE_HIPRINT_CLIENT === 'true';
const { t } = useI18n()
// 模块级防重复注册
let hiprintRegistered = false;
const LabelDesignerPanel = defineAsyncComponent({
loader: () => import('./LabelDesignerPanel.vue'),
loadingComponent: {
setup() {
return () =>
h('div', { class: 'ld-async-loading' }, [h(Spin, { tip: t('channel.labelDesign.loadingDesigner') })])
},
},
delay: 80,
})
if (enableHiprintClient && !hiprintRegistered) {
hiprint.register({
authKey: 'eyJrIjoiZ21jNTc2MDMzNyJ9',
});
hiprintRegistered = true;
const loading = ref(false)
const keyword = ref('')
const filterType = ref<string | undefined>()
const rows = ref<LabelTemplateListItem[]>([])
const designerOpen = ref(false)
const createModalVisible = ref(false)
const createForm = reactive({
name: '',
templateType: 'lastMile',
})
const editing = reactive<{
id?: number
name?: string
templateType?: string
templateJson?: unknown
}>({})
const typeOptions = computed(() => [
{ value: 'lastMile', label: t('operation.printLabel.labelTemplate.lastMile') },
{ value: 'customer', label: t('operation.printLabel.labelTemplate.customer') },
{ value: 'inbound', label: t('operation.printLabel.labelTemplate.inbound') },
{ value: 'outbound', label: t('operation.printLabel.labelTemplate.outbound') },
{ value: 'sku', label: t('operation.printLabel.labelTemplate.sku') },
])
function typeLabel(type?: string) {
const hit = typeOptions.value.find((x) => x.value === type)
return hit?.label || type || '-'
}
const designerRef = ref<InstanceType<typeof FullDesigner> | null>(null);
async function onSave(payload: { template: unknown; data: unknown }) {
async function loadList() {
loading.value = true
try {
await saveLabelTemplate({
id: 0,
name: `label-${dayjs().format('YYYYMMDDHHmmss')}`,
templateType: 'lastMile',
templateJson: payload.template,
});
Message.success('模板已保存');
rows.value = await getLabelTemplateList({
keyword: keyword.value || undefined,
templateType: filterType.value || undefined,
})
} catch (e: any) {
Message.error(e?.message || '保存失败');
Message.error(e?.message || t('channel.labelDesign.message.loadFailed'))
rows.value = []
} finally {
loading.value = false
}
}
function openCreateModal() {
createForm.name = `label-${Date.now()}`
createForm.templateType = 'lastMile'
createModalVisible.value = true
}
function confirmCreate() {
const name = createForm.name?.trim()
if (!name) {
Message.warning(t('channel.labelDesign.message.nameRequired'))
return false
}
editing.id = undefined
editing.name = name
editing.templateType = createForm.templateType || 'lastMile'
editing.templateJson = undefined
designerOpen.value = true
return true
}
async function openEdit(row: LabelTemplateListItem) {
try {
const detail = await getLabelTemplate(row.id)
editing.id = detail.id
editing.name = detail.name
editing.templateType = detail.templateType || 'lastMile'
editing.templateJson = detail.templateJson
designerOpen.value = true
} catch (e: any) {
Message.error(e?.message || t('channel.labelDesign.message.loadFailed'))
}
}
function closeDesigner() {
designerOpen.value = false
}
async function onSaved() {
await loadList()
}
function handleDelete(row: LabelTemplateListItem) {
Modal.confirm({
title: t('channel.labelDesign.actions.delete'),
content: row.name,
onOk: async () => {
await deleteLabelTemplate(row.id)
Message.success(t('channel.labelDesign.message.deleteSuccess'))
await loadList()
},
})
}
onMounted(() => {
loadList()
})
</script>
<style scoped>
<style scoped lang="less">
.labelDesign-container {
padding: 16px 16px 24px;
background-color: #f0f3f4;
display: flex;
flex-direction: column;
padding: 16px;
background: #f0f3f4;
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.labelDesign-page-card {
.ld-list-card {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
background: #fff;
border-radius: 8px;
overflow: hidden;
/*
* vg-print 顶栏使用 --vg-header-text(默认白字)。原先把工具栏背景强制透明,
* 会叠在白色卡片上导致图标与文字不可见但仍可点击。
*/
--vg-header-bg: var(--app-primary-color, rgb(var(--arcoblue-6)));
--vg-header-text: #fff;
}
/* 隐藏 vg-print 顶部左侧 logo + 文本(打包代码中为 .header-left / .toolbar-logo / .toolbar-title) */
.labelDesign-page-card :deep(.header-left) {
display: none !important;
.table-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
flex-wrap: wrap;
padding: 12px 16px;
flex-shrink: 0;
}
/* 隐藏 vg-print 内置的反馈/帮助按钮(class: btn-feedback) */
.labelDesign-page-card :deep(.btn-feedback) {
display: none !important;
.toolbar-left,
.toolbar-right {
display: flex;
align-items: center;
}
/* 让 FullDesigner 在白卡片内纵向撑满 */
.labelDesign-page-card :deep(.vg-print),
.labelDesign-page-card :deep(.full-designer),
.labelDesign-page-card :deep(.fullDesigner),
.labelDesign-page-card :deep(.designer-root) {
height: 100%;
.ld-count {
font-size: 13px;
color: #86909c;
}
.ld-table {
flex: 1;
min-height: 0;
padding: 0 16px 16px;
}
:deep(.ld-async-loading) {
flex: 1;
min-height: 360px;
display: flex;
align-items: center;
justify-content: center;
background: #fff;
border-radius: 8px;
}
</style>

View File

@ -18,6 +18,7 @@
updateSalesProduct,
updateSalesProductPrice,
} from '@/api/channel/salesProduct';
import { getLabelTemplateList } from '@/api/channel/labelTemplate';
import { postForewarningServiceKpiAreaGetKpiAreas } from '@/api/channel/kpiArea';
import { getWarehouseList } from '@/api/system/warehouse';
import { postWeightRuleList } from '@/api/channel/weightRule';
@ -109,6 +110,7 @@
minTimeliness: '',
maxTimeliness: '',
customerWaybill: '系统面单',
labelTemplateId: undefined as number | undefined,
blacklistArea: '',
remoteAreaDivision: '',
priceArea: '',
@ -166,11 +168,20 @@
}
}
// 客户面单选项
const customerWaybillOptions = ref([
{ label: '系统面单', value: '系统面单' },
{ label: '客户面单', value: '客户面单' },
]);
// 客户面单:真实标签模板下拉
const labelTemplateOptions = ref<{ label: string; value: number }[]>([]);
async function loadLabelTemplateOptions() {
try {
const items = await getLabelTemplateList();
labelTemplateOptions.value = (items || []).map((it) => ({
label: it.name,
value: it.id,
}));
} catch {
labelTemplateOptions.value = [];
}
}
const weightFactorOptions: IdSelectOption[] = Array.from({ length: 20 }, (_, index) => {
const v = ((index + 1) * 0.5).toFixed(1).replace(/\.0$/, '');
@ -637,6 +648,7 @@
minTimeliness: '',
maxTimeliness: '',
customerWaybill: '系统面单',
labelTemplateId: undefined as number | undefined,
blacklistArea: '',
remoteAreaDivision: '',
priceArea: '',
@ -656,8 +668,10 @@
minTimeliness: '',
maxTimeliness: '',
customerWaybill: '系统面单',
labelTemplateId: undefined,
blacklistArea: '',
remoteAreaDivision: '',
priceArea: '',
weightCalculationRule: '',
weightRounding: '',
productDescription: '',
@ -684,6 +698,7 @@
minTimeliness: Number(addProductFormData.minTimeliness) || 0,
maxTimeliness: Number(addProductFormData.maxTimeliness) || 0,
customerWaybill: addProductFormData.customerWaybill || '系统面单',
labelTemplateId: addProductFormData.labelTemplateId || undefined,
productDescription: addProductFormData.productDescription || '',
preStorageScript: addProductFormData.preStorageScript || '',
isActive: 1,
@ -961,6 +976,11 @@
minTimeliness: numStr(p.minTimeliness ?? p.MinTimeliness),
maxTimeliness: numStr(p.maxTimeliness ?? p.MaxTimeliness),
customerWaybill: p.customerWaybill ?? p.CustomerWaybill ?? '系统面单',
labelTemplateId: (() => {
const raw = p.labelTemplateId ?? p.LabelTemplateId;
const n = Number(raw);
return Number.isFinite(n) && n > 0 ? n : undefined;
})(),
blacklistArea: numStr(p.blacklistAreaId ?? p.BlacklistAreaId),
remoteAreaDivision: numStr(p.remoteAreaId ?? p.RemoteAreaId),
priceArea: numStr(p.priceAreaId ?? p.PriceAreaId),
@ -982,6 +1002,7 @@
void loadKpiAreaSelectOptions();
void loadWeightSelectOptions();
void loadBillingFactorSelectOptions();
void loadLabelTemplateOptions();
loadProductList();
});
@ -1159,6 +1180,7 @@
minTimeliness: Number(formData.minTimeliness) || 0,
maxTimeliness: Number(formData.maxTimeliness) || 0,
customerWaybill: formData.customerWaybill,
labelTemplateId: formData.labelTemplateId || undefined,
blacklistAreaId: blAreaId ?? null,
remoteAreaId: rmAreaId ?? null,
priceAreaId: paAreaId ?? null,
@ -3068,11 +3090,14 @@
<div class="form-item">
<label class="form-label">{{ t('channel.salesProducts.form.customerWaybill') }}</label>
<a-select
v-model="formData.customerWaybill"
v-model="formData.labelTemplateId"
class="form-select"
allow-clear
allow-search
:placeholder="t('channel.salesProducts.form.placeholder.labelTemplate')"
>
<a-option
v-for="option in customerWaybillOptions"
v-for="option in labelTemplateOptions"
:key="option.value"
:value="option.value"
>
@ -3623,11 +3648,14 @@
<div class="form-item">
<label class="form-label">{{ t('channel.salesProducts.form.customerWaybill') }}</label>
<a-select
v-model="addProductFormData.customerWaybill"
v-model="addProductFormData.labelTemplateId"
class="form-select"
allow-clear
allow-search
:placeholder="t('channel.salesProducts.form.placeholder.labelTemplate')"
>
<a-option
v-for="option in customerWaybillOptions"
v-for="option in labelTemplateOptions"
:key="option.value"
:value="option.value"
>

View File

@ -1,152 +1,168 @@
<template>
<div class="waybill-container">
<div class="waybill-layout">
<!-- 表单区域 -->
<div class="form-section">
<div class="form-section-toolbar">
<a-checkbox v-model="keepScanFocus" size="small">
{{ $t('operation.common.keepScanFocus') }}
</a-checkbox>
<a-checkbox v-model="voiceEnabled" size="small">
{{ $t('operation.common.voiceBroadcast') }}
</a-checkbox>
</div>
<a-form :model="formData" layout="vertical" class="waybill-form">
<!-- 扫描单号 -->
<a-form-item :label="$t('operation.inbound.form.scanNumber')" class="form-item-large">
<a-input
ref="scanInputRef"
v-model="formData.waybillNumber"
:placeholder="$t('operation.inbound.form.placeholder.scanOrInput')"
size="large"
class="large-input"
@press-enter="() => void handleWaybillLookup()"
/>
</a-form-item>
<!-- 收货实重、长宽高、销售产品、目的国家 同一行 -->
<div class="form-row-inline">
<div class="form-row-fields">
<div class="inline-field">
<label class="inline-label">{{ $t('operation.inbound.form.receivedWeight') }}</label>
<div class="input-with-unit">
<a-input
v-model="formData.weight"
:placeholder="$t('operation.inbound.form.placeholder.input')"
class="weight-input"
/>
<span class="unit-text">KG</span>
</div>
</div>
<div class="inline-field">
<label class="inline-label">{{ $t('operation.inbound.form.dimensions') }}</label>
<div class="dimension-inputs">
<a-input
v-model="formData.length"
:placeholder="$t('operation.inbound.form.placeholder.length')"
class="dimension-input"
/>
<span class="separator">×</span>
<a-input
v-model="formData.width"
:placeholder="$t('operation.inbound.form.placeholder.width')"
class="dimension-input"
/>
<span class="separator">×</span>
<a-input
v-model="formData.height"
:placeholder="$t('operation.inbound.form.placeholder.height')"
class="dimension-input"
/>
</div>
</div>
<div class="inline-field">
<label class="inline-label">{{ $t('operation.inbound.form.salesProduct') }}</label>
<a-input
:model-value="formData.salesProductName"
readonly
:placeholder="$t('operation.inbound.form.placeholder.scanFirst')"
class="select-input-inline readonly-field"
/>
</div>
<div class="inline-field">
<label class="inline-label">{{ $t('operation.inbound.form.destinationCountry') }}</label>
<a-input
:model-value="formData.destinationCountryName"
readonly
:placeholder="$t('operation.inbound.form.placeholder.scanFirst')"
class="select-input-inline readonly-field"
/>
</div>
</div>
<div class="ops-page">
<div class="ops-col ops-col--main">
<!-- 卡片1:扫码 -->
<section class="ops-card ops-card--scan">
<div class="ops-card__head">
<span>{{ $t('operation.inbound.scan.title') }}</span>
</div>
<!-- 操作按钮 -->
<a-form-item>
<div class="form-actions">
<a-button class="reset-btn" @click="handleReset">{{ $t('operation.inbound.actions.reset') }}</a-button>
<a-button type="primary" class="submit-btn" :loading="submitting" @click="handleSubmit">{{ $t('operation.inbound.actions.inbound') }}</a-button>
<div class="ops-card__body ops-scan">
<div class="ops-scan__row">
<a-input
ref="scanInputRef"
v-model="formData.waybillNumber"
:placeholder="$t('operation.inbound.form.placeholder.scanOrInput')"
class="ops-scan-input"
allow-clear
@press-enter="onScanEnter"
@clear="clearLookup"
/>
</div>
</a-form-item>
</a-form>
</div>
<div class="ops-scan__row ops-scan__row--tools">
<div class="ops-scan__opts">
<a-checkbox v-model="keepScanFocus" class="ops-opt">
{{ $t('operation.common.keepScanFocus') }}
</a-checkbox>
<a-checkbox v-model="voiceEnabled" class="ops-opt">
{{ $t('operation.common.voiceBroadcast') }}
</a-checkbox>
</div>
<div class="ops-scan__actions">
<a-button class="ops-btn ops-btn--ghost" @click="handleReset()">
{{ $t('operation.inbound.actions.reset') }}
</a-button>
<a-button
type="primary"
class="ops-btn ops-btn--primary"
:loading="submitting || lookingUp"
@click="formData.orderId ? handleSubmit() : handleWaybillLookup()"
>
{{
formData.orderId
? $t('operation.inbound.actions.inbound')
: $t('operation.inbound.actions.lookup')
}}
</a-button>
</div>
</div>
<p class="ops-scan-hint">{{ $t('operation.inbound.form.hint.supportedTypes') }}</p>
</div>
</section>
<!-- 最近操作的订单 -->
<div class="recent-orders-section">
<div class="list-toolbar">
<div class="toolbar-left">
<!-- 卡片2:核对 -->
<section class="ops-card ops-card--verify">
<div class="ops-card__head">
<span>{{ $t('operation.inbound.preview.title') }}</span>
<p
v-if="feedbackMessage"
class="scan-feedback-text"
class="ops-feedback"
:class="`is-${feedbackType}`"
>
{{ feedbackMessage }}
</p>
</div>
<div class="toolbar-right">
<div class="pagination-controls">
<PaginationPro
:total-count="totalCount"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
<div class="ops-card__body ops-verify">
<a-spin :loading="lookingUp" class="ops-verify-spin">
<div v-if="formData.orderId" class="ops-panel">
<div class="ops-hero">
<div class="ops-hero__nos">
<div class="ops-hero__waybill">{{ formData.waybillNumber || '-' }}</div>
<div class="ops-hero__meta">
<span>{{ $t('operation.inbound.form.salesProduct') }} {{ formData.salesProductName || '-' }}</span>
<span>{{ $t('operation.inbound.form.destinationCountry') }} {{ formData.destinationCountryName || '-' }}</span>
</div>
</div>
</div>
<div class="ops-metrics">
<div class="ops-metric">
<label class="ops-metric__label">{{ $t('operation.inbound.form.receivedWeight') }}</label>
<div class="ops-metric__weight">
<a-input
v-model="formData.weight"
:placeholder="$t('operation.inbound.form.placeholder.input')"
class="ops-field"
@press-enter="handleSubmit"
/>
<span class="ops-unit">KG</span>
</div>
</div>
<div class="ops-metric ops-metric--dims">
<label class="ops-metric__label">{{ $t('operation.inbound.form.dimensions') }}</label>
<div class="ops-dims">
<a-input
v-model="formData.length"
:placeholder="$t('operation.inbound.form.placeholder.length')"
class="ops-field ops-field--dim"
@press-enter="handleSubmit"
/>
<span class="ops-dims__x">×</span>
<a-input
v-model="formData.width"
:placeholder="$t('operation.inbound.form.placeholder.width')"
class="ops-field ops-field--dim"
@press-enter="handleSubmit"
/>
<span class="ops-dims__x">×</span>
<a-input
v-model="formData.height"
:placeholder="$t('operation.inbound.form.placeholder.height')"
class="ops-field ops-field--dim"
@press-enter="handleSubmit"
/>
</div>
</div>
</div>
</div>
<div v-else class="ops-empty">
<p class="ops-empty__title">{{ $t('operation.inbound.preview.empty') }}</p>
<p class="ops-empty__tip">{{ $t('operation.inbound.tip') }}</p>
</div>
</a-spin>
</div>
</section>
</div>
<!-- 卡片3:最近记录 -->
<aside class="ops-card ops-card--recent">
<div class="ops-card__head">
<span>{{ $t('operation.inbound.recentOrders.title') }}</span>
<span class="ops-recent__count">{{ recentOrders.length }}</span>
</div>
<div class="ops-card__body ops-recent__list">
<div v-if="!recentOrders.length" class="ops-recent__empty">
{{ $t('operation.inbound.recentOrders.empty') }}
</div>
<div v-for="(row, idx) in recentOrders" :key="idx" class="ops-recent__row">
<div class="ops-recent__top">
<span class="ops-recent__no">{{ row.waybillNumber || '-' }}</span>
<span class="ops-recent__weight">{{ row.weight }} KG</span>
</div>
<div class="ops-recent__mid">
<span>{{ row.product }}</span>
<span>{{ row.country }}</span>
</div>
<div class="ops-recent__bottom">
<span>{{ row.dimensions }}</span>
<span class="ops-recent__time">{{ row.operateTime }}</span>
</div>
</div>
</div>
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
ref="handsontableRef"
:columns="hotColumns"
:data="displayedData"
:total="totalCount"
:current-page="currentPage"
:page-size="pageSize"
:height="tableHeight"
:read-only="true"
:stretch-columns="true"
/>
</div>
</div>
</div>
</aside>
</div>
</template>
<script lang="ts" setup>
import { useI18n } from 'vue-i18n';
import { ref, reactive, computed, onMounted } from 'vue';
import HandsontablePro from '@/components/HandsontablePro/index.vue';
import PaginationPro from '@/components/PaginationPro/index.vue';
import { useTableContainerHeight } from '@/composables/useTableContainerHeight';
import { useOperationScanFocus } from '@/composables/useOperationScanFocus';
import { useOperationScanFeedback } from '@/composables/useOperationScanFeedback';
import { inboundCreate, inboundRecentList, inboundOrderLookup } from '@/api/operation';
import { useI18n } from 'vue-i18n'
import { ref, reactive, onMounted } from 'vue'
import { useOperationScanFocus } from '@/composables/useOperationScanFocus'
import { useOperationScanFeedback } from '@/composables/useOperationScanFeedback'
import { inboundCreate, inboundRecentList, inboundOrderLookup } from '@/api/operation'
const { t } = useI18n();
const { tableContainerRef, tableHeight } = useTableContainerHeight();
const scanInputRef = ref<{ focus?: () => void } | null>(null);
const { keepScanFocus, maybeRefocusScan } = useOperationScanFocus('inboundScan', scanInputRef);
const { t } = useI18n()
const scanInputRef = ref<{ focus?: () => void } | null>(null)
const { keepScanFocus, maybeRefocusScan } = useOperationScanFocus('inboundScan', scanInputRef)
const {
voiceEnabled,
feedbackType,
@ -155,15 +171,13 @@ const {
showError,
showSuccess,
showWarning,
} = useOperationScanFeedback('inboundScan');
} = useOperationScanFeedback('inboundScan')
defineOptions({
name: 'InboundScan',
});
defineOptions({ name: 'InboundScan' })
const submitting = ref(false);
const submitting = ref(false)
const lookingUp = ref(false)
// 表单数据
const formData = reactive({
waybillNumber: '',
weight: '',
@ -173,35 +187,13 @@ const formData = reactive({
salesProductName: '',
destinationCountryName: '',
orderId: undefined as number | undefined,
});
})
// HandsontablePro 列定义(序号由组件内部生成)
const hotColumns = computed(() => [
{ key: 'waybillNumber', label: t('operation.inbound.table.waybillNumber'), width: 180 },
{ key: 'weight', label: t('operation.inbound.table.weight'), width: 100 },
{ key: 'dimensions', label: t('operation.inbound.table.dimensions'), width: 150 },
{ key: 'product', label: t('operation.inbound.table.product'), width: 120 },
{ key: 'country', label: t('operation.inbound.table.country'), width: 120 },
{ key: 'warehouse', label: t('operation.inbound.table.warehouse'), width: 100 },
{ key: 'operateTime', label: t('operation.inbound.table.operateTime'), width: 180 },
{ key: 'operator', label: t('operation.inbound.table.operator'), width: 100 },
]);
const recentOrders = ref<any[]>([]);
const handsontableRef = ref<InstanceType<typeof HandsontablePro>>();
const currentPage = ref(1);
const pageSize = ref(50);
const totalCount = computed(() => recentOrders.value.length);
const displayedData = computed(() => {
const start = (currentPage.value - 1) * pageSize.value;
return recentOrders.value.slice(start, start + pageSize.value);
});
const recentOrders = ref<any[]>([])
async function loadRecent() {
try {
const { items } = await inboundRecentList({ limit: 200 });
const { items } = await inboundRecentList({ limit: 50 })
recentOrders.value = (items || []).map((row: any) => ({
waybillNumber: row.waybillNo ?? row.waybillNumber ?? '',
weight: row.weight != null ? String(row.weight) : '-',
@ -214,68 +206,79 @@ async function loadRecent() {
warehouse: row.warehouseName ?? '-',
operateTime: row.operateTime ?? row.createTime ?? '',
operator: row.operatorName ?? row.operator ?? '-',
}));
}))
} catch (e: any) {
showError(e?.message || t('operation.inbound.message.loadRecentFailed'));
recentOrders.value = [];
showError(e?.message || t('operation.inbound.message.loadRecentFailed'))
recentOrders.value = []
}
}
function handlePageChange(page: number) {
currentPage.value = page;
function clearLookupFields() {
formData.salesProductName = ''
formData.destinationCountryName = ''
formData.orderId = undefined
formData.weight = ''
formData.length = ''
formData.width = ''
formData.height = ''
}
function handlePageSizeChange(size: number) {
pageSize.value = size;
currentPage.value = 1;
function clearLookup() {
clearLookupFields()
clearFeedback()
}
async function handleWaybillLookup() {
const no = formData.waybillNumber?.trim();
const no = formData.waybillNumber?.trim()
if (!no) {
formData.salesProductName = '';
formData.destinationCountryName = '';
formData.orderId = undefined;
clearFeedback();
return;
clearLookup()
return
}
lookingUp.value = true
try {
const info = await inboundOrderLookup(no);
const info = await inboundOrderLookup(no)
if (!info?.orderId) {
throw new Error(t('operation.common.message.orderNotFound'));
throw new Error(t('operation.common.message.orderNotFound'))
}
formData.orderId = info.orderId;
formData.salesProductName = info.salesProductName || info.productCode || '';
formData.orderId = info.orderId
formData.salesProductName = info.salesProductName || info.productCode || ''
formData.destinationCountryName =
info.destinationCountryName || info.destinationCountry || '';
showSuccess(t('operation.common.message.lookupSuccess'));
info.destinationCountryName || info.destinationCountry || ''
showSuccess(t('operation.common.message.lookupSuccess'))
} catch (e: any) {
formData.salesProductName = '';
formData.destinationCountryName = '';
formData.orderId = undefined;
showError(e?.message || t('operation.common.message.orderNotFound'));
maybeRefocusScan();
formData.salesProductName = ''
formData.destinationCountryName = ''
formData.orderId = undefined
showError(e?.message || t('operation.common.message.orderNotFound'))
maybeRefocusScan()
} finally {
lookingUp.value = false
}
}
async function onScanEnter() {
if (formData.orderId && formData.waybillNumber?.trim()) {
await handleSubmit()
return
}
await handleWaybillLookup()
}
async function handleSubmit() {
if (!formData.waybillNumber?.trim()) {
showWarning(t('operation.inbound.message.waybillNumberRequired'));
maybeRefocusScan();
return;
showWarning(t('operation.inbound.message.waybillNumberRequired'))
maybeRefocusScan()
return
}
if (!formData.orderId) {
await handleWaybillLookup();
if (!formData.orderId) {
return;
}
await handleWaybillLookup()
if (!formData.orderId) return
}
if (!formData.weight || !formData.length || !formData.width || !formData.height) {
showWarning(t('operation.inbound.message.metricsRequired'));
maybeRefocusScan();
return;
showWarning(t('operation.inbound.message.metricsRequired'))
return
}
submitting.value = true;
submitting.value = true
try {
await inboundCreate({
waybillNo: formData.waybillNumber.trim(),
@ -283,271 +286,31 @@ async function handleSubmit() {
length: Number(formData.length),
width: Number(formData.width),
height: Number(formData.height),
});
showSuccess(t('operation.inbound.message.inboundSuccess'));
handleReset(false);
await loadRecent();
maybeRefocusScan();
})
showSuccess(t('operation.inbound.message.inboundSuccess'))
handleReset(false)
await loadRecent()
maybeRefocusScan()
} catch (e: any) {
showError(e?.message || t('operation.inbound.message.inboundFailed'));
maybeRefocusScan();
showError(e?.message || t('operation.inbound.message.inboundFailed'))
maybeRefocusScan()
} finally {
submitting.value = false;
submitting.value = false
}
}
// 重置表单
function handleReset(clearStatus = true) {
formData.waybillNumber = '';
formData.weight = '';
formData.length = '';
formData.width = '';
formData.height = '';
formData.salesProductName = '';
formData.destinationCountryName = '';
formData.orderId = undefined;
if (clearStatus) {
clearFeedback();
}
maybeRefocusScan();
formData.waybillNumber = ''
clearLookupFields()
if (clearStatus) clearFeedback()
maybeRefocusScan()
}
onMounted(() => {
loadRecent();
});
loadRecent()
})
</script>
<style lang="less" scoped>
.waybill-container {
padding: 24px;
background-color: #f5f5f5;
flex: 1;
min-height: 0;
overflow: hidden;
display: flex;
flex-direction: column;
}
.waybill-layout {
display: flex;
flex-direction: row;
align-items: stretch;
gap: 16px;
flex: 1;
min-height: 0;
min-width: 0;
}
.form-section {
background: #fff;
border-radius: 8px;
padding: 24px;
margin-bottom: 0;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
flex: 3 1 0;
min-width: 0;
overflow-x: hidden;
overflow-y: auto;
align-self: stretch;
}
.form-section-toolbar {
display: flex;
justify-content: flex-end;
align-items: center;
gap: 16px;
margin: -4px 0 12px;
flex-shrink: 0;
}
.waybill-form {
.form-item-large {
:deep(.arco-form-item-label) {
font-size: 14px;
font-weight: 500;
color: #262626;
}
}
.large-input {
width: 100%;
max-width: 100%;
height: 48px;
font-size: 16px;
}
.input-with-unit {
display: flex;
align-items: center;
gap: 8px;
.weight-input {
flex: 1;
}
.unit-text {
font-size: 14px;
color: #595959;
min-width: 30px;
}
}
.form-row-inline {
margin-bottom: 16px;
}
.form-row-fields {
display: flex;
align-items: flex-end;
gap: 16px;
flex-wrap: wrap;
}
.inline-field {
flex: 1 1 100%;
min-width: 0;
.inline-label {
display: block;
font-size: 14px;
font-weight: 500;
color: #262626;
margin-bottom: 8px;
}
}
.dimension-inputs {
display: flex;
align-items: center;
gap: 6px;
.dimension-input {
width: 100px;
min-width: 100px;
}
.separator {
font-size: 14px;
color: #595959;
padding: 0 2px;
}
}
.select-input-inline {
width: 100%;
min-width: 120px;
}
.readonly-field {
:deep(.arco-input) {
background-color: #f7f8fa;
color: #4e5969;
cursor: default;
}
}
.form-actions {
display: flex;
gap: 16px;
margin-top: 8px;
.reset-btn {
min-width: 100px;
}
.submit-btn {
min-width: 100px;
}
}
}
.recent-orders-section {
background: #fff;
border-radius: 8px;
padding: 0;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
flex: 7 1 0;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
.list-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 16px 0;
margin-bottom: 16px;
flex-shrink: 0;
flex-wrap: nowrap;
gap: 12px;
.toolbar-left {
flex: 1;
min-width: 0;
}
.scan-feedback-text {
margin: 0;
font-size: 16px;
line-height: 1.5;
word-break: break-word;
&.is-error {
color: #f53f3f;
font-weight: 700;
}
&.is-success {
color: #00b42a;
font-weight: 600;
}
&.is-warning {
color: #d46b08;
font-weight: 600;
}
}
.toolbar-right .pagination-controls {
display: flex;
align-items: center;
gap: 8px;
white-space: nowrap;
flex-wrap: nowrap;
}
}
.list-wrap {
width: 100%;
flex: 1;
min-height: 0;
padding: 0 16px 16px;
box-sizing: border-box;
display: flex;
flex-direction: column;
overflow: hidden;
overscroll-behavior: contain;
touch-action: pan-x pan-y;
}
}
@media (max-width: 992px) {
.waybill-layout {
flex-direction: column;
overflow-y: auto;
}
.form-section {
flex: 0 0 auto;
max-width: none;
width: 100%;
min-width: 0;
}
.recent-orders-section {
flex: 1;
min-height: 360px;
}
}
@import '@/views/operation/styles/ops-scan-page.less';
</style>

View File

@ -1,161 +1,166 @@
<template>
<div class="waybill-container">
<div class="waybill-layout">
<!-- 表单区域 -->
<div class="form-section">
<div class="form-section-toolbar">
<a-checkbox v-model="keepScanFocus" size="small">
{{ $t('operation.common.keepScanFocus') }}
</a-checkbox>
<a-checkbox v-model="voiceEnabled" size="small">
{{ $t('operation.common.voiceBroadcast') }}
</a-checkbox>
</div>
<a-form :model="formData" layout="vertical" class="waybill-form">
<!-- 扫描单号 -->
<a-form-item :label="$t('operation.outbound.form.scanNumber')" class="form-item-large">
<a-input
ref="scanInputRef"
v-model="formData.waybillNumber"
:placeholder="$t('operation.outbound.form.placeholder.scanOrInput')"
size="large"
class="large-input"
@press-enter="() => void handleWaybillLookup()"
/>
</a-form-item>
<!-- 发货实重、长宽高、销售产品、目的国家(与入库扫描表单结构一致) -->
<div class="form-row-inline">
<div class="form-row-fields">
<div class="inline-field">
<label class="inline-label">{{ $t('operation.outbound.form.shipWeight') }}</label>
<div class="input-with-unit">
<a-input
v-model="formData.weight"
:placeholder="$t('operation.outbound.form.placeholder.input')"
class="weight-input"
/>
<span class="unit-text">KG</span>
</div>
</div>
<div class="inline-field">
<label class="inline-label">{{ $t('operation.outbound.form.dimensions') }}</label>
<div class="dimension-inputs">
<a-input
v-model="formData.length"
:placeholder="$t('operation.outbound.form.placeholder.length')"
class="dimension-input"
/>
<span class="separator">×</span>
<a-input
v-model="formData.width"
:placeholder="$t('operation.outbound.form.placeholder.width')"
class="dimension-input"
/>
<span class="separator">×</span>
<a-input
v-model="formData.height"
:placeholder="$t('operation.outbound.form.placeholder.height')"
class="dimension-input"
/>
</div>
</div>
<div class="inline-field">
<label class="inline-label">{{ $t('operation.outbound.form.salesProduct') }}</label>
<a-input
:model-value="formData.salesProductName"
readonly
:placeholder="$t('operation.outbound.form.placeholder.scanFirst')"
class="select-input-inline readonly-field"
/>
</div>
<div class="inline-field">
<label class="inline-label">{{ $t('operation.outbound.form.destinationCountry') }}</label>
<a-input
:model-value="formData.destinationCountryName"
readonly
:placeholder="$t('operation.outbound.form.placeholder.scanFirst')"
class="select-input-inline readonly-field"
/>
</div>
<div class="inline-field">
<label class="inline-label">{{ $t('operation.outbound.form.serviceChannel') }}</label>
<a-input
:model-value="formData.serviceChannelName"
readonly
:placeholder="$t('operation.outbound.form.placeholder.scanFirst')"
class="select-input-inline readonly-field"
/>
</div>
</div>
<div class="ops-page">
<div class="ops-col ops-col--main">
<section class="ops-card ops-card--scan">
<div class="ops-card__head">
<span>{{ $t('operation.outbound.scan.title') }}</span>
</div>
<!-- 操作按钮 -->
<a-form-item>
<div class="form-actions">
<a-button class="reset-btn" @click="handleReset">{{ $t('operation.outbound.actions.reset') }}</a-button>
<a-button type="primary" class="submit-btn" :loading="submitting" @click="handleSubmit">{{ $t('operation.outbound.actions.outbound') }}</a-button>
<div class="ops-card__body ops-scan">
<div class="ops-scan__row">
<a-input
ref="scanInputRef"
v-model="formData.waybillNumber"
:placeholder="$t('operation.outbound.form.placeholder.scanOrInput')"
class="ops-scan-input"
allow-clear
@press-enter="onScanEnter"
@clear="clearLookup"
/>
</div>
</a-form-item>
</a-form>
</div>
<div class="ops-scan__row ops-scan__row--tools">
<div class="ops-scan__opts">
<a-checkbox v-model="keepScanFocus" class="ops-opt">
{{ $t('operation.common.keepScanFocus') }}
</a-checkbox>
<a-checkbox v-model="voiceEnabled" class="ops-opt">
{{ $t('operation.common.voiceBroadcast') }}
</a-checkbox>
</div>
<div class="ops-scan__actions">
<a-button class="ops-btn ops-btn--ghost" @click="handleReset()">
{{ $t('operation.outbound.actions.reset') }}
</a-button>
<a-button
type="primary"
class="ops-btn ops-btn--primary"
:loading="submitting || lookingUp"
@click="formData.orderId ? handleSubmit() : handleWaybillLookup()"
>
{{
formData.orderId
? $t('operation.outbound.actions.outbound')
: $t('operation.outbound.actions.lookup')
}}
</a-button>
</div>
</div>
<p class="ops-scan-hint">{{ $t('operation.outbound.form.hint.supportedTypes') }}</p>
</div>
</section>
<!-- 最近操作的订单 -->
<div class="recent-orders-section">
<div class="list-toolbar">
<div class="toolbar-left">
<section class="ops-card ops-card--verify">
<div class="ops-card__head">
<span>{{ $t('operation.outbound.preview.title') }}</span>
<p
v-if="feedbackMessage"
class="scan-feedback-text"
class="ops-feedback"
:class="`is-${feedbackType}`"
>
{{ feedbackMessage }}
</p>
</div>
<div class="toolbar-right">
<div class="pagination-controls">
<PaginationPro
:total-count="totalCount"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
<div class="ops-card__body ops-verify">
<a-spin :loading="lookingUp" class="ops-verify-spin">
<div v-if="formData.orderId" class="ops-panel">
<div class="ops-hero">
<div class="ops-hero__nos">
<div class="ops-hero__waybill">{{ formData.waybillNumber || '-' }}</div>
<div class="ops-hero__meta">
<span>{{ $t('operation.outbound.form.salesProduct') }} {{ formData.salesProductName || '-' }}</span>
<span>{{ $t('operation.outbound.form.destinationCountry') }} {{ formData.destinationCountryName || '-' }}</span>
<span>{{ $t('operation.outbound.form.serviceChannel') }} {{ formData.serviceChannelName || '-' }}</span>
</div>
</div>
</div>
<div class="ops-metrics">
<div class="ops-metric">
<label class="ops-metric__label">{{ $t('operation.outbound.form.shipWeight') }}</label>
<div class="ops-metric__weight">
<a-input
v-model="formData.weight"
:placeholder="$t('operation.outbound.form.placeholder.input')"
class="ops-field"
@press-enter="handleSubmit"
/>
<span class="ops-unit">KG</span>
</div>
</div>
<div class="ops-metric ops-metric--dims">
<label class="ops-metric__label">{{ $t('operation.outbound.form.dimensions') }}</label>
<div class="ops-dims">
<a-input
v-model="formData.length"
:placeholder="$t('operation.outbound.form.placeholder.length')"
class="ops-field ops-field--dim"
@press-enter="handleSubmit"
/>
<span class="ops-dims__x">×</span>
<a-input
v-model="formData.width"
:placeholder="$t('operation.outbound.form.placeholder.width')"
class="ops-field ops-field--dim"
@press-enter="handleSubmit"
/>
<span class="ops-dims__x">×</span>
<a-input
v-model="formData.height"
:placeholder="$t('operation.outbound.form.placeholder.height')"
class="ops-field ops-field--dim"
@press-enter="handleSubmit"
/>
</div>
</div>
</div>
</div>
<div v-else class="ops-empty">
<p class="ops-empty__title">{{ $t('operation.outbound.preview.empty') }}</p>
<p class="ops-empty__tip">{{ $t('operation.outbound.tip') }}</p>
</div>
</a-spin>
</div>
</section>
</div>
<aside class="ops-card ops-card--recent">
<div class="ops-card__head">
<span>{{ $t('operation.outbound.recentOrders.title') }}</span>
<span class="ops-recent__count">{{ recentOrders.length }}</span>
</div>
<div class="ops-card__body ops-recent__list">
<div v-if="!recentOrders.length" class="ops-recent__empty">
{{ $t('operation.outbound.recentOrders.empty') }}
</div>
<div v-for="(row, idx) in recentOrders" :key="idx" class="ops-recent__row">
<div class="ops-recent__top">
<span class="ops-recent__no">{{ row.waybillNumber || '-' }}</span>
<span class="ops-recent__weight">{{ row.weight }} KG</span>
</div>
<div class="ops-recent__mid">
<span>{{ row.product }}</span>
<span>{{ row.country }}</span>
</div>
<div class="ops-recent__bottom">
<span>{{ row.serviceChannel }}</span>
<span class="ops-recent__time">{{ row.operateTime }}</span>
</div>
</div>
</div>
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
ref="handsontableRef"
:columns="hotColumns"
:data="displayedData"
:total="totalCount"
:current-page="currentPage"
:page-size="pageSize"
:height="tableHeight"
:read-only="true"
:stretch-columns="true"
/>
</div>
</div>
</div>
</aside>
</div>
</template>
<script lang="ts" setup>
import { useI18n } from 'vue-i18n';
import { ref, reactive, computed, onMounted } from 'vue';
import HandsontablePro from '@/components/HandsontablePro/index.vue';
import PaginationPro from '@/components/PaginationPro/index.vue';
import { useTableContainerHeight } from '@/composables/useTableContainerHeight';
import { useOperationScanFocus } from '@/composables/useOperationScanFocus';
import { useOperationScanFeedback } from '@/composables/useOperationScanFeedback';
import { outboundCreate, outboundRecentList, outboundOrderLookup } from '@/api/operation';
import { useI18n } from 'vue-i18n'
import { ref, reactive, onMounted } from 'vue'
import { useOperationScanFocus } from '@/composables/useOperationScanFocus'
import { useOperationScanFeedback } from '@/composables/useOperationScanFeedback'
import { outboundCreate, outboundRecentList, outboundOrderLookup } from '@/api/operation'
const { t } = useI18n();
const { tableContainerRef, tableHeight } = useTableContainerHeight();
const scanInputRef = ref<{ focus?: () => void } | null>(null);
const { keepScanFocus, maybeRefocusScan } = useOperationScanFocus('outboundScan', scanInputRef);
const { t } = useI18n()
const scanInputRef = ref<{ focus?: () => void } | null>(null)
const { keepScanFocus, maybeRefocusScan } = useOperationScanFocus('outboundScan', scanInputRef)
const {
voiceEnabled,
feedbackType,
@ -164,15 +169,13 @@ const {
showError,
showSuccess,
showWarning,
} = useOperationScanFeedback('outboundScan');
} = useOperationScanFeedback('outboundScan')
defineOptions({
name: 'OutboundScan',
});
defineOptions({ name: 'OutboundScan' })
const submitting = ref(false);
const submitting = ref(false)
const lookingUp = ref(false)
// 表单数据
const formData = reactive({
waybillNumber: '',
weight: '',
@ -183,68 +186,13 @@ const formData = reactive({
destinationCountryName: '',
serviceChannelName: '',
orderId: undefined as number | undefined,
});
})
// HandsontablePro 列定义(序号由组件内部生成)
const hotColumns = computed(() => [
{ key: 'waybillNumber', label: t('operation.outbound.table.waybillNumber'), width: 180 },
{ key: 'weight', label: t('operation.outbound.table.weight'), width: 100 },
{ key: 'dimensions', label: t('operation.outbound.table.dimensions'), width: 150 },
{ key: 'product', label: t('operation.outbound.table.product'), width: 120 },
{ key: 'country', label: t('operation.outbound.table.country'), width: 120 },
{ key: 'serviceChannel', label: t('operation.outbound.table.serviceChannel'), width: 160 },
{ key: 'warehouse', label: t('operation.outbound.table.warehouse'), width: 100 },
{ key: 'operateTime', label: t('operation.outbound.table.operateTime'), width: 180 },
{ key: 'operator', label: t('operation.outbound.table.operator'), width: 100 },
]);
const recentOrders = ref<any[]>([]);
const handsontableRef = ref<InstanceType<typeof HandsontablePro>>();
const currentPage = ref(1);
const pageSize = ref(50);
const totalCount = computed(() => recentOrders.value.length);
const displayedData = computed(() => {
const start = (currentPage.value - 1) * pageSize.value;
return recentOrders.value.slice(start, start + pageSize.value);
});
async function handleWaybillLookup() {
const no = formData.waybillNumber?.trim();
if (!no) {
formData.salesProductName = '';
formData.destinationCountryName = '';
formData.serviceChannelName = '';
formData.orderId = undefined;
clearFeedback();
return;
}
try {
const info = await outboundOrderLookup(no);
if (!info?.orderId) {
throw new Error(t('operation.common.message.orderNotFound'));
}
formData.orderId = info.orderId;
formData.salesProductName = info.salesProductName || info.productCode || '';
formData.destinationCountryName =
info.destinationCountryName || info.destinationCountry || '';
formData.serviceChannelName =
info.serviceChannelName || info.channelCode || '';
showSuccess(t('operation.common.message.lookupSuccess'));
} catch (e: any) {
formData.salesProductName = '';
formData.destinationCountryName = '';
formData.serviceChannelName = '';
formData.orderId = undefined;
showError(e?.message || t('operation.common.message.orderNotFound'));
maybeRefocusScan();
}
}
const recentOrders = ref<any[]>([])
async function loadRecent() {
try {
const { items } = await outboundRecentList({ limit: 200 });
const { items } = await outboundRecentList({ limit: 50 })
recentOrders.value = (items || []).map((row: any) => ({
waybillNumber: row.waybillNo ?? row.waybillNumber ?? '',
weight: row.weight != null ? String(row.weight) : '-',
@ -254,39 +202,85 @@ async function loadRecent() {
: '-',
product: row.salesProductName ?? '-',
country: row.destinationCountry ?? '-',
serviceChannel: row.serviceChannelName != null && String(row.serviceChannelName).trim() !== '' ? row.serviceChannelName : '-',
serviceChannel:
row.serviceChannelName != null && String(row.serviceChannelName).trim() !== ''
? row.serviceChannelName
: '-',
warehouse: row.warehouseName ?? row.warehouse ?? '-',
operateTime: row.operateTime ?? row.createTime ?? '',
operator: row.operatorName ?? row.operator ?? '-',
}));
}))
} catch (e: any) {
showError(e?.message || t('operation.outbound.message.loadRecentFailed'));
recentOrders.value = [];
showError(e?.message || t('operation.outbound.message.loadRecentFailed'))
recentOrders.value = []
}
}
function handlePageChange(page: number) {
currentPage.value = page;
function clearLookupFields() {
formData.salesProductName = ''
formData.destinationCountryName = ''
formData.serviceChannelName = ''
formData.orderId = undefined
formData.weight = ''
formData.length = ''
formData.width = ''
formData.height = ''
}
function handlePageSizeChange(size: number) {
pageSize.value = size;
currentPage.value = 1;
function clearLookup() {
clearLookupFields()
clearFeedback()
}
async function handleWaybillLookup() {
const no = formData.waybillNumber?.trim()
if (!no) {
clearLookup()
return
}
lookingUp.value = true
try {
const info = await outboundOrderLookup(no)
if (!info?.orderId) {
throw new Error(t('operation.common.message.orderNotFound'))
}
formData.orderId = info.orderId
formData.salesProductName = info.salesProductName || info.productCode || ''
formData.destinationCountryName =
info.destinationCountryName || info.destinationCountry || ''
formData.serviceChannelName = info.serviceChannelName || info.channelCode || ''
showSuccess(t('operation.common.message.lookupSuccess'))
} catch (e: any) {
formData.salesProductName = ''
formData.destinationCountryName = ''
formData.serviceChannelName = ''
formData.orderId = undefined
showError(e?.message || t('operation.common.message.orderNotFound'))
maybeRefocusScan()
} finally {
lookingUp.value = false
}
}
async function onScanEnter() {
if (formData.orderId && formData.waybillNumber?.trim()) {
await handleSubmit()
return
}
await handleWaybillLookup()
}
async function handleSubmit() {
if (!formData.waybillNumber?.trim()) {
showWarning(t('operation.outbound.message.waybillNumberRequired'));
maybeRefocusScan();
return;
showWarning(t('operation.outbound.message.waybillNumberRequired'))
maybeRefocusScan()
return
}
if (!formData.orderId) {
await handleWaybillLookup();
if (!formData.orderId) {
return;
}
await handleWaybillLookup()
if (!formData.orderId) return
}
submitting.value = true;
submitting.value = true
try {
await outboundCreate({
waybillNo: formData.waybillNumber.trim(),
@ -294,272 +288,31 @@ async function handleSubmit() {
length: formData.length ? Number(formData.length) : undefined,
width: formData.width ? Number(formData.width) : undefined,
height: formData.height ? Number(formData.height) : undefined,
});
showSuccess(t('operation.outbound.message.outboundSuccess'));
handleReset(false);
await loadRecent();
maybeRefocusScan();
})
showSuccess(t('operation.outbound.message.outboundSuccess'))
handleReset(false)
await loadRecent()
maybeRefocusScan()
} catch (e: any) {
showError(e?.message || t('operation.outbound.message.outboundFailed'));
maybeRefocusScan();
showError(e?.message || t('operation.outbound.message.outboundFailed'))
maybeRefocusScan()
} finally {
submitting.value = false;
submitting.value = false
}
}
// 重置表单
function handleReset(clearStatus = true) {
formData.waybillNumber = '';
formData.weight = '';
formData.length = '';
formData.width = '';
formData.height = '';
formData.salesProductName = '';
formData.destinationCountryName = '';
formData.serviceChannelName = '';
formData.orderId = undefined;
if (clearStatus) {
clearFeedback();
}
maybeRefocusScan();
formData.waybillNumber = ''
clearLookupFields()
if (clearStatus) clearFeedback()
maybeRefocusScan()
}
onMounted(() => {
loadRecent();
});
loadRecent()
})
</script>
<style lang="less" scoped>
.waybill-container {
padding: 24px;
background-color: #f5f5f5;
flex: 1;
min-height: 0;
overflow: hidden;
display: flex;
flex-direction: column;
}
.waybill-layout {
display: flex;
flex-direction: row;
align-items: stretch;
gap: 16px;
flex: 1;
min-height: 0;
min-width: 0;
}
.form-section {
background: #fff;
border-radius: 8px;
padding: 24px;
margin-bottom: 0;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
flex: 3 1 0;
min-width: 0;
overflow-x: hidden;
overflow-y: auto;
align-self: stretch;
}
.form-section-toolbar {
display: flex;
justify-content: flex-end;
align-items: center;
gap: 16px;
margin: -4px 0 12px;
flex-shrink: 0;
}
.waybill-form {
.form-item-large {
:deep(.arco-form-item-label) {
font-size: 14px;
font-weight: 500;
color: #262626;
}
}
.large-input {
width: 100%;
max-width: 100%;
height: 48px;
font-size: 16px;
}
.input-with-unit {
display: flex;
align-items: center;
gap: 8px;
.weight-input {
flex: 1;
}
.unit-text {
font-size: 14px;
color: #595959;
min-width: 30px;
}
}
.form-row-inline {
margin-bottom: 16px;
}
.form-row-fields {
display: flex;
align-items: flex-end;
gap: 16px;
flex-wrap: wrap;
}
.inline-field {
flex: 1 1 100%;
min-width: 0;
.inline-label {
display: block;
font-size: 14px;
font-weight: 500;
color: #262626;
margin-bottom: 8px;
}
}
.dimension-inputs {
display: flex;
align-items: center;
gap: 6px;
.dimension-input {
width: 100px;
min-width: 100px;
}
.separator {
font-size: 14px;
color: #595959;
padding: 0 2px;
}
}
.select-input-inline {
width: 100%;
min-width: 120px;
}
.readonly-field {
:deep(.arco-input) {
background-color: #f7f8fa;
color: #4e5969;
cursor: default;
}
}
.form-actions {
display: flex;
gap: 16px;
margin-top: 8px;
.reset-btn {
min-width: 100px;
}
.submit-btn {
min-width: 100px;
}
}
}
.recent-orders-section {
background: #fff;
border-radius: 8px;
padding: 0;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
flex: 7 1 0;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
.list-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 16px 0;
margin-bottom: 16px;
flex-shrink: 0;
flex-wrap: nowrap;
gap: 12px;
.toolbar-left {
flex: 1;
min-width: 0;
}
.scan-feedback-text {
margin: 0;
font-size: 16px;
line-height: 1.5;
word-break: break-word;
&.is-error {
color: #f53f3f;
font-weight: 700;
}
&.is-success {
color: #00b42a;
font-weight: 600;
}
&.is-warning {
color: #d46b08;
font-weight: 600;
}
}
.toolbar-right .pagination-controls {
display: flex;
align-items: center;
gap: 8px;
white-space: nowrap;
flex-wrap: nowrap;
}
}
.list-wrap {
width: 100%;
flex: 1;
min-height: 0;
padding: 0 16px 16px;
box-sizing: border-box;
display: flex;
flex-direction: column;
overflow: hidden;
overscroll-behavior: contain;
touch-action: pan-x pan-y;
}
}
@media (max-width: 992px) {
.waybill-layout {
flex-direction: column;
overflow-y: auto;
}
.form-section {
flex: 0 0 auto;
max-width: none;
width: 100%;
min-width: 0;
}
.recent-orders-section {
flex: 1;
min-height: 360px;
}
}
@import '@/views/operation/styles/ops-scan-page.less';
</style>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,509 @@
.ops-page {
display: flex;
flex-direction: row;
align-items: stretch;
gap: 12px;
padding: 16px;
background: #f0f3f4;
flex: 1;
min-height: 0;
overflow: hidden;
}
.ops-col--main {
flex: 1 1 0;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
gap: 12px;
}
.ops-card {
display: flex;
flex-direction: column;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
overflow: hidden;
}
.ops-card__head {
display: flex;
align-items: center;
gap: 10px;
padding: 12px 16px;
font-size: 14px;
font-weight: 600;
color: #1d2129;
border-bottom: 1px solid #f2f3f5;
flex-shrink: 0;
background: #fafbfc;
}
.ops-card__body {
min-height: 0;
}
.ops-card--scan {
flex: 0 0 auto;
}
.ops-card--verify {
flex: 1 1 0;
min-height: 0;
.ops-card__body {
flex: 1;
overflow: auto;
}
}
.ops-card--recent {
flex: 0 0 380px;
width: 380px;
max-width: 40%;
.ops-card__body {
flex: 1;
display: flex;
flex-direction: column;
}
}
.ops-card--recent-wide {
flex: 1.2 1 0;
min-width: 0;
width: auto;
max-width: none;
.ops-card__body {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
}
}
.ops-feedback {
margin: 0 0 0 auto;
max-width: 60%;
font-size: 13px;
font-weight: 600;
line-height: 1.4;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
&.is-error {
color: #f53f3f;
}
&.is-success {
color: #00b42a;
}
&.is-warning {
color: #d46b08;
}
}
.ops-scan {
display: flex;
flex-direction: column;
gap: 10px;
padding: 14px 16px 12px;
}
.ops-scan__row {
display: flex;
align-items: center;
gap: 10px;
width: 100%;
}
.ops-scan__row--tools {
justify-content: space-between;
flex-wrap: wrap;
}
.ops-scan-input {
width: 100%;
:deep(.arco-input-wrapper) {
height: 44px;
border-radius: 6px;
background: #fff;
border-color: #e5e6eb;
transition: border-color 0.2s, box-shadow 0.2s;
&:hover,
&.arco-input-focus {
border-color: var(--app-primary-color);
}
&.arco-input-focus {
box-shadow: 0 0 0 2px color-mix(in srgb, var(--app-primary-color) 18%, transparent);
}
}
:deep(.arco-input) {
height: 42px;
font-size: 18px;
font-weight: 560;
letter-spacing: 0.02em;
}
}
.ops-scan-hint {
margin: 0;
font-size: 12px;
color: #86909c;
line-height: 1.4;
}
.ops-scan__opts {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 12px;
min-width: 0;
}
.ops-opt {
white-space: nowrap;
color: #4e5969;
}
.ops-scan__actions {
display: flex;
align-items: center;
gap: 8px;
margin-left: auto;
}
.ops-btn {
height: 36px !important;
border-radius: 4px !important;
padding: 0 16px !important;
font-size: 14px;
&--ghost {
color: #4e5969;
border-color: #e5e6eb;
background: #fff;
&:hover {
color: var(--app-primary-color);
border-color: var(--app-primary-color);
background: color-mix(in srgb, var(--app-primary-color) 6%, #fff);
}
}
&--primary {
min-width: 112px;
font-weight: 600;
background: var(--app-primary-color) !important;
border-color: var(--app-primary-color) !important;
&:hover {
filter: brightness(1.05);
}
}
}
.ops-verify {
padding: 16px;
}
.ops-verify-spin {
width: 100%;
min-height: 200px;
}
.ops-hero {
padding: 16px 18px;
border-radius: 10px;
background: color-mix(in srgb, var(--app-primary-color) 8%, #fff);
border: 1px solid color-mix(in srgb, var(--app-primary-color) 20%, #e5e6eb);
}
.ops-hero__waybill {
font-size: 26px;
font-weight: 700;
letter-spacing: 0.02em;
color: #1d2129;
line-height: 1.2;
word-break: break-all;
}
.ops-hero__meta {
margin-top: 10px;
display: flex;
flex-wrap: wrap;
gap: 10px 20px;
font-size: 13px;
color: #4e5969;
}
.ops-metrics {
margin-top: 16px;
display: grid;
grid-template-columns: minmax(140px, 200px) 1fr;
gap: 16px;
}
.ops-metric__label {
display: block;
margin-bottom: 8px;
font-size: 13px;
font-weight: 500;
color: #4e5969;
}
.ops-metric__weight {
display: flex;
align-items: center;
gap: 8px;
}
.ops-unit {
font-size: 13px;
color: #86909c;
flex-shrink: 0;
}
.ops-dims {
display: flex;
align-items: center;
gap: 6px;
flex-wrap: wrap;
}
.ops-dims__x {
color: #86909c;
font-size: 13px;
}
.ops-field {
:deep(.arco-input-wrapper) {
height: 36px;
border-radius: 4px;
}
&--dim {
width: 96px;
}
}
.ops-select {
width: 100%;
max-width: 320px;
:deep(.arco-select-view-single) {
height: 36px;
border-radius: 4px;
}
}
.ops-readonly {
:deep(.arco-input-wrapper) {
height: 36px;
background: #f7f8fa;
}
:deep(.arco-input) {
color: #4e5969;
cursor: default;
}
}
.ops-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 200px;
text-align: center;
color: #86909c;
}
.ops-empty__title {
margin: 0;
font-size: 16px;
color: #4e5969;
}
.ops-empty__tip {
margin: 8px 0 0;
max-width: 420px;
font-size: 13px;
line-height: 1.5;
}
.ops-status-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 12px;
}
.ops-status-item {
padding: 14px 16px;
border-radius: 8px;
background: #f7f8fa;
border: 1px solid #f0f0f0;
span {
display: block;
font-size: 12px;
color: #86909c;
margin-bottom: 6px;
}
strong {
font-size: 15px;
font-weight: 600;
color: #1d2129;
word-break: break-all;
}
}
.ops-recent__count {
min-width: 20px;
height: 20px;
padding: 0 7px;
border-radius: 10px;
background: color-mix(in srgb, var(--app-primary-color) 12%, #fff);
color: var(--app-primary-color);
font-size: 12px;
font-weight: 600;
line-height: 20px;
text-align: center;
}
.ops-recent__list {
flex: 1;
min-height: 0;
overflow: auto;
padding: 10px;
}
.ops-recent__empty {
padding: 40px 12px;
text-align: center;
font-size: 13px;
color: #c9cdd4;
}
.ops-recent__row {
padding: 12px;
border-radius: 8px;
font-size: 13px;
color: #4e5969;
border: 1px solid #f0f0f0;
background: #fff;
& + & {
margin-top: 8px;
}
&:hover {
background: #f7f8fa;
border-color: #e5e6eb;
}
}
.ops-recent__top,
.ops-recent__mid,
.ops-recent__bottom {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
}
.ops-recent__mid,
.ops-recent__bottom {
margin-top: 6px;
font-size: 12px;
color: #86909c;
}
.ops-recent__no {
font-weight: 600;
font-size: 13px;
color: #1d2129;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ops-recent__weight {
flex-shrink: 0;
font-weight: 600;
color: var(--app-primary-color);
font-size: 12px;
}
.ops-recent__time {
flex-shrink: 0;
}
.ops-list-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
padding: 12px 16px 0;
flex-shrink: 0;
flex-wrap: wrap;
}
.ops-list-wrap {
width: 100%;
flex: 1;
min-height: 0;
padding: 12px 16px 16px;
box-sizing: border-box;
display: flex;
flex-direction: column;
overflow: hidden;
}
@media (max-width: 1100px) {
.ops-page {
flex-direction: column;
overflow: auto;
}
.ops-card--recent,
.ops-card--recent-wide {
flex: 0 0 auto;
width: 100%;
max-width: none;
max-height: 320px;
}
.ops-metrics {
grid-template-columns: 1fr;
}
.ops-scan__row--tools {
flex-direction: column;
align-items: stretch;
}
.ops-scan__actions {
margin-left: 0;
width: 100%;
.ops-btn {
flex: 1;
}
}
.ops-feedback {
max-width: 100%;
margin-left: 0;
}
}

View File

@ -31,7 +31,6 @@ export const MY_ORDERS_COLUMN_CATALOG: OrderListColumnDef[] = [
{ key: 'customerOrderNo', labelKey: 'order.myOrders.table.customerOrderNo', width: 150 },
{ key: 'trackingNo', labelKey: 'order.myOrders.table.trackingNo', width: 160 },
{ key: 'orderStatus', labelKey: 'order.myOrders.table.orderStatus', width: 130 },
{ key: 'latestTrack', labelKey: 'order.myOrders.table.latestTrack', width: 280 },
{ key: 'shippingMethod', labelKey: 'order.myOrders.table.shippingMethod', width: 120 },
{ key: 'serviceChannel', labelKey: 'order.myOrders.table.serviceChannel', width: 120 },
{ key: 'isPaid', labelKey: 'order.myOrders.table.isPaid', width: 80 },
@ -64,7 +63,6 @@ export const MY_ORDERS_DEFAULT_KEYS: string[] = [
'customerOrderNo',
'trackingNo',
'orderStatus',
'latestTrack',
'consigneeCountry',
'shippingMethod',
'chargeableWeight',
@ -191,7 +189,6 @@ export function mergeDiscoveredColumns(
'items',
'weightList',
'feeList',
'latestTrackRaw',
...(options?.skipKeys || []),
]);
const map = new Map(catalog.map((c) => [c.key, c]));

View File

@ -18,36 +18,6 @@
{{ $t('order.myOrders.drawer.actions.edit') }}
</a-button>
</template>
<template v-else-if="!isCustomerPortal && activeTab === 'weight'">
<template v-if="weightEditing">
<a-button @click="cancelWeightEdit">{{ $t('order.myOrders.drawer.actions.cancel') }}</a-button>
<a-button type="primary" :loading="weightSaving" @click="handleWeightEditSave">
{{ $t('order.myOrders.drawer.actions.save') }}
</a-button>
</template>
<a-button v-else type="primary" @click="startWeightEdit">
{{ $t('order.myOrders.drawer.actions.edit') }}
</a-button>
</template>
<template v-else-if="!isCustomerPortal && activeTab === 'fee'">
<a-button type="outline" @click="openAddFeeModal">
{{ $t('order.myOrders.drawer.actions.addFee') }}
</a-button>
<a-button
type="primary"
:loading="recalcReceivableLoading"
@click="handleRecalculateReceivable"
>
{{ $t('order.myOrders.drawer.actions.recalculateReceivable') }}
</a-button>
<a-button
type="outline"
:loading="recalcPayableLoading"
@click="handleRecalculatePayable"
>
{{ $t('order.myOrders.drawer.actions.recalculatePayable') }}
</a-button>
</template>
</div>
</template>
<div class="order-detail-drawer">
@ -361,228 +331,6 @@
</template>
</div>
<!-- 件重尺 -->
<div v-if="activeTab === 'weight' && !isCustomerPortal" class="tab-panel weight-info">
<div class="weight-summary">
<button
v-for="section in weightTypeDefs"
:key="section.key"
type="button"
class="weight-summary-card"
:class="[section.key, { active: weightViewMode === section.key }]"
@click="setWeightViewMode(section.key)"
>
<span class="weight-summary-label">{{ $t(section.labelKey) }}</span>
<span class="weight-summary-value">
{{ formatWeightChargeable(getWeightRowByType(section.key)) }}
</span>
<span class="weight-summary-meta">
{{ $t('order.myOrders.drawer.weight.actualMeta', {
value: formatWeightNumber(getWeightRowByType(section.key)?.actualWeight),
}) }}
</span>
</button>
</div>
<div class="weight-view-switch">
<a-radio-group
v-model="weightViewMode"
type="button"
size="small"
>
<a-radio value="all">{{ $t('order.myOrders.drawer.weight.viewAll') }}</a-radio>
<a-radio
v-for="section in weightTypeDefs"
:key="section.key"
:value="section.key"
>
{{ $t(section.labelKey) }}
</a-radio>
</a-radio-group>
</div>
<template v-for="section in visibleWeightSections" :key="section.key">
<div class="weight-section" :class="section.key">
<div class="weight-section-header">
<div class="weight-section-title-wrap">
<span class="weight-section-dot" />
<span class="weight-section-title">{{ $t(section.labelKey) }}</span>
</div>
<span class="weight-section-total">
{{ formatWeightChargeable(section.row) }}
</span>
</div>
<div
v-if="section.hasData || (weightEditing && hasWeightRow(section.key))"
class="weight-metrics-grid"
>
<div
v-for="field in weightMetricFields"
:key="field.key"
class="weight-metric-item"
:class="{ highlight: field.highlight }"
>
<span class="metric-label">{{ $t(field.labelKey) }}</span>
<div class="metric-value-wrap">
<template v-if="weightEditing && field.editable && hasWeightRow(section.key)">
<a-input-number
v-model="section.row[field.key]"
:min="0"
size="small"
style="width: 100%"
/>
</template>
<span
v-else
class="metric-value"
:class="{ 'metric-value-highlight': field.highlight }"
>
{{ formatWeightCellValue(section.row, field.key) }}
</span>
</div>
</div>
</div>
<a-empty
v-else
:description="$t(section.emptyKey)"
:image-style="{ height: '48px' }"
class="weight-section-empty"
/>
</div>
</template>
<a-empty
v-if="!weightList.length && !weightEditing"
:description="$t('order.myOrders.drawer.weight.emptyAll')"
:image-style="{ height: '60px' }"
class="weight-empty-all"
/>
</div>
<!-- 应收应付 -->
<div v-if="activeTab === 'fee' && !isCustomerPortal" class="tab-panel fee-info">
<div class="fee-summary">
<button
type="button"
class="fee-summary-card receivable"
:class="{ active: feeViewMode === 'receivable' }"
@click="setFeeViewMode('receivable')"
>
<span class="fee-summary-label">{{ $t('finance.receivablePayable.feeType.receivable') }}</span>
<span class="fee-summary-amount">{{ formatFeeTotals(receivableTotals) }}</span>
<span class="fee-summary-meta">
{{ $t('order.myOrders.drawer.fee.itemCount', { count: receivableFeeList.length }) }}
</span>
</button>
<button
type="button"
class="fee-summary-card payable"
:class="{ active: feeViewMode === 'payable' }"
@click="setFeeViewMode('payable')"
>
<span class="fee-summary-label">{{ $t('finance.receivablePayable.feeType.payable') }}</span>
<span class="fee-summary-amount">{{ formatFeeTotals(payableTotals) }}</span>
<span class="fee-summary-meta">
{{ $t('order.myOrders.drawer.fee.itemCount', { count: payableFeeList.length }) }}
</span>
</button>
<div class="fee-summary-card gross-profit">
<span class="fee-summary-label">{{ $t('order.myOrders.drawer.fee.grossProfit') }}</span>
<span class="fee-summary-amount">{{ formatGrossProfitTotals(feeGrossProfitTotals) }}</span>
<span class="fee-summary-meta">{{ grossProfitMarginText }}</span>
</div>
</div>
<div class="fee-profit-formula">
<span class="fee-profit-formula-label">{{ $t('order.myOrders.drawer.fee.grossProfitFormula') }}</span>
<span class="fee-profit-formula-value">
<span class="amount-receivable">{{ formatFeeTotals(receivableTotals) }}</span>
<span class="fee-profit-operator">−</span>
<span class="amount-payable">{{ formatFeeTotals(payableTotals) }}</span>
<span class="fee-profit-operator">=</span>
<span class="fee-profit-result">
{{ formatGrossProfitTotals(feeGrossProfitTotals) }}
</span>
</span>
</div>
<div class="fee-view-switch">
<a-radio-group
v-model="feeViewMode"
type="button"
size="small"
>
<a-radio value="all">{{ $t('order.myOrders.drawer.fee.viewAll') }}</a-radio>
<a-radio value="receivable">{{ $t('finance.receivablePayable.feeType.receivable') }}</a-radio>
<a-radio value="payable">{{ $t('finance.receivablePayable.feeType.payable') }}</a-radio>
</a-radio-group>
</div>
<template v-for="section in visibleFeeSections" :key="section.key">
<div class="fee-section" :class="section.key">
<div class="fee-section-header">
<div class="fee-section-title-wrap">
<span class="fee-section-dot" />
<span class="fee-section-title">{{ $t(section.titleKey) }}</span>
<a-tag size="small" :color="section.tagColor">{{ section.list.length }}</a-tag>
</div>
<span class="fee-section-total">{{ formatFeeTotals(section.totals) }}</span>
</div>
<div v-if="section.list.length" class="fee-table-wrap">
<div class="fee-table">
<div class="table-header">
<div
v-for="col in feeDetailColumns"
:key="col.key"
class="header-cell"
:class="col.key"
>
{{ $t(col.labelKey) }}
</div>
</div>
<div
v-for="(row, idx) in section.list"
:key="`${section.key}-${idx}`"
class="table-row"
>
<div
v-for="col in feeDetailColumns"
:key="col.key"
class="table-cell"
:class="col.key"
>
<template v-if="col.key === 'amount'">
<span class="fee-amount" :class="section.amountClass">
{{ formatFeeAmount(row.amount) }}
</span>
</template>
<template v-else-if="col.key === 'chargingStage'">
<a-tag
v-if="getChargingStage(row)"
size="small"
:color="getChargingStageColor(getChargingStage(row))"
>
{{ getChargingStageLabel(getChargingStage(row)) }}
</a-tag>
<span v-else>--</span>
</template>
<template v-else>
{{ getFeeCellValue(row, col) }}
</template>
</div>
</div>
</div>
</div>
<a-empty
v-else
:description="$t(section.emptyKey)"
:image-style="{ height: '48px' }"
class="fee-section-empty"
/>
</div>
</template>
</div>
<!-- 轨迹 -->
<div v-if="activeTab === 'track'" class="tab-panel track-info">
<div class="track-toolbar">
@ -663,6 +411,14 @@
/>
</a-spin>
</div>
<!-- 绑定包裹/库存 -->
<div v-if="activeTab === 'stockBind'" class="tab-panel stock-bind-info">
<OrderStockBindTab
:order-id="orderId"
:active="activeTab === 'stockBind'"
/>
</div>
</div>
</div>
</DrawerPro>
@ -692,6 +448,7 @@ import { getDictListAll, type DictDto } from '@/api/system/dict';
import { getOrderStatusMeta, resolveOrderStatusCode } from '@/constants/orderStatus';
import { useRbacUserStore } from '@/store/modules/rbac-user';
import AddOrderFeeModal from './AddOrderFeeModal.vue';
import OrderStockBindTab from './OrderStockBindTab.vue';
const { t } = useI18n();
const rbacUserStore = useRbacUserStore();
@ -984,22 +741,15 @@ function resetEditState() {
const [register, { openDrawer: innerOpenDrawer, setDrawerProps, closeDrawer }] = useDrawer();
const activeTab = ref('basic');
const tabList = computed(() => {
const tabs = [
{ key: 'basic', label: t('order.myOrders.drawer.tabs.basic') },
{ key: 'weight', label: t('order.myOrders.drawer.tabs.weight') },
{ key: 'fee', label: t('order.myOrders.drawer.tabs.fee') },
{ key: 'track', label: t('order.myOrders.drawer.tabs.track') },
];
if (isCustomerPortal.value) {
return tabs.filter((tab) => tab.key === 'basic' || tab.key === 'track');
}
return tabs;
});
const tabList = computed(() => [
{ key: 'basic', label: t('order.myOrders.drawer.tabs.basic') },
{ key: 'track', label: t('order.myOrders.drawer.tabs.track') },
{ key: 'stockBind', label: t('order.myOrders.drawer.tabs.stockBind') },
]);
function resolveDrawerTab(tab?: string) {
const next = tab || 'basic';
if (isCustomerPortal.value && (next === 'weight' || next === 'fee')) {
if (next === 'weight' || next === 'fee') {
return 'basic';
}
return next;
@ -1864,13 +1614,6 @@ function handleTabChange(tabKey: string) {
if (next === 'basic') {
basicViewMode.value = 'all';
}
if (next === 'weight') {
weightViewMode.value = 'all';
}
if (next === 'fee') {
feeViewMode.value = 'all';
void ensureFeeItemDictLoaded();
}
if (next === 'track') {
loadTrackTimeline();
}
@ -1886,11 +1629,11 @@ watch(
(newOrder) => {
detail.value = newOrder ? { ...newOrder } : null;
resetEditState();
if (activeTab.value === 'weight' || activeTab.value === 'fee') {
activeTab.value = 'basic';
}
if (newOrder) {
loadDetailData();
if (activeTab.value === 'fee') {
void ensureFeeItemDictLoaded();
}
if (activeTab.value === 'track') {
loadTrackTimeline();
}
@ -1899,20 +1642,11 @@ watch(
{ immediate: true, deep: true }
);
watch(isCustomerPortal, (customer) => {
if (customer && (activeTab.value === 'weight' || activeTab.value === 'fee')) {
activeTab.value = 'basic';
resetEditState();
}
});
defineExpose({
openDrawer: (opts?: { tab?: 'basic' | 'weight' | 'fee' | 'track' }) => {
openDrawer: (opts?: { tab?: 'basic' | 'weight' | 'fee' | 'track' | 'stockBind' }) => {
const tab = resolveDrawerTab(opts?.tab);
activeTab.value = tab;
basicViewMode.value = 'all';
feeViewMode.value = 'all';
weightViewMode.value = 'all';
resetEditState();
setDrawerProps({
content: '',
@ -1923,8 +1657,6 @@ defineExpose({
innerOpenDrawer();
if (tab === 'track') {
void loadTrackTimeline();
} else if (tab === 'fee' && !isCustomerPortal.value) {
void ensureFeeItemDictLoaded();
}
},
startBasicEdit,

View File

@ -0,0 +1,272 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { IconRefresh } from '@arco-design/web-vue/es/icon'
import { getOrderStockBindDetail, type OrderStockBindItem } from '@/api/order'
import { resolveOmsAssetUrl } from '@/api/oms/common'
const props = defineProps<{
orderId: number | null | undefined
active: boolean
}>()
const { t } = useI18n()
const loading = ref(false)
const warehouseName = ref('')
const bindStatus = ref('none')
const items = ref<OrderStockBindItem[]>([])
const statusLabel = computed(() => {
const code = bindStatus.value || 'none'
const key = `order.myOrders.stockBind.status.${code}`
const translated = t(key)
return translated === key ? code : translated
})
const statusColor = computed(() => {
if (bindStatus.value === 'deducted') return 'red'
if (bindStatus.value === 'bound') return 'green'
if (bindStatus.value === 'released') return 'orangered'
return 'gray'
})
const totalBindQty = computed(() =>
items.value.reduce((sum, x) => sum + (Number(x.bindQty) || 0), 0),
)
function bindTypeLabel(bindType: string) {
if (bindType === 'inventory') return t('order.myOrders.stockBind.tabInventory')
if (bindType === 'parcelItem') return t('order.myOrders.stockBind.tabParcel')
return bindType || '--'
}
function lineTitle(item: OrderStockBindItem) {
if (item.bindType === 'inventory') {
return [item.skuCode, item.skuName].filter(Boolean).join(' · ') || '--'
}
return [item.trackingNo, item.productName || item.skuCode].filter(Boolean).join(' · ') || '--'
}
function lineSub(item: OrderStockBindItem) {
const parts: string[] = []
if (item.bindType === 'inventory' && item.binCode) {
parts.push(`${t('order.myOrders.stockBind.bin')}: ${item.binCode}`)
}
if (item.bindType === 'parcelItem' && item.attributeText) {
parts.push(item.attributeText)
}
if (item.status) {
const key = `order.myOrders.stockBind.status.${item.status}`
const label = t(key)
parts.push(label === key ? item.status : label)
}
return parts.join(' · ')
}
function imageUrl(item: OrderStockBindItem) {
return resolveOmsAssetUrl(item.imageUrl || '') || ''
}
async function loadDetail() {
const id = Number(props.orderId)
if (!Number.isFinite(id) || id <= 0) {
items.value = []
warehouseName.value = ''
bindStatus.value = 'none'
return
}
loading.value = true
try {
const detail = await getOrderStockBindDetail(id)
warehouseName.value = detail.warehouseName || ''
bindStatus.value = detail.bindStatus || 'none'
items.value = detail.items || []
} catch {
items.value = []
warehouseName.value = ''
bindStatus.value = 'none'
} finally {
loading.value = false
}
}
watch(
() => [props.active, props.orderId] as const,
([active]) => {
if (active) void loadDetail()
},
{ immediate: true },
)
defineExpose({ reload: loadDetail })
</script>
<template>
<div class="stock-bind-tab">
<div class="stock-bind-tab__hero">
<div class="stock-bind-tab__meta">
<a-tag size="small" :color="statusColor">{{ statusLabel }}</a-tag>
<a-tag v-if="warehouseName" size="small" color="arcoblue">
{{ t('order.myOrders.stockBind.warehouse') }} · {{ warehouseName }}
</a-tag>
<span v-if="items.length" class="stock-bind-tab__summary">
{{ t('order.myOrders.stockBind.cartSummary', { lines: items.length, qty: totalBindQty }) }}
</span>
</div>
<a-button type="text" size="small" :loading="loading" @click="loadDetail">
<template #icon>
<icon-refresh />
</template>
{{ t('order.myOrders.drawer.track.refresh') }}
</a-button>
</div>
<a-spin :loading="loading" class="stock-bind-tab__spin">
<div v-if="items.length" class="stock-bind-tab__list">
<div v-for="(item, idx) in items" :key="item.id ?? `${item.bindType}-${idx}`" class="bind-row">
<div class="bind-row__media">
<img
v-if="imageUrl(item)"
:src="imageUrl(item)"
alt=""
class="bind-row__img"
referrerpolicy="no-referrer"
/>
<div v-else class="bind-row__img bind-row__img--empty" />
</div>
<div class="bind-row__main">
<div class="bind-row__title">{{ lineTitle(item) }}</div>
<div class="bind-row__sub">
<a-tag size="small" color="gray">{{ bindTypeLabel(item.bindType) }}</a-tag>
<span v-if="lineSub(item)">{{ lineSub(item) }}</span>
</div>
</div>
<div class="bind-row__qty">
<span class="bind-row__qty-label">{{ t('order.myOrders.stockBind.bindQty') }}</span>
<strong>{{ item.bindQty }}</strong>
</div>
</div>
</div>
<a-empty
v-else-if="!loading"
:description="t('order.myOrders.stockBind.viewEmpty')"
class="stock-bind-tab__empty"
/>
</a-spin>
</div>
</template>
<style scoped lang="less">
.stock-bind-tab {
display: flex;
flex-direction: column;
gap: 12px;
min-height: 280px;
}
.stock-bind-tab__hero {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 12px 14px;
border-radius: 8px;
background: #f7f8fa;
border: 1px solid #f0f0f0;
}
.stock-bind-tab__meta {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
font-size: 13px;
color: #4e5969;
}
.stock-bind-tab__summary {
font-size: 13px;
font-weight: 500;
color: #1d2129;
}
.stock-bind-tab__spin {
width: 100%;
min-height: 200px;
}
.stock-bind-tab__list {
display: flex;
flex-direction: column;
gap: 8px;
}
.bind-row {
display: flex;
align-items: center;
gap: 12px;
padding: 12px;
border-radius: 8px;
background: #f7f8fa;
border: 1px solid #f0f0f0;
}
.bind-row__img {
width: 48px;
height: 48px;
border-radius: 6px;
object-fit: cover;
border: 1px solid #e5e6eb;
background: #fff;
&--empty {
background: #e5e6eb;
}
}
.bind-row__main {
flex: 1;
min-width: 0;
}
.bind-row__title {
font-size: 14px;
font-weight: 500;
color: #1d2129;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.bind-row__sub {
margin-top: 6px;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
font-size: 12px;
color: #86909c;
}
.bind-row__qty {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 2px;
flex-shrink: 0;
strong {
font-size: 18px;
color: var(--app-primary-color, #2d8c8c);
}
}
.bind-row__qty-label {
font-size: 12px;
color: #86909c;
}
.stock-bind-tab__empty {
padding: 48px 0;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -30,11 +30,11 @@
type OrderDownstreamForwardResult,
} from '@/api/order';
import { notifyCustomerBalanceChanged } from '@/api/customer/accountFlow';
import { postGetDetailTimeline } from '@/api/TrackOrder/trackOrder';
import OrderDetailDrawer from './components/OrderDetailDrawer.vue';
import OrderPayConfirmModal from './components/OrderPayConfirmModal.vue';
import MarkProblematicModal from './components/MarkProblematicModal.vue';
import MarkClaimedModal from './components/MarkClaimedModal.vue';
import StockBindModal from './components/StockBindModal.vue';
import ColumnConfigModal from '../components/ColumnConfigModal.vue';
import {
MY_ORDERS_COLUMN_CATALOG,
@ -147,7 +147,7 @@
async function openDetailWithOptionalFetch(
row: any,
opts?: { editBasic?: boolean; tab?: 'basic' | 'weight' | 'fee' | 'track' },
opts?: { editBasic?: boolean; tab?: 'basic' | 'track' },
) {
let nextRow = row;
const id = row?.id;
@ -255,6 +255,9 @@
const problematicModalVisible = ref(false);
const claimedModalVisible = ref(false);
const stockBindModalVisible = ref(false);
const stockBindOrderId = ref<number | null>(null);
const stockBindOrderLabel = ref('');
const exceptionOrderIds = ref<number[]>([]);
const payConfirmVisible = ref(false);
const payConfirmOrders = ref<Array<{ id: number | string; waybillNo?: string; serviceNo?: string }>>([]);
@ -340,8 +343,6 @@
const orderList = ref<any[]>([]);
const listLoading = ref(false);
let listRequestSeq = 0;
/** 最新轨迹缓存:orderNumber -> 文案 */
const latestTrackCache = new Map<string, string>();
function escapeHtml(text: string) {
return String(text)
@ -351,89 +352,6 @@
.replace(/"/g, '&quot;');
}
function formatTrackTimeShort(ts: unknown) {
if (ts == null || ts === '') return '';
const n = typeof ts === 'number' ? ts : Number(ts);
if (!Number.isFinite(n) || n <= 0) return String(ts);
const ms = n < 1e12 ? n * 1000 : n;
try {
return new Date(ms).toLocaleString('zh-CN', {
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
hour12: false,
});
} catch {
return '';
}
}
function pickLatestTrackText(list: any[]): string {
if (!Array.isArray(list) || !list.length) return '';
const highlighted = list.find((item) => item?.isHighlight);
const latest = highlighted || list[list.length - 1];
if (!latest) return '';
const content = String(latest.content || latest.enContent || '').trim();
const place = [latest.trackPlace, latest.trackPlaceCity, latest.trackPlaceProvince]
.map((p) => (p == null ? '' : String(p).trim()))
.filter(Boolean)
.join(' ');
const time = formatTrackTimeShort(latest.trackTime);
return [content, place, time].filter(Boolean).join(' · ');
}
function getOrderTrackNumber(row: any) {
return String(row?.trackingNo || row?.waybillNo || row?.customerOrderNo || '').trim();
}
async function enrichLatestTracks(rows: any[], requestSeq: number) {
const targets = rows.filter((row) => {
const status = resolveOrderStatusCode(row);
if (status === 'draft' || status === 'deleted') return false;
return !!getOrderTrackNumber(row);
});
if (!targets.length) return;
const concurrency = 5;
for (let i = 0; i < targets.length; i += concurrency) {
if (requestSeq !== listRequestSeq) return;
const batch = targets.slice(i, i + concurrency);
await Promise.all(
batch.map(async (row) => {
const orderNumber = getOrderTrackNumber(row);
if (!orderNumber) return;
let text = latestTrackCache.get(orderNumber);
if (text === undefined) {
try {
const res: any = await postGetDetailTimeline({ orderNumber });
const list = res?.data || res || [];
text = pickLatestTrackText(list) || '';
} catch {
text = '';
}
latestTrackCache.set(orderNumber, text);
}
if (requestSeq !== listRequestSeq) return;
const idx = orderList.value.findIndex((it) => Number(it.id) === Number(row.id));
if (idx < 0) return;
const display =
text ||
(row.trackingNo
? t('order.myOrders.latestTrack.emptyWithNo')
: t('order.myOrders.latestTrack.empty'));
orderList.value[idx] = {
...orderList.value[idx],
latestTrack: display,
latestTrackRaw: text,
};
}),
);
}
}
const selectedRowCount = ref(0);
/** 表格选中行(用于批量操作) */
const selectedOrderRows = ref<any[]>([]);
@ -694,22 +612,9 @@
if (requestSeq !== listRequestSeq) {
return;
}
const mapped = (items || []).map((row) => normalizeOrderRow(row)).map((row) => {
const status = resolveOrderStatusCode(row);
const skipTrack =
status === 'draft' || status === 'deleted' || !getOrderTrackNumber(row);
return {
...row,
latestTrack: skipTrack
? t('order.myOrders.latestTrack.empty')
: t('order.myOrders.latestTrack.loading'),
latestTrackRaw: '',
};
});
orderList.value = mapped;
orderList.value = (items || []).map((row) => normalizeOrderRow(row));
totalCount.value = total;
tabCounts.value[status] = total;
void enrichLatestTracks(mapped, requestSeq);
} catch (e: any) {
if (requestSeq !== listRequestSeq) {
return;
@ -1057,6 +962,21 @@
await openDetailWithOptionalFetch(rows[0], { editBasic: true });
};
const openStockBindModal = () => {
const rows = requireSelectedRows();
if (!rows.length) return;
if (rows.length > 1) {
Message.warning(t('order.myOrders.stockBind.singleOnly'));
return;
}
const row = rows[0];
stockBindOrderId.value = Number(getOrderRowId(row)!);
stockBindOrderLabel.value = String(
row?.waybillNo || row?.serviceNo || row?.customerOrderNo || row?.clientNo || '',
).trim();
stockBindModalVisible.value = true;
};
const openProblematicModal = () => {
const rows = requireSelectedRows();
if (!rows.length) return;
@ -1123,6 +1043,7 @@
};
const onMoreActionClick = (key: string) => {
if (key === 'stockBind') return openStockBindModal();
if (key === 'createProblematic') return openProblematicModal();
if (key === 'createClaimed') return openClaimedModal();
if (key === 'createTrackOrder') return handleCreateTrackOrder();
@ -1234,14 +1155,6 @@
: '';
return `<span style="display:inline-flex;align-items:center;flex-wrap:wrap;gap:4px;max-width:100%;"><span style="display:inline-block;padding:2px 8px;border-radius:4px;font-size:12px;color:${tagColor};background-color:${tagBgColor};white-space:nowrap;">${statusText}</span>${handleTagHtml}</span>`;
}
if (colKey === 'latestTrack') {
const text = String(rowData?.latestTrack || value || '').trim();
if (!text) return '--';
const escaped = escapeHtml(text);
const isLoading = text === t('order.myOrders.latestTrack.loading');
const color = isLoading ? '#86909c' : '#4e5969';
return `<span title="${escaped}" style="display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:${color};font-size:12px;line-height:1.4;">${escaped}</span>`;
}
if (colKey === 'predeclareFailReason') {
const reason = rowData?.predeclareFailReason || value || '';
if (!reason) return null;
@ -1397,6 +1310,10 @@
<icon-down class="btn-more-arrow" />
</a-button>
<template #content>
<a-doption
v-if="hasPermission('Order.MyOrders.StockBind')"
@click="onMoreActionClick('stockBind')"
>{{ t('order.myOrders.actions.stockBind') }}</a-doption>
<a-doption
v-if="showExceptionCreateActions"
:disabled="isActionBusy('markProblematic')"
@ -1597,6 +1514,12 @@
:order-ids="exceptionOrderIds"
@success="handleExceptionActionSuccess"
/>
<StockBindModal
v-model:visible="stockBindModalVisible"
:order-id="stockBindOrderId"
:order-label="stockBindOrderLabel"
@success="handleExceptionActionSuccess"
/>
<OrderPayConfirmModal
v-model:visible="payConfirmVisible"
:orders="payConfirmOrders"

View File

@ -81,17 +81,26 @@ const primaryActionLabel = computed(() =>
isEdit.value ? t('warehouse.common.save') : t('order.platformStore.actions.startAuth'),
)
const hotColumns = computed(() => [
{ key: 'platformName', label: t('order.platformStore.table.platform'), width: 100 },
{ key: 'storeNickname', label: t('order.platformStore.table.nickname'), width: 160 },
{ key: 'platformAccount', label: t('order.platformStore.table.account'), width: 140 },
{ key: 'siteCountry', label: t('order.platformStore.table.siteCountry'), width: 90 },
{ key: 'authStatus', label: t('order.platformStore.table.authStatus'), width: 100 },
{ key: 'isAutoFulfill', label: t('order.platformStore.table.autoFulfill'), width: 90 },
{ key: 'authTime', label: t('order.platformStore.table.authTime'), width: 160 },
{ key: 'tokenExpireTime', label: t('order.platformStore.table.tokenExpire'), width: 160 },
{ key: 'createTime', label: t('order.platformStore.table.createTime'), width: 160 },
])
const hotColumns = computed(() => {
const cols = [
{ key: 'platformName', label: t('order.platformStore.table.platform'), width: 100 },
{ key: 'storeNickname', label: t('order.platformStore.table.nickname'), width: 160 },
{ key: 'platformAccount', label: t('order.platformStore.table.account'), width: 140 },
{ key: 'siteCountry', label: t('order.platformStore.table.siteCountry'), width: 90 },
{ key: 'authStatus', label: t('order.platformStore.table.authStatus'), width: 100 },
{ key: 'isAutoFulfill', label: t('order.platformStore.table.autoFulfill'), width: 90 },
{ key: 'authTime', label: t('order.platformStore.table.authTime'), width: 160 },
{ key: 'tokenExpireTime', label: t('order.platformStore.table.tokenExpire'), width: 160 },
{ key: 'createTime', label: t('order.platformStore.table.createTime'), width: 160 },
]
if (isAdmin.value) {
cols.unshift(
{ key: 'customerName', label: t('order.myOrders.table.customerName'), width: 120 },
{ key: 'customerCode', label: t('order.myOrders.table.customerCode'), width: 110 },
)
}
return cols
})
function platformLabel(code: string) {
return platformDefs.find((p) => p.code === code)?.label ?? code
@ -103,6 +112,9 @@ function mapRow(raw: Record<string, unknown>) {
const autoFulfill = Boolean(pickField(row, 'isAutoFulfill', 'IsAutoFulfill'))
return {
id: pickField<number>(row, 'id', 'Id'),
customerId: pickField<number>(row, 'customerId', 'CustomerId'),
customerName: pickField(row, 'customerName', 'CustomerName') ?? '',
customerCode: pickField(row, 'customerCode', 'CustomerCode') ?? '',
platformName: pickField(row, 'platformName', 'PlatformName') ?? pickField(row, 'platformCode', 'PlatformCode') ?? '-',
storeNickname: pickField(row, 'storeNickname', 'StoreNickname') ?? '-',
platformAccount: pickField(row, 'platformAccount', 'PlatformAccount') ?? '-',

View File

@ -86,20 +86,29 @@ const detailData = ref<any>(null)
const matchWarehouseId = ref<number>()
const matchProductCode = ref<string>()
const hotColumns = computed(() => [
{ key: 'platformOrderNo', label: t('order.platformStoreOrder.table.orderNo'), width: 160 },
{ key: 'platformName', label: t('order.platformStoreOrder.table.platform'), width: 90 },
{ key: 'storeNickname', label: t('order.platformStoreOrder.table.store'), width: 120 },
{ key: 'orderCountry', label: t('order.platformStoreOrder.table.country'), width: 80 },
{ key: 'fulfillStatus', label: t('order.platformStoreOrder.table.status'), width: 90 },
{ key: 'itemCount', label: t('order.platformStoreOrder.table.itemCount'), width: 70 },
{ key: 'totalAmountDisplay', label: t('order.platformStoreOrder.table.amount'), width: 110 },
{ key: 'linkedServiceNo', label: t('order.platformStoreOrder.table.linkedServiceNo'), width: 150 },
{ key: 'shippingLabelNo', label: t('order.platformStoreOrder.table.shippingLabel'), width: 140 },
{ key: 'warehouseName', label: t('order.platformStoreOrder.table.warehouse'), width: 120 },
{ key: 'platformOrderTime', label: t('order.platformStoreOrder.table.orderTime'), width: 160 },
{ key: 'lastSyncTime', label: t('order.platformStoreOrder.table.lastSync'), width: 160 },
])
const hotColumns = computed(() => {
const cols = [
{ key: 'platformOrderNo', label: t('order.platformStoreOrder.table.orderNo'), width: 160 },
{ key: 'platformName', label: t('order.platformStoreOrder.table.platform'), width: 90 },
{ key: 'storeNickname', label: t('order.platformStoreOrder.table.store'), width: 120 },
{ key: 'orderCountry', label: t('order.platformStoreOrder.table.country'), width: 80 },
{ key: 'fulfillStatus', label: t('order.platformStoreOrder.table.status'), width: 90 },
{ key: 'itemCount', label: t('order.platformStoreOrder.table.itemCount'), width: 70 },
{ key: 'totalAmountDisplay', label: t('order.platformStoreOrder.table.amount'), width: 110 },
{ key: 'linkedServiceNo', label: t('order.platformStoreOrder.table.linkedServiceNo'), width: 150 },
{ key: 'shippingLabelNo', label: t('order.platformStoreOrder.table.shippingLabel'), width: 140 },
{ key: 'warehouseName', label: t('order.platformStoreOrder.table.warehouse'), width: 120 },
{ key: 'platformOrderTime', label: t('order.platformStoreOrder.table.orderTime'), width: 160 },
{ key: 'lastSyncTime', label: t('order.platformStoreOrder.table.lastSync'), width: 160 },
]
if (isAdmin.value) {
cols.unshift(
{ key: 'customerName', label: t('order.myOrders.table.customerName'), width: 120 },
{ key: 'customerCode', label: t('order.myOrders.table.customerCode'), width: 110 },
)
}
return cols
})
function mapRow(raw: Record<string, unknown>) {
const row = normalizeListRow(raw)
@ -114,6 +123,9 @@ function mapRow(raw: Record<string, unknown>) {
return {
id: pickField<number>(row, 'id', 'Id'),
customerId: pickField<number>(row, 'customerId', 'CustomerId'),
customerName: pickField(row, 'customerName', 'CustomerName') ?? '',
customerCode: pickField(row, 'customerCode', 'CustomerCode') ?? '',
platformOrderNo: pickField(row, 'platformOrderNo', 'PlatformOrderNo') ?? '-',
platformName: pickField(row, 'platformName', 'PlatformName') ?? platformCode ?? '-',
storeNickname: pickField(row, 'storeNickname', 'StoreNickname') ?? '-',

View File

@ -18,7 +18,6 @@ export const WAYBILL_MANAGE_COLUMN_CATALOG: OrderListColumnDef[] = [
{ key: 'waybillNo', labelKey: M('waybillNo'), width: 200 },
{ key: 'customerOrderNo', labelKey: M('customerOrderNo'), width: 150 },
{ key: 'trackingNo', labelKey: M('trackingNo'), width: 160 },
{ key: 'latestTrack', labelKey: M('latestTrack'), width: 260 },
{ key: 'shippingMethod', labelKey: M('shippingMethod'), width: 120 },
{ key: 'serviceChannel', labelKey: M('serviceChannel'), width: 120 },
{ key: 'consignee', labelKey: M('consignee'), width: 90 },
@ -140,7 +139,6 @@ export const WAYBILL_MANAGE_DEFAULT_KEYS: string[] = [
'customerOrderNo',
'trackingNo',
'orderStatus',
'latestTrack',
'shippingMethod',
'serviceChannel',
'isPaid',

View File

@ -663,6 +663,14 @@
/>
</a-spin>
</div>
<!-- 绑定包裹/库存 -->
<div v-if="activeTab === 'stockBind'" class="tab-panel stock-bind-info">
<OrderStockBindTab
:order-id="orderId"
:active="activeTab === 'stockBind'"
/>
</div>
</div>
</div>
</DrawerPro>
@ -691,6 +699,7 @@ import {
import { getDictListAll, type DictDto } from '@/api/system/dict';
import { getOrderStatusMeta, resolveOrderStatusCode } from '@/constants/orderStatus';
import AddOrderFeeModal from './AddOrderFeeModal.vue';
import OrderStockBindTab from '../../myOrders/components/OrderStockBindTab.vue';
const { t } = useI18n();
@ -985,6 +994,7 @@ const tabList = computed(() => [
{ key: 'weight', label: t('order.myOrders.drawer.tabs.weight') },
{ key: 'fee', label: t('order.myOrders.drawer.tabs.fee') },
{ key: 'track', label: t('order.myOrders.drawer.tabs.track') },
{ key: 'stockBind', label: t('order.myOrders.drawer.tabs.stockBind') },
]);
// 订单基本信息字段 (t_order) - 按文档表结构
@ -1878,7 +1888,7 @@ watch(
);
defineExpose({
openDrawer: (opts?: { tab?: 'basic' | 'weight' | 'fee' | 'track' }) => {
openDrawer: (opts?: { tab?: 'basic' | 'weight' | 'fee' | 'track' | 'stockBind' }) => {
activeTab.value = opts?.tab || 'basic';
basicViewMode.value = 'all';
feeViewMode.value = 'all';

View File

@ -30,7 +30,6 @@
type OrderDownstreamForwardResult,
} from '@/api/order';
import { notifyCustomerBalanceChanged } from '@/api/customer/accountFlow';
import { postGetDetailTimeline } from '@/api/TrackOrder/trackOrder';
import OrderDetailDrawer from './components/OrderDetailDrawer.vue';
import OrderPayConfirmModal from './components/OrderPayConfirmModal.vue';
import MarkProblematicModal from './components/MarkProblematicModal.vue';
@ -202,13 +201,16 @@
pick(raw, 'customerName', 'CustomerName') ||
customerFromOptions?.label?.replace(/\s*\([^)]*\)\s*$/, '') ||
'',
customerCode: pick(raw, 'customerCode', 'CustomerCode') ?? raw?.customerCode ?? '',
customerCode:
pick(raw, 'customerCode', 'CustomerCode') ||
(customerFromOptions?.label?.match(/\(([^)]+)\)\s*$/)?.[1] ?? '') ||
'',
};
}
async function openDetailWithOptionalFetch(
row: any,
opts?: { editBasic?: boolean; tab?: 'basic' | 'weight' | 'fee' | 'track' },
opts?: { editBasic?: boolean; tab?: 'basic' | 'track' },
) {
let nextRow = row;
const id = row?.id;
@ -400,8 +402,6 @@
const orderList = ref<any[]>([]);
const listLoading = ref(false);
let listRequestSeq = 0;
/** 最新轨迹缓存:orderNumber -> 文案 */
const latestTrackCache = new Map<string, string>();
function escapeHtml(text: string) {
return String(text)
@ -411,89 +411,6 @@
.replace(/"/g, '&quot;');
}
function formatTrackTimeShort(ts: unknown) {
if (ts == null || ts === '') return '';
const n = typeof ts === 'number' ? ts : Number(ts);
if (!Number.isFinite(n) || n <= 0) return String(ts);
const ms = n < 1e12 ? n * 1000 : n;
try {
return new Date(ms).toLocaleString('zh-CN', {
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
hour12: false,
});
} catch {
return '';
}
}
function pickLatestTrackText(list: any[]): string {
if (!Array.isArray(list) || !list.length) return '';
const highlighted = list.find((item) => item?.isHighlight);
const latest = highlighted || list[list.length - 1];
if (!latest) return '';
const content = String(latest.content || latest.enContent || '').trim();
const place = [latest.trackPlace, latest.trackPlaceCity, latest.trackPlaceProvince]
.map((p) => (p == null ? '' : String(p).trim()))
.filter(Boolean)
.join(' ');
const time = formatTrackTimeShort(latest.trackTime);
return [content, place, time].filter(Boolean).join(' · ');
}
function getOrderTrackNumber(row: any) {
return String(row?.trackingNo || row?.waybillNo || row?.customerOrderNo || '').trim();
}
async function enrichLatestTracks(rows: any[], requestSeq: number) {
const targets = rows.filter((row) => {
const status = resolveOrderStatusCode(row);
if (status === 'draft' || status === 'deleted') return false;
return !!getOrderTrackNumber(row);
});
if (!targets.length) return;
const concurrency = 5;
for (let i = 0; i < targets.length; i += concurrency) {
if (requestSeq !== listRequestSeq) return;
const batch = targets.slice(i, i + concurrency);
await Promise.all(
batch.map(async (row) => {
const orderNumber = getOrderTrackNumber(row);
if (!orderNumber) return;
let text = latestTrackCache.get(orderNumber);
if (text === undefined) {
try {
const res: any = await postGetDetailTimeline({ orderNumber });
const list = res?.data || res || [];
text = pickLatestTrackText(list) || '';
} catch {
text = '';
}
latestTrackCache.set(orderNumber, text);
}
if (requestSeq !== listRequestSeq) return;
const idx = orderList.value.findIndex((it) => Number(it.id) === Number(row.id));
if (idx < 0) return;
const display =
text ||
(row.trackingNo
? t('order.myOrders.latestTrack.emptyWithNo')
: t('order.myOrders.latestTrack.empty'));
orderList.value[idx] = {
...orderList.value[idx],
latestTrack: display,
latestTrackRaw: text,
};
}),
);
}
}
const selectedRowCount = ref(0);
/** 表格选中行(用于批量操作) */
const selectedOrderRows = ref<any[]>([]);
@ -756,23 +673,11 @@
if (requestSeq !== listRequestSeq) {
return;
}
const mapped = (items || []).map((row) => normalizeOrderRow(row)).map((row) => {
const status = resolveOrderStatusCode(row);
const skipTrack =
status === 'draft' || status === 'deleted' || !getOrderTrackNumber(row);
return {
...row,
latestTrack: skipTrack
? t('order.myOrders.latestTrack.empty')
: t('order.myOrders.latestTrack.loading'),
latestTrackRaw: '',
};
});
const mapped = (items || []).map((row) => normalizeOrderRow(row));
orderList.value = mapped;
totalCount.value = total;
tabCounts.value[status] = total;
syncColumnCatalogFromRows(mapped);
void enrichLatestTracks(mapped, requestSeq);
} catch (e: any) {
if (requestSeq !== listRequestSeq) {
return;
@ -1304,14 +1209,6 @@
: '';
return `<span style="display:inline-flex;align-items:center;flex-wrap:wrap;gap:4px;max-width:100%;"><span style="display:inline-block;padding:2px 8px;border-radius:4px;font-size:12px;color:${tagColor};background-color:${tagBgColor};white-space:nowrap;">${statusText}</span>${handleTagHtml}</span>`;
}
if (colKey === 'latestTrack') {
const text = String(rowData?.latestTrack || value || '').trim();
if (!text) return '--';
const escaped = escapeHtml(text);
const isLoading = text === t('order.myOrders.latestTrack.loading');
const color = isLoading ? '#86909c' : '#4e5969';
return `<span title="${escaped}" style="display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:${color};font-size:12px;line-height:1.4;">${escaped}</span>`;
}
if (colKey === 'predeclareFailReason') {
const reason = rowData?.predeclareFailReason || value || '';
if (!reason) return null;

View File

@ -141,17 +141,26 @@ const totalPlannedQty = computed(() =>
),
)
const hotColumns = computed(() => [
{ key: 'noticeNo', label: t('warehouse.inbound.table.noticeNo'), width: 180 },
{ key: 'markReference', label: t('warehouse.inbound.table.markReference'), width: 120 },
{ key: 'warehouseName', label: t('warehouse.inbound.table.warehouse'), width: 140 },
{ key: 'inboundType', label: t('warehouse.inbound.table.inboundType'), width: 100 },
{ key: 'receiptStatus', label: t('warehouse.inbound.table.receiptStatus'), width: 100 },
{ key: 'boxCount', label: t('warehouse.inbound.table.boxCount'), width: 80 },
{ key: 'plannedQty', label: t('warehouse.inbound.table.plannedQty'), width: 90 },
{ key: 'expectedArrivalTime', label: t('warehouse.inbound.table.expectedArrival'), width: 160 },
{ key: 'createTime', label: t('warehouse.inbound.table.createTime'), width: 160 },
])
const hotColumns = computed(() => {
const cols = [
{ key: 'noticeNo', label: t('warehouse.inbound.table.noticeNo'), width: 180 },
{ key: 'markReference', label: t('warehouse.inbound.table.markReference'), width: 120 },
{ key: 'warehouseName', label: t('warehouse.inbound.table.warehouse'), width: 140 },
{ key: 'inboundType', label: t('warehouse.inbound.table.inboundType'), width: 100 },
{ key: 'receiptStatus', label: t('warehouse.inbound.table.receiptStatus'), width: 100 },
{ key: 'boxCount', label: t('warehouse.inbound.table.boxCount'), width: 80 },
{ key: 'plannedQty', label: t('warehouse.inbound.table.plannedQty'), width: 90 },
{ key: 'expectedArrivalTime', label: t('warehouse.inbound.table.expectedArrival'), width: 160 },
{ key: 'createTime', label: t('warehouse.inbound.table.createTime'), width: 160 },
]
if (isAdmin.value) {
cols.unshift(
{ key: 'customerName', label: t('warehouse.common.customerName'), width: 120 },
{ key: 'customerCode', label: t('warehouse.common.customerCode'), width: 110 },
)
}
return cols
})
function createBox(seq: number): InboundBoxForm {
return {
@ -225,6 +234,9 @@ function mapRow(raw: Record<string, unknown>) {
const whId = pickField<number>(row, 'warehouseId', 'WarehouseId')
return {
id: pickField<number>(row, 'id', 'Id'),
customerId: pickField<number>(row, 'customerId', 'CustomerId'),
customerName: pickField(row, 'customerName', 'CustomerName') ?? '',
customerCode: pickField(row, 'customerCode', 'CustomerCode') ?? '',
noticeNo: pickField(row, 'noticeNo', 'NoticeNo') ?? '-',
markReference: pickField(row, 'markReference', 'MarkReference') ?? '-',
warehouseName: resolveWarehouseLabel(whId, warehouseNameMap.value),
@ -553,6 +565,7 @@ onMounted(async () => {
<template>
<div class="warehouse-inbound-container warehouse-list-page">
<div class="warehouse-list-page-card">
<div class="wh-page-tip">{{ t('warehouse.inbound.tip') }}</div>
<a-tabs
v-model:active-key="receiptStatus"
class="status-tabs"

View File

@ -9,6 +9,7 @@ import { useTableContainerHeight } from '@/composables/useTableContainerHeight'
import {
getWarehouseBinLocationList,
getWarehouseInventoryBinDetail,
getWarehouseInventoryHistory,
getWarehouseInventoryList,
relocateWarehouseInventory,
} from '@/api/warehouse'
@ -17,6 +18,7 @@ import { $baseMessage } from '@/utils'
import { hasPermission } from '@/utils/rbac-permission'
import {
buildWarehouseNameMap,
formatDateTime,
normalizeListRow,
pickField,
resolveWarehouseLabel,
@ -51,6 +53,14 @@ const binDetailVisible = ref(false)
const binDetailRows = ref<any[]>([])
const activeSku = ref<any>(null)
const historyVisible = ref(false)
const historyLoading = ref(false)
const historyTab = ref<'all' | 'inbound' | 'deduct'>('all')
const historyRows = ref<any[]>([])
const historyPage = ref(1)
const historyPageSize = ref(30)
const historyTotal = ref(0)
const [registerRelocateModal, { openModal: openRelocate, closeModal: closeRelocate }] = useModal() as any
const relocateSaving = ref(false)
const sourceBinOptions = ref<Array<{ label: string; value: number; qty: number }>>([])
@ -74,23 +84,39 @@ const sourceMaxQty = computed(() => {
return hit?.qty || 1
})
const hotColumns = computed(() => [
{ key: 'skuCode', label: t('warehouse.inventory.table.skuCode'), width: 140 },
{ key: 'skuName', label: t('warehouse.inventory.table.skuName'), width: 200 },
{ key: 'warehouseName', label: t('warehouse.inventory.table.warehouse'), width: 140 },
{ key: 'totalQty', label: t('warehouse.inventory.table.totalQty'), width: 90 },
{ key: 'binCount', label: t('warehouse.inventory.table.binCount'), width: 90 },
])
const hotColumns = computed(() => {
const cols = [
{ key: 'skuCode', label: t('warehouse.inventory.table.skuCode'), width: 140 },
{ key: 'skuName', label: t('warehouse.inventory.table.skuName'), width: 200 },
{ key: 'warehouseName', label: t('warehouse.inventory.table.warehouse'), width: 140 },
{ key: 'availableQty', label: t('warehouse.inventory.table.availableQty'), width: 90 },
{ key: 'frozenQty', label: t('warehouse.inventory.table.frozenQty'), width: 90 },
{ key: 'totalQty', label: t('warehouse.inventory.table.totalQty'), width: 90 },
{ key: 'binCount', label: t('warehouse.inventory.table.binCount'), width: 90 },
]
if (isAdmin.value) {
cols.unshift(
{ key: 'customerName', label: t('warehouse.common.customerName'), width: 120 },
{ key: 'customerCode', label: t('warehouse.common.customerCode'), width: 110 },
)
}
return cols
})
function mapRow(raw: Record<string, unknown>) {
const row = normalizeListRow(raw)
const whId = pickField<number>(row, 'warehouseId', 'WarehouseId')
return {
customerId: pickField<number>(row, 'customerId', 'CustomerId'),
customerName: pickField(row, 'customerName', 'CustomerName') ?? '',
customerCode: pickField(row, 'customerCode', 'CustomerCode') ?? '',
skuId: pickField<number>(row, 'skuId', 'SkuId'),
skuCode: pickField(row, 'skuCode', 'SkuCode') ?? '-',
skuName: pickField(row, 'skuName', 'SkuName') ?? '-',
warehouseId: whId,
warehouseName: resolveWarehouseLabel(whId, warehouseNameMap.value),
availableQty: pickField<number>(row, 'availableQty', 'AvailableQty') ?? 0,
frozenQty: pickField<number>(row, 'frozenQty', 'FrozenQty') ?? 0,
totalQty: pickField<number>(row, 'totalQty', 'TotalQty') ?? 0,
binCount: pickField<number>(row, 'binCount', 'BinCount') ?? 0,
_raw: row,
@ -204,6 +230,8 @@ async function showBinDetail(row: any) {
binLocationId: pickField<number>(normalized, 'binLocationId', 'BinLocationId'),
binCode: pickField(normalized, 'binCode', 'BinCode') ?? '-',
binName: pickField(normalized, 'binName', 'BinName') ?? '',
availableQty: pickField<number>(normalized, 'availableQty', 'AvailableQty') ?? 0,
frozenQty: pickField<number>(normalized, 'frozenQty', 'FrozenQty') ?? 0,
qty: pickField<number>(normalized, 'qty', 'Qty') ?? 0,
}
})
@ -213,6 +241,70 @@ async function showBinDetail(row: any) {
}
}
async function loadHistory() {
const row = activeSku.value
if (!row?.skuId || !row?.warehouseId) return
historyLoading.value = true
try {
const { items, total } = await getWarehouseInventoryHistory({
...withCustomerId({
page: historyPage.value,
pageSize: historyPageSize.value,
skuId: row.skuId,
warehouseId: row.warehouseId,
movementType: historyTab.value === 'all' ? undefined : historyTab.value,
}),
...(isAdmin.value && row.customerId ? { customerId: Number(row.customerId) } : {}),
})
historyRows.value = (items || []).map((item: Record<string, unknown>) => {
const normalized = normalizeListRow(item)
const type = String(pickField(normalized, 'movementType', 'MovementType') ?? '')
const qty = Number(pickField(normalized, 'qty', 'Qty') ?? 0)
return {
movementType: type,
typeLabel: t(`warehouse.inventory.history.${type}`, type),
qtyText: type === 'deduct' ? `-${qty}` : `+${qty}`,
qtyClass: type === 'deduct' ? 'is-deduct' : 'is-inbound',
refNo: pickField(normalized, 'refNo', 'RefNo') ?? '-',
remark: pickField(normalized, 'remark', 'Remark') ?? '-',
occurredAt: formatDateTime(pickField(normalized, 'occurredAt', 'OccurredAt')),
}
})
historyTotal.value = Number(total || 0)
} catch (e: any) {
historyRows.value = []
historyTotal.value = 0
$baseMessage(e?.message || t('warehouse.inventory.history.loadFailed'), 'error')
} finally {
historyLoading.value = false
}
}
async function showHistory(row: any) {
activeSku.value = row
historyTab.value = 'all'
historyPage.value = 1
historyVisible.value = true
await loadHistory()
}
function onHistoryTabChange(key: string | number) {
historyTab.value = String(key) as 'all' | 'inbound' | 'deduct'
historyPage.value = 1
void loadHistory()
}
function onHistoryPageChange(page: number) {
historyPage.value = page
void loadHistory()
}
function onHistoryPageSizeChange(size: number) {
historyPageSize.value = size
historyPage.value = 1
void loadHistory()
}
async function openRelocateModal(row: any) {
if (!hasPermission('Warehouse.Inventory.Relocate')) return
if (isAdmin.value && ensureMutationCustomerId() == null) return
@ -274,6 +366,7 @@ async function submitRelocate() {
function actionRenderer() {
const parts: string[] = [
renderWarehouseActionBtn('detail', t('warehouse.inventory.actions.binDetail'), 'view'),
renderWarehouseActionBtn('history', t('warehouse.inventory.actions.history'), 'history'),
]
if (hasPermission('Warehouse.Inventory.Relocate')) {
parts.push(renderWarehouseActionBtn('relocate', t('warehouse.inventory.actions.relocate')))
@ -283,6 +376,7 @@ function actionRenderer() {
function handleActionClick(row: any, _idx: number, action?: string) {
if (action === 'detail') showBinDetail(row)
if (action === 'history') void showHistory(row)
if (action === 'relocate') openRelocateModal(row)
}
@ -295,6 +389,7 @@ onMounted(async () => {
<template>
<div class="warehouse-inventory-container warehouse-list-page">
<div class="warehouse-list-page-card">
<div class="wh-page-tip">{{ t('warehouse.inventory.tip') }}</div>
<div class="table-toolbar">
<div class="toolbar-left">
<a-space wrap :size="8">
@ -344,23 +439,79 @@ onMounted(async () => {
:loading="listLoading"
:stretch-columns="true"
show-action-column
:action-column-width="90"
:action-column-width="120"
:action-renderer="actionRenderer"
@action-click="handleActionClick"
/>
</div>
</div>
<a-drawer v-model:visible="binDetailVisible" :title="t('warehouse.inventory.drawer.binDetail')" :width="520">
<a-drawer v-model:visible="binDetailVisible" :title="t('warehouse.inventory.drawer.binDetail')" :width="560">
<div v-if="activeSku" class="inv-drawer-hero">
<strong>{{ activeSku.skuCode }}</strong>
<span>{{ activeSku.skuName }}</span>
<span>{{ activeSku.warehouseName }}</span>
</div>
<a-table :data="binDetailRows" :pagination="false" size="small">
<template #columns>
<a-table-column :title="t('warehouse.inventory.table.binCode')" data-index="binCode" />
<a-table-column :title="t('warehouse.inventory.table.binName')" data-index="binName" />
<a-table-column :title="t('warehouse.inventory.table.qty')" data-index="qty" />
<a-table-column :title="t('warehouse.inventory.table.availableQty')" data-index="availableQty" />
<a-table-column :title="t('warehouse.inventory.table.frozenQty')" data-index="frozenQty" />
<a-table-column :title="t('warehouse.inventory.table.totalQty')" data-index="qty" />
</template>
</a-table>
</a-drawer>
<a-drawer
v-model:visible="historyVisible"
:title="t('warehouse.inventory.drawer.history')"
:width="640"
unmount-on-close
>
<div v-if="activeSku" class="inv-drawer-hero">
<strong>{{ activeSku.skuCode }}</strong>
<span>{{ activeSku.skuName }}</span>
<span>{{ activeSku.warehouseName }}</span>
</div>
<a-tabs :active-key="historyTab" type="rounded" size="small" @change="onHistoryTabChange">
<a-tab-pane key="all" :title="t('warehouse.inventory.history.all')" />
<a-tab-pane key="inbound" :title="t('warehouse.inventory.history.inbound')" />
<a-tab-pane key="deduct" :title="t('warehouse.inventory.history.deduct')" />
</a-tabs>
<a-spin :loading="historyLoading" style="width: 100%">
<a-table
v-if="historyRows.length"
:data="historyRows"
:pagination="false"
size="small"
>
<template #columns>
<a-table-column :title="t('warehouse.inventory.history.type')" data-index="typeLabel" :width="80" />
<a-table-column :title="t('warehouse.inventory.history.qty')" :width="80">
<template #cell="{ record }">
<span class="inv-qty" :class="record.qtyClass">{{ record.qtyText }}</span>
</template>
</a-table-column>
<a-table-column :title="t('warehouse.inventory.history.refNo')" data-index="refNo" />
<a-table-column :title="t('warehouse.inventory.history.remark')" data-index="remark" />
<a-table-column :title="t('warehouse.inventory.history.time')" data-index="occurredAt" :width="160" />
</template>
</a-table>
<a-empty v-else-if="!historyLoading" :description="t('warehouse.inventory.history.empty')" />
</a-spin>
<div class="inv-history-pager">
<PaginationPro
:total-count="historyTotal"
v-model:current-page="historyPage"
v-model:page-size="historyPageSize"
:page-sizes="[10, 30, 50, 100]"
@page-change="onHistoryPageChange"
@page-size-change="onHistoryPageSizeChange"
/>
</div>
</a-drawer>
<ModalPro
:title="t('warehouse.inventory.modal.relocate')"
:width="520"
@ -421,4 +572,40 @@ onMounted(async () => {
<style scoped lang="less">
@import '@/styles/warehouse-list-page.less';
@import '@/styles/warehouse-form-modal.less';
.inv-drawer-hero {
display: flex;
flex-wrap: wrap;
gap: 8px 12px;
align-items: center;
margin-bottom: 12px;
padding: 10px 12px;
border-radius: 8px;
background: #f7f8fa;
font-size: 13px;
color: #4e5969;
strong {
color: #1d2129;
font-size: 14px;
}
}
.inv-qty {
font-weight: 600;
&.is-inbound {
color: var(--app-primary-color, #2d8c8c);
}
&.is-deduct {
color: rgb(var(--danger-6));
}
}
.inv-history-pager {
margin-top: 12px;
display: flex;
justify-content: flex-end;
}
</style>

View File

@ -111,6 +111,12 @@ const detailTrackingNo = computed(() => {
const detailQuantityTotal = computed(() =>
detailItems.value.reduce((sum, item) => sum + (Number(item.quantity) || 0), 0),
)
const detailAvailableTotal = computed(() =>
detailItems.value.reduce((sum, item) => sum + (Number(item.availableQty) || 0), 0),
)
const detailFrozenTotal = computed(() =>
detailItems.value.reduce((sum, item) => sum + (Number(item.frozenQty) || 0), 0),
)
function escapeHtml(s: string) {
return String(s)
@ -195,44 +201,30 @@ function renderImageCell(row: any) {
)
}
const hotColumns = computed(() => [
{
key: 'trackingNo',
label: t('warehouse.parcel.table.trackingNo'),
width: 168,
renderer: renderTrackingNoCell,
},
{ key: 'carrierName', label: t('warehouse.parcel.table.carrierName'), width: 120 },
{
key: 'imageThumb',
label: t('warehouse.parcel.table.image'),
width: 72,
renderer: renderImageCell,
},
{
key: 'itemsSummary',
label: t('warehouse.parcel.table.items'),
width: 200,
renderer: renderDetailCell,
},
{
key: 'attributeSummary',
label: t('warehouse.parcel.table.attribute'),
width: 180,
renderer: renderDetailCell,
},
{
key: 'quantitySummary',
label: t('warehouse.parcel.table.quantity'),
width: 100,
renderer: renderDetailCell,
},
{ key: 'remark', label: t('warehouse.parcel.table.remark'), width: 140 },
{ key: 'lifecycleStatus', label: t('warehouse.parcel.table.lifecycleStatus'), width: 100 },
{ key: 'warehouseName', label: t('warehouse.parcel.table.warehouse'), width: 140 },
{ key: 'arrivalTime', label: t('warehouse.parcel.table.arrivalTime'), width: 160 },
{ key: 'createTime', label: t('warehouse.parcel.table.createTime'), width: 160 },
])
const hotColumns = computed(() => {
const cols: Array<{ key: string; label: string; width: number; renderer?: typeof renderTrackingNoCell }> = [
{ key: 'trackingNo', label: t('warehouse.parcel.table.trackingNo'), width: 168, renderer: renderTrackingNoCell },
{ key: 'carrierName', label: t('warehouse.parcel.table.carrierName'), width: 120 },
{ key: 'imageThumb', label: t('warehouse.parcel.table.image'), width: 72, renderer: renderImageCell },
{ key: 'itemsSummary', label: t('warehouse.parcel.table.items'), width: 200, renderer: renderDetailCell },
{ key: 'attributeSummary', label: t('warehouse.parcel.table.attribute'), width: 160, renderer: renderDetailCell },
{ key: 'availableQty', label: t('warehouse.parcel.table.availableQty'), width: 80 },
{ key: 'frozenQty', label: t('warehouse.parcel.table.frozenQty'), width: 80 },
{ key: 'quantitySummary', label: t('warehouse.parcel.table.quantity'), width: 80, renderer: renderDetailCell },
{ key: 'remark', label: t('warehouse.parcel.table.remark'), width: 120 },
{ key: 'lifecycleStatus', label: t('warehouse.parcel.table.lifecycleStatus'), width: 100 },
{ key: 'warehouseName', label: t('warehouse.parcel.table.warehouse'), width: 140 },
{ key: 'arrivalTime', label: t('warehouse.parcel.table.arrivalTime'), width: 160 },
{ key: 'createTime', label: t('warehouse.parcel.table.createTime'), width: 160 },
]
if (isAdmin.value) {
cols.unshift(
{ key: 'customerName', label: t('warehouse.common.customerName'), width: 120 },
{ key: 'customerCode', label: t('warehouse.common.customerCode'), width: 110 },
)
}
return cols
})
function openItemDetail(row: any) {
if (!isMultiItemRow(row)) return
@ -336,6 +328,9 @@ function mapRow(raw: Record<string, unknown>) {
const itemCount = Array.isArray(items) ? items.length : 0
return {
id: pickField<number>(row, 'id', 'Id'),
customerId: pickField<number>(row, 'customerId', 'CustomerId'),
customerName: pickField(row, 'customerName', 'CustomerName') ?? '',
customerCode: pickField(row, 'customerCode', 'CustomerCode') ?? '',
trackingNo: pickField(row, 'trackingNo', 'TrackingNo') ?? '-',
carrierName: pickField(row, 'carrierName', 'CarrierName') ?? '-',
lifecycleStatus: t(`warehouse.parcel.status.${status}`, status),
@ -343,6 +338,10 @@ function mapRow(raw: Record<string, unknown>) {
imageThumbUrl: pickFirstParcelItemImageUrl(items),
itemsSummary: summarizeParcelItems(items),
attributeSummary: summarizeParcelAttributes(items),
availableQty: pickField<number>(row, 'availableQty', 'AvailableQty')
?? normalizeParcelItemLines(items).reduce((s, i) => s + i.availableQty, 0),
frozenQty: pickField<number>(row, 'frozenQty', 'FrozenQty')
?? normalizeParcelItemLines(items).reduce((s, i) => s + i.frozenQty, 0),
quantitySummary: summarizeParcelQuantity(items),
arrivalTime: formatDateTime(pickField(row, 'arrivalTime', 'ArrivalTime')),
createTime: formatDateTime(pickField(row, 'createTime', 'CreateTime')),
@ -553,6 +552,7 @@ onMounted(async () => {
<template>
<div class="warehouse-parcel-container warehouse-list-page">
<div class="warehouse-list-page-card">
<div class="wh-page-tip">{{ t('warehouse.parcel.tip') }}</div>
<a-tabs
v-model:active-key="lifecycleStatus"
class="status-tabs"
@ -632,7 +632,9 @@ onMounted(async () => {
<div class="parcel-detail-drawer__meta">
<span>{{ t('warehouse.parcel.table.trackingNo') }}:{{ detailTrackingNo }}</span>
<span>
{{ t('warehouse.parcel.drawer.totalQty') }}:{{ detailQuantityTotal }}
{{ t('warehouse.parcel.drawer.availableQty') }} {{ detailAvailableTotal }}
· {{ t('warehouse.parcel.drawer.frozenQty') }} {{ detailFrozenTotal }}
· {{ t('warehouse.parcel.drawer.totalQty') }} {{ detailQuantityTotal }}
· {{ t('warehouse.parcel.drawer.itemCount', { n: detailItems.length }) }}
</span>
</div>
@ -669,10 +671,20 @@ onMounted(async () => {
data-index="attributeText"
:width="140"
/>
<a-table-column
:title="t('warehouse.parcel.table.availableQty')"
data-index="availableQty"
:width="72"
/>
<a-table-column
:title="t('warehouse.parcel.table.frozenQty')"
data-index="frozenQty"
:width="72"
/>
<a-table-column
:title="t('warehouse.parcel.form.quantity')"
data-index="quantity"
:width="80"
:width="72"
/>
<a-table-column
:title="t('warehouse.parcel.form.itemRemark')"

View File

@ -1,123 +1,137 @@
<template>
<div class="waybill-container">
<div class="waybill-layout">
<div class="form-section">
<div class="form-section-toolbar">
<a-checkbox v-model="keepScanFocus" size="small">
{{ $t('operation.common.keepScanFocus') }}
</a-checkbox>
<a-checkbox v-model="voiceEnabled" size="small">
{{ $t('operation.common.voiceBroadcast') }}
</a-checkbox>
<div class="ops-page">
<div class="ops-col ops-col--main">
<section class="ops-card ops-card--scan">
<div class="ops-card__head">
<span>{{ t('warehouse.parcelArrival.scan.title') }}</span>
</div>
<a-form :model="formData" layout="vertical" class="waybill-form">
<a-form-item
v-if="isAdmin"
:label="t('warehouse.common.customer')"
class="form-item-large"
>
<div class="ops-card__body ops-scan">
<div v-if="isAdmin" class="ops-scan__row">
<a-select
v-model="adminCustomerId"
allow-clear
allow-search
:placeholder="t('warehouse.common.selectCustomer')"
:options="customerOptions"
size="large"
class="large-input"
class="ops-select"
/>
</a-form-item>
<a-form-item :label="t('warehouse.parcelArrival.form.trackingNo')" class="form-item-large">
</div>
<div class="ops-scan__row">
<a-input
ref="scanInputRef"
v-model="formData.trackingNo"
:placeholder="t('warehouse.parcelArrival.form.placeholder.scanOrInput')"
size="large"
class="large-input"
class="ops-scan-input"
allow-clear
@press-enter="() => void handleSubmit()"
/>
</a-form-item>
<a-form-item :label="t('warehouse.common.warehouse')" class="form-item-large">
<a-input
:model-value="currentWarehouseLabel"
readonly
class="large-input readonly-field"
:placeholder="t('warehouse.common.noCurrentWarehouse')"
/>
</a-form-item>
<a-form-item>
<div class="form-actions">
<a-button class="reset-btn" @click="handleReset">
</div>
<div class="ops-scan__row ops-scan__row--tools">
<div class="ops-scan__opts">
<a-checkbox v-model="keepScanFocus" class="ops-opt">
{{ $t('operation.common.keepScanFocus') }}
</a-checkbox>
<a-checkbox v-model="voiceEnabled" class="ops-opt">
{{ $t('operation.common.voiceBroadcast') }}
</a-checkbox>
</div>
<div class="ops-scan__actions">
<a-button class="ops-btn ops-btn--ghost" @click="handleReset()">
{{ t('warehouse.parcelArrival.actions.reset') }}
</a-button>
<a-button
v-if="hasPermission('Operation.ParcelArrival.Save')"
type="primary"
class="submit-btn"
class="ops-btn ops-btn--primary"
:loading="submitting"
@click="handleSubmit"
>
{{ t('warehouse.parcelArrival.actions.arrive') }}
</a-button>
</div>
</a-form-item>
</a-form>
</div>
<div class="recent-orders-section">
<div class="list-toolbar">
<div class="toolbar-left">
<a-space wrap :size="8">
<a-input
v-model="keyword"
allow-clear
:placeholder="t('warehouse.parcelArrival.search.trackingNo')"
style="width: 200px"
@press-enter="handleSearch"
/>
<a-button type="primary" @click="handleSearch">
{{ t('warehouse.common.search') }}
</a-button>
</a-space>
<p
v-if="feedbackMessage"
class="scan-feedback-text"
:class="`is-${feedbackType}`"
>
{{ feedbackMessage }}
</p>
</div>
<div class="toolbar-right">
<div class="pagination-controls">
<PaginationPro
:total-count="totalCount"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[10, 30, 50, 100]"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
<p class="ops-scan-hint">{{ t('warehouse.parcelArrival.tip') }}</p>
</div>
</section>
<section class="ops-card ops-card--verify">
<div class="ops-card__head">
<span>{{ t('warehouse.parcelArrival.preview.title') }}</span>
<p
v-if="feedbackMessage"
class="ops-feedback"
:class="`is-${feedbackType}`"
>
{{ feedbackMessage }}
</p>
</div>
<div class="ops-card__body ops-verify">
<div class="ops-status-grid">
<div class="ops-status-item">
<span>{{ t('warehouse.common.warehouse') }}</span>
<strong>{{ currentWarehouseLabel || t('warehouse.common.noCurrentWarehouse') }}</strong>
</div>
<div class="ops-status-item">
<span>{{ t('warehouse.parcelArrival.form.trackingNo') }}</span>
<strong>{{ formData.trackingNo?.trim() || '-' }}</strong>
</div>
<div v-if="isAdmin" class="ops-status-item">
<span>{{ t('warehouse.common.customer') }}</span>
<strong>{{ selectedCustomerLabel || t('warehouse.common.selectCustomer') }}</strong>
</div>
</div>
<p class="ops-scan-hint" style="margin-top: 16px">
{{ t('warehouse.parcelArrival.preview.empty') }}
</p>
</div>
<div ref="tableContainerRef" class="list-wrap">
<HandsontablePro
:columns="hotColumns"
:data="tableRows"
:total="totalCount"
:current-page="currentPage"
:page-size="pageSize"
:height="tableHeight"
:loading="listLoading"
:read-only="true"
:stretch-columns="true"
show-action-column
:action-column-width="72"
:action-renderer="actionRenderer"
@action-click="handleActionClick"
/>
</div>
</div>
</section>
</div>
<aside class="ops-card ops-card--recent-wide">
<div class="ops-card__head">
<span>{{ t('warehouse.parcelArrival.recent.title') }}</span>
<span class="ops-recent__count">{{ totalCount }}</span>
</div>
<div class="ops-list-toolbar">
<a-space wrap :size="8">
<a-input
v-model="keyword"
allow-clear
:placeholder="t('warehouse.parcelArrival.search.trackingNo')"
style="width: 200px"
@press-enter="handleSearch"
/>
<a-button type="primary" class="ops-btn ops-btn--primary" @click="handleSearch">
{{ t('warehouse.common.search') }}
</a-button>
</a-space>
<PaginationPro
:total-count="totalCount"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[10, 30, 50, 100]"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
</div>
<div ref="tableContainerRef" class="ops-list-wrap">
<HandsontablePro
:columns="hotColumns"
:data="tableRows"
:total="totalCount"
:current-page="currentPage"
:page-size="pageSize"
:height="tableHeight"
:loading="listLoading"
:read-only="true"
:stretch-columns="true"
show-action-column
:action-column-width="72"
:action-renderer="actionRenderer"
@action-click="handleActionClick"
/>
</div>
</aside>
</div>
</template>
@ -183,6 +197,13 @@ const currentWarehouseLabel = computed(() => {
return currentWarehouseStore.warehouseName || String(id)
})
const selectedCustomerLabel = computed(() => {
const id = adminCustomerId.value
if (id == null) return ''
const hit = customerOptions.value.find((o: any) => o.value === id)
return hit?.label || String(id)
})
const hotColumns = computed(() => [
{ key: 'trackingNo', label: t('warehouse.parcelArrival.table.trackingNo'), width: 200 },
{ key: 'warehouseName', label: t('warehouse.parcelArrival.table.warehouse'), width: 160 },
@ -324,174 +345,5 @@ onMounted(() => {
</script>
<style lang="less" scoped>
.waybill-container {
padding: 16px;
background-color: #f0f3f4;
flex: 1;
min-height: 0;
overflow: hidden;
display: flex;
flex-direction: column;
}
.waybill-layout {
display: flex;
flex-direction: row;
align-items: stretch;
gap: 16px;
flex: 1;
min-height: 0;
min-width: 0;
}
.form-section {
background: #fff;
border-radius: 4px;
padding: 24px;
margin-bottom: 0;
flex: 3 1 0;
min-width: 0;
overflow-x: hidden;
overflow-y: auto;
align-self: stretch;
}
.form-section-toolbar {
display: flex;
justify-content: flex-end;
align-items: center;
gap: 16px;
margin: -4px 0 12px;
flex-shrink: 0;
}
.waybill-form {
.form-item-large {
:deep(.arco-form-item-label) {
font-size: 14px;
font-weight: 500;
color: #262626;
}
}
.large-input {
width: 100%;
max-width: 100%;
height: 48px;
font-size: 16px;
}
.readonly-field {
:deep(.arco-input) {
background-color: #f7f8fa;
color: #4e5969;
cursor: default;
}
}
.form-actions {
display: flex;
gap: 8px;
margin-top: 8px;
.reset-btn,
.submit-btn {
min-width: 100px;
height: 32px;
border-radius: 4px;
}
}
}
.recent-orders-section {
background: #fff;
border-radius: 4px;
padding: 0;
flex: 7 1 0;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
.list-toolbar {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding: 16px 16px 0;
margin-bottom: 16px;
flex-shrink: 0;
flex-wrap: nowrap;
gap: 12px;
.toolbar-left {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 8px;
}
.scan-feedback-text {
margin: 0;
font-size: 16px;
line-height: 1.5;
word-break: break-word;
&.is-error {
color: #f53f3f;
font-weight: 700;
}
&.is-success {
color: #00b42a;
font-weight: 600;
}
&.is-warning {
color: #d46b08;
font-weight: 600;
}
}
.toolbar-right .pagination-controls {
display: flex;
align-items: center;
gap: 8px;
white-space: nowrap;
flex-wrap: nowrap;
}
}
.list-wrap {
width: 100%;
flex: 1;
min-height: 0;
padding: 0 16px 16px;
box-sizing: border-box;
display: flex;
flex-direction: column;
overflow: hidden;
overscroll-behavior: contain;
touch-action: pan-x pan-y;
}
}
@media (max-width: 992px) {
.waybill-layout {
flex-direction: column;
overflow-y: auto;
}
.form-section {
flex: 0 0 auto;
max-width: none;
width: 100%;
min-width: 0;
}
.recent-orders-section {
flex: 1;
min-height: 360px;
}
}
@import '@/views/operation/styles/ops-scan-page.less';
</style>

View File

@ -88,15 +88,24 @@ const currentWarehouseLabel = computed(() => {
)
})
const hotColumns = computed(() => [
{ key: 'skuCode', label: t('warehouse.sku.table.skuCode'), width: 140 },
{ key: 'skuName', label: t('warehouse.sku.table.skuName'), width: 180 },
{ key: 'totalQty', label: t('warehouse.sku.table.totalQty'), width: 80 },
{ key: 'weightG', label: t('warehouse.sku.table.weightG'), width: 90 },
{ key: 'dimensions', label: t('warehouse.sku.table.dimensions'), width: 120 },
{ key: 'remark', label: t('warehouse.sku.table.remark'), width: 140 },
{ key: 'createTime', label: t('warehouse.sku.table.createTime'), width: 160 },
])
const hotColumns = computed(() => {
const cols = [
{ key: 'skuCode', label: t('warehouse.sku.table.skuCode'), width: 140 },
{ key: 'skuName', label: t('warehouse.sku.table.skuName'), width: 180 },
{ key: 'totalQty', label: t('warehouse.sku.table.totalQty'), width: 90 },
{ key: 'weightG', label: t('warehouse.sku.table.weightG'), width: 90 },
{ key: 'dimensions', label: t('warehouse.sku.table.dimensions'), width: 120 },
{ key: 'remark', label: t('warehouse.sku.table.remark'), width: 140 },
{ key: 'createTime', label: t('warehouse.sku.table.createTime'), width: 160 },
]
if (isAdmin.value) {
cols.unshift(
{ key: 'customerName', label: t('warehouse.common.customerName'), width: 120 },
{ key: 'customerCode', label: t('warehouse.common.customerCode'), width: 110 },
)
}
return cols
})
function resetForm() {
formModel.id = 0
@ -170,6 +179,9 @@ function mapRow(raw: Record<string, unknown>) {
const row = normalizeListRow(raw)
return {
id: pickField<number>(row, 'id', 'Id'),
customerId: pickField<number>(row, 'customerId', 'CustomerId'),
customerName: pickField(row, 'customerName', 'CustomerName') ?? '',
customerCode: pickField(row, 'customerCode', 'CustomerCode') ?? '',
skuCode: pickField(row, 'skuCode', 'SkuCode') ?? '-',
skuName: pickField(row, 'skuName', 'SkuName') ?? '-',
totalQty: pickField<number>(row, 'totalQty', 'TotalQty') ?? 0,
@ -319,6 +331,7 @@ onMounted(async () => {
<template>
<div class="warehouse-sku-container warehouse-list-page">
<div class="warehouse-list-page-card">
<div class="wh-page-tip">{{ t('warehouse.sku.tip') }}</div>
<div class="table-toolbar">
<div class="toolbar-left">
<a-space wrap :size="8">

View File

@ -51,6 +51,7 @@ export default defineConfig(({ mode }) => {
'/order/priceCheck',
'/order/placeOrder',
'/order/myOrders',
'/order/waybillManage',
'/order/pickupOrder',
'/order/batchJobs',
'/order/templateMapping',
@ -347,6 +348,7 @@ export default defineConfig(({ mode }) => {
'/order/priceCheck',
'/order/placeOrder',
'/order/myOrders',
'/order/waybillManage',
'/order/pickupOrder',
'/order/batchJobs',
'/order/platformStore',