feat(b2b): 新增备货齐套校验开关,完善货主签约/外部仓库信息展示
- setting.warehouse 新增 b2b_packing_quantity_check(默认关闭):开启后 B2B 备货完成 会校验「分箱数量合计 = 应备数量」与「总箱数 = 箱号数」,不符时返回 400 与差异明细; 仓库设置表单补充该开关与说明 - 待处理/配送 B2B 接口补充驼峰别名与图片参数简写 (pickupPlateNumber、pickupFileIds、file_ids、fileIds、pickup_images、orderItemId、boxNo), 配送 B2B 列表说明补充 images / pickup_images 字段结构 - 货主签约与外部仓库页面补充「对方角色」列与详情、我方/对方主体 ID、 待我确认状态;余额日志兼容 balance_before / balance_after 旧字段, 新增「对方主体ID」等值筛选,分页规格统一支持 200 条 - 新增《拣货单模板 148×210 设计与实施》文档及模板 JSON,供波次批量打印拣货单使用
This commit is contained in:
parent
ade15558ca
commit
afb52cf83f
169
docs/拣货单模板-148x210-设计与实施.md
Normal file
169
docs/拣货单模板-148x210-设计与实施.md
Normal file
@ -0,0 +1,169 @@
|
||||
# 拣货单模板(148mm × 210mm)设计与实施
|
||||
|
||||
> 使用场景:`/order/waveOrder` —— **团购波次**、**散单波次** 页面的「批量打印拣货单」。
|
||||
> 涉及代码:`GroupWaveBatchListPanel.vue` / `SandanWaveBatchListPanel.vue`(`business-type="PICKING"`)
|
||||
> → `components/BatchReceivingPrintDialog.vue` → `utils/printPaginate.ts`
|
||||
|
||||
## 一、数据来源与可选字段
|
||||
|
||||
`openBatchPrintDialog` 组装出的打印数据(`wavePrintDataMap[wave_id]`):
|
||||
|
||||
```
|
||||
form = {
|
||||
...首个订单(normalizePrintOrder 后), // 含 address / express_code / waybill_code / create_at ...
|
||||
wave_no,
|
||||
details: [全部订单(normalizePrintOrder 后)]
|
||||
}
|
||||
```
|
||||
|
||||
`normalizePrintOrder` 会补:`address`(省市区镇+详细地址拼接)、`express_code`(多来源回退)、
|
||||
`waybill_code`(= express_code)、`create_at`、`order_create_time`、`print_time`。
|
||||
|
||||
| 位置 | 可用字段 |
|
||||
| --- | --- |
|
||||
| 单据头(顶层) | `wave_no`、`sys_platform_name`、`sys_logistics_name`、`create_at`、`print_time`(自动)、`remark`、`delivery_order_code` 等订单字段(取首单) |
|
||||
| 明细表(`details` 每行) | `delivery_order_code`、`express_code`/`waybill_code`、`name`(收件人)、`mobile`、`province`、`city`、`area`、`items_total`、`items_weight`、`remark` |
|
||||
|
||||
⚠️ 限制:
|
||||
|
||||
- 表格**没有行号变量**,不要设计「序号」列(会整列为空)。
|
||||
- 波次打印的 `details` 是**订单维度**,不是商品维度 —— 无法在模板里输出商品明细。
|
||||
- 表格单元格固定 `text-align: center`(渲染代码写死),`textAlign` 只对普通 text 生效。
|
||||
- 分隔线/签字线必须是 `type: "shape"` + `shapeType: "line"`;旧模板的 `type: "line"` 不渲染。
|
||||
- 分页截止线 = 表格下方**最近的 text 元素 top**(本模板 = 备注行 179mm,表格 top 61、表头 6mm)→ 每页约 18 行。
|
||||
|
||||
## 二、生产环境原始数据备份(改动前)
|
||||
|
||||
`wms.wms.gztbyc.com` · `wms_print_template` · **id = 16**
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 16,
|
||||
"template_name": "拣货单",
|
||||
"platform": "default",
|
||||
"template_type": "CUSTOM",
|
||||
"template_url": "NONE",
|
||||
"template_content": [],
|
||||
"page_width": 76,
|
||||
"page_height": 130,
|
||||
"warehouse_id": null,
|
||||
"is_default": false,
|
||||
"status": "ACTIVE",
|
||||
"create_at": "2026-05-11T14:23:06.000Z",
|
||||
"update_at": "2026-05-11T14:23:06.000Z",
|
||||
"business_type": "PICKING",
|
||||
"delete_at": null,
|
||||
"editable": false,
|
||||
"deletable": false,
|
||||
"isGeneral": true
|
||||
}
|
||||
```
|
||||
|
||||
> 回滚:`page_width=76, page_height=130, template_content=[]`
|
||||
> 说明:`warehouse_id=null` + `isGeneral=true` → 后端返回 `editable:false`,页面「编辑」按钮隐藏,只能改库/接口。
|
||||
|
||||
## 三、版式设计(A5 纵向 148×210,页边距 10mm,内容宽 128mm)
|
||||
|
||||
| # | 元素 | top | left | 宽 | 高 | 内容/字段 |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| 1 | 标题 18pt 粗 居中 | 6 | 0 | 148 | 10 | 拣 货 单 |
|
||||
| 2 | 横线 | 17.5 | 10 | 128 | 1 | |
|
||||
| 3 | 波次号: 10pt | 21 | 10 | 20 | 7 | 静态文字 |
|
||||
| 4 | 波次号值 13pt 粗 | 21 | 30 | 60 | 7 | `wave_no` |
|
||||
| 5 | 平台: 10pt | 21 | 92 | 12 | 7 | 静态文字 |
|
||||
| 6 | 平台值 10pt | 21 | 104 | 34 | 7 | `sys_platform_name` |
|
||||
| 7 | 物流公司: 10pt | 30 | 10 | 24 | 7 | 静态文字 |
|
||||
| 8 | 物流公司值 10pt | 30 | 34 | 56 | 7 | `sys_logistics_name` |
|
||||
| 9 | 创建时间: 10pt | 39 | 10 | 24 | 7 | 静态文字 |
|
||||
| 10 | 创建时间值 10pt | 39 | 34 | 56 | 7 | `create_at` |
|
||||
| 11 | 波次号条码(44×10,靠右) | 29 | 94 | 44 | 10 | `wave_no`(Code128) |
|
||||
| 12 | 横线 | 48 | 10 | 128 | 1 | |
|
||||
| 13 | 「订单明细」12pt 粗 | 51 | 10 | 60 | 8 | |
|
||||
| 14 | 表格(订单明细) | 61 | 10 | 128 | 110 | 行高/表头 6mm,9pt |
|
||||
| 15 | 横线 | 176 | 10 | 128 | 1 | |
|
||||
| 16 | 备注: 9pt | 179 | 10 | 14 | 6 | 静态文字 |
|
||||
| 17 | 备注值 9pt 自动换行 | 179 | 24 | 114 | 10 | `remark` |
|
||||
| 18 | 打印时间: 9pt | 191 | 10 | 24 | 6 | 静态文字 |
|
||||
| 19 | 打印时间值 9pt | 191 | 34 | 46 | 6 | `print_time`(弹窗自动填) |
|
||||
| 20 | 拣货人: 9pt | 199 | 10 | 20 | 6 | 静态文字 |
|
||||
| 21 | 拣货人签字线 | 205 | 10 | 38 | 1 | |
|
||||
| 22 | 复核人: 9pt | 199 | 68 | 20 | 6 | 静态文字 |
|
||||
| 23 | 复核人签字线 | 205 | 68 | 34 | 1 | |
|
||||
|
||||
表格列(合计 128mm):
|
||||
|
||||
| 列 | 宽 | 字段 |
|
||||
| --- | --- | --- |
|
||||
| 订单号 | 38 | `delivery_order_code` |
|
||||
| 物流单号 | 44 | `express_code` |
|
||||
| 收件人 | 20 | `name` |
|
||||
| 件数 | 12 | `items_total` |
|
||||
| 省份 | 14 | `province` |
|
||||
|
||||
> 条码元素内容 = `wave_no`(Code128),仅用于手持枪快速定位波次;若仓库不需要扫码,可在编辑器里直接删掉该元素,或改小到 30×8mm。
|
||||
>
|
||||
> 若不想打印条码,也可换成二维码(`type: "qrcode"`,同样取 `wave_no`)。
|
||||
|
||||
## 四、模板内容 JSON
|
||||
|
||||
见同目录 `拣货单模板-148x210.json`。
|
||||
|
||||
## 五、写回方式与实测结论
|
||||
|
||||
### 5.1 接口不可用(生产环境实测 2026-11-19)
|
||||
|
||||
| 试探 | 结果 |
|
||||
| --- | --- |
|
||||
| `setting.printTemplate.save` 写 id=16(148×210 + 新内容) | `code:500 保存打印模板失败` |
|
||||
| `setting.printTemplate.save` 写 id=16(76×130 + `[]`,完全无变化) | `code:500 保存打印模板失败` |
|
||||
| `setting.printTemplate.save` 写 id=17(原样回存) | `code:200 模板更新成功` |
|
||||
| `setting.printTemplate.update` / `.get` | `code:500 接口错误: 方法 update/get 不存在` |
|
||||
|
||||
结论:**不是内容校验问题**,而是 `warehouse_id IS NULL` 的「通用预设」被后端保护
|
||||
(`isGeneral:true` → `editable:false` / `deletable:false`),接口层面无法写入。
|
||||
生产环境只能走**直接改库**。
|
||||
|
||||
> 若希望生产也能在页面上编辑:把该模板 `warehouse_id` 绑到具体仓库(语义会从「全仓通用」变为「某仓专用」),或另建一条自定义模板。
|
||||
|
||||
### 5.2 开发库已写入
|
||||
|
||||
`192.168.11.56:3307` / `wms` / `wms_print_template` id=16:
|
||||
|
||||
```sql
|
||||
UPDATE wms_print_template
|
||||
SET page_width = 148, page_height = 210, template_content = '<docs/拣货单模板-148x210.json 内容>'
|
||||
WHERE id = 16 AND business_type = 'PICKING' AND JSON_VALID(template_content);
|
||||
```
|
||||
|
||||
结果:`affectedRows=1`,回读 `page_width=148`、`page_height=210`、`JSON_VALID=1`、`JSON_LENGTH=23`。
|
||||
|
||||
### 5.3 生产库待执行(需有库权限)
|
||||
|
||||
```sql
|
||||
-- 备份
|
||||
SELECT id, template_name, page_width, page_height, warehouse_id, template_content
|
||||
FROM wms_print_template WHERE id = 16;
|
||||
|
||||
-- 写入(template_content 取 docs/拣货单模板-148x210.json 的单行 JSON)
|
||||
UPDATE wms_print_template
|
||||
SET page_width = 148, page_height = 210, template_content = '<JSON>'
|
||||
WHERE id = 16 AND business_type = 'PICKING' AND warehouse_id IS NULL;
|
||||
|
||||
-- 校验
|
||||
SELECT id, template_name, page_width, page_height,
|
||||
JSON_VALID(template_content) AS valid, JSON_LENGTH(template_content) AS el_cnt
|
||||
FROM wms_print_template WHERE id = 16;
|
||||
```
|
||||
|
||||
回滚:
|
||||
|
||||
```sql
|
||||
UPDATE wms_print_template
|
||||
SET page_width = 76, page_height = 130, template_content = '[]'
|
||||
WHERE id = 16;
|
||||
```
|
||||
|
||||
### 5.4 生产环境遗留问题(与本模板无关,建议一并处理)
|
||||
|
||||
生产 id=17「拣货单模板」(148×210,warehouse 1000028)里当前是**备货单版式**(上次迁移时写入),
|
||||
名称与内容不一致;需要确认是改名成「备货单」还是清空/重写。
|
||||
31
docs/拣货单模板-148x210.json
Normal file
31
docs/拣货单模板-148x210.json
Normal file
@ -0,0 +1,31 @@
|
||||
[
|
||||
{"id":"text_title","type":"text","title":"拣货单","name":"拣货单","content":"拣 货 单","top":6,"left":0,"width":148,"height":10,"fontSize":18,"bold":true,"italic":false,"underline":false,"rotate":0,"autoWrap":true,"textAlign":"center","lineHeight":10,"custom":true},
|
||||
{"id":"shape_line_top","type":"shape","shapeType":"line","title":"横线","content":"","top":17.5,"left":10,"width":128,"height":1,"lineWeight":1,"lineStyle":"solid"},
|
||||
{"id":"text_lb_wave_no","type":"text","title":"波次号","name":"波次号","content":"波次号:","top":21,"left":10,"width":20,"height":7,"fontSize":10,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":7,"custom":true},
|
||||
{"id":"text_v_wave_no","type":"text","title":"波次号","content":"波次号","top":21,"left":30,"width":60,"height":7,"fontSize":13,"bold":true,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":7,"field_code":"wave_no"},
|
||||
{"id":"text_lb_platform","type":"text","title":"平台","name":"平台","content":"平台:","top":21,"left":92,"width":12,"height":7,"fontSize":10,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":7,"custom":true},
|
||||
{"id":"text_v_platform","type":"text","title":"平台","content":"平台","top":21,"left":104,"width":34,"height":7,"fontSize":10,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":7,"field_code":"sys_platform_name"},
|
||||
{"id":"text_lb_logistics","type":"text","title":"物流公司","name":"物流公司","content":"物流公司:","top":30,"left":10,"width":24,"height":7,"fontSize":10,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":7,"custom":true},
|
||||
{"id":"text_v_logistics","type":"text","title":"物流公司","content":"物流公司","top":30,"left":34,"width":56,"height":7,"fontSize":10,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":7,"field_code":"sys_logistics_name"},
|
||||
{"id":"text_lb_create","type":"text","title":"创建时间","name":"创建时间","content":"创建时间:","top":39,"left":10,"width":24,"height":7,"fontSize":10,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":7,"custom":true},
|
||||
{"id":"text_v_create","type":"text","title":"创建时间","content":"创建时间","top":39,"left":34,"width":56,"height":7,"fontSize":10,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":7,"field_code":"create_at"},
|
||||
{"id":"barcode_wave_no","type":"barcode","title":"波次号","content":"波次号","top":29,"left":94,"width":44,"height":10,"fontSize":8,"rotate":0,"field_code":"wave_no"},
|
||||
{"id":"shape_line_mid","type":"shape","shapeType":"line","title":"横线","content":"","top":48,"left":10,"width":128,"height":1,"lineWeight":1,"lineStyle":"solid"},
|
||||
{"id":"text_section","type":"text","title":"订单明细","name":"订单明细","content":"订单明细","top":51,"left":10,"width":60,"height":8,"fontSize":12,"bold":true,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":8,"custom":true},
|
||||
{"id":"table_orders","type":"table","name":"table","title":"订单明细","top":61,"left":10,"width":128,"height":110,"rowHeight":6,"headerHeight":6,"rows":[
|
||||
{"id":"col_delivery_order_code","type":"text","title":"订单号","content":"订单号","width":38,"height":6,"fontSize":"9","textAlign":"left","bold":false,"field_code":"delivery_order_code"},
|
||||
{"id":"col_express_code","type":"text","title":"物流单号","content":"物流单号","width":44,"height":6,"fontSize":"9","textAlign":"left","bold":false,"field_code":"express_code"},
|
||||
{"id":"col_receiver","type":"text","title":"收件人","content":"收件人","width":20,"height":6,"fontSize":"9","textAlign":"center","bold":false,"field_code":"name"},
|
||||
{"id":"col_items_total","type":"text","title":"件数","content":"件数","width":12,"height":6,"fontSize":"9","textAlign":"center","bold":false,"field_code":"items_total"},
|
||||
{"id":"col_province","type":"text","title":"省份","content":"省份","width":14,"height":6,"fontSize":"9","textAlign":"center","bold":false,"field_code":"province"}
|
||||
]},
|
||||
{"id":"shape_line_bottom","type":"shape","shapeType":"line","title":"横线","content":"","top":176,"left":10,"width":128,"height":1,"lineWeight":1,"lineStyle":"solid"},
|
||||
{"id":"text_lb_remark","type":"text","title":"备注","name":"备注","content":"备注:","top":179,"left":10,"width":14,"height":6,"fontSize":9,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":6,"custom":true},
|
||||
{"id":"text_v_remark","type":"text","title":"备注","content":"备注","top":179,"left":24,"width":114,"height":10,"fontSize":9,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":true,"textAlign":"left","lineHeight":5,"field_code":"remark"},
|
||||
{"id":"text_lb_print_time","type":"text","title":"打印时间","name":"打印时间","content":"打印时间:","top":191,"left":10,"width":24,"height":6,"fontSize":9,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":6,"custom":true},
|
||||
{"id":"text_v_print_time","type":"text","title":"打印时间","content":"打印时间","top":191,"left":34,"width":46,"height":6,"fontSize":9,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":6,"field_code":"print_time"},
|
||||
{"id":"text_lb_picker","type":"text","title":"拣货人","name":"拣货人","content":"拣货人:","top":199,"left":10,"width":20,"height":6,"fontSize":9,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":6,"custom":true},
|
||||
{"id":"shape_sign_picker","type":"shape","shapeType":"line","title":"横线","content":"","top":205,"left":10,"width":38,"height":1,"lineWeight":1,"lineStyle":"solid"},
|
||||
{"id":"text_lb_checker","type":"text","title":"复核人","name":"复核人","content":"复核人:","top":199,"left":68,"width":20,"height":6,"fontSize":9,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":6,"custom":true},
|
||||
{"id":"shape_sign_checker","type":"shape","shapeType":"line","title":"横线","content":"","top":205,"left":68,"width":34,"height":1,"lineWeight":1,"lineStyle":"solid"}
|
||||
]
|
||||
@ -251,6 +251,8 @@ export function orderDeliveryOrderList(data: DeliveryOrderListParams = {}): Prom
|
||||
* total_box_count、pickup_plate_number、prep_remark、prep_duration_seconds、is_urgent(Y/N)、prep_at、
|
||||
* is_picked_up(Y/N)、picked_up_at、created_at(作业明细创建时间,与订单 create_at 不同)、
|
||||
* prep_status(none/padding/fin)、prep_operator_id、prep_operator_name、prep_start_at
|
||||
* - 行内另带出 images(备货留证照片 business_type=b2b_order)与 pickup_images(提货留证照片 b2b_pickup),
|
||||
* 元素 { id: file_id, url, display_order },无图片时为空数组(两者一次查询后分组输出)
|
||||
* - where 额外支持(仅 B2B 列表开放,普通列表不识别):total_box_count / pickup_plate_number / prep_remark /
|
||||
* prep_duration_seconds / is_picked_up / picked_up_at / created_at / prep_at / is_urgent /
|
||||
* prep_status / prep_operator_id / prep_start_at(支持简写与 {operator,value} 标准结构,prep_at 支持 between)
|
||||
|
||||
@ -697,8 +697,18 @@ export function orderPendingOrderFinishB2bPrep(
|
||||
export type PendingOrderPickupB2bParams = PendingOrderB2bOrderIdParams & {
|
||||
/** 提货车牌(可选;归一化后写入 wms_order_b2b.pickup_plate_number) */
|
||||
pickup_plate_number?: string | null;
|
||||
/** 车牌驼峰别名(与 pickup_plate_number 等价) */
|
||||
pickupPlateNumber?: string | null;
|
||||
/** 提货照片 file_id 列表(可选;兼容 pickupFileIds / file_ids / fileIds / pickup_images) */
|
||||
pickup_file_ids?: PendingOrderB2bImageInput[];
|
||||
/** 提货照片 file_id 列表驼峰别名 */
|
||||
pickupFileIds?: PendingOrderB2bImageInput[];
|
||||
/** 提货照片 file_id 数组简写 */
|
||||
file_ids?: number[];
|
||||
/** 提货照片 file_id 数组驼峰简写 */
|
||||
fileIds?: number[];
|
||||
/** 提货照片(与 pickup_file_ids 等价的兼容字段名) */
|
||||
pickup_images?: PendingOrderB2bImageInput[];
|
||||
};
|
||||
|
||||
export type PendingOrderPickupB2bResponse = {
|
||||
@ -835,6 +845,8 @@ export type PendingOrderSetB2bPickupPlateParams = {
|
||||
ids: number[];
|
||||
/** 提货车牌;空字符串或 null 表示清空 */
|
||||
pickup_plate_number: string | null;
|
||||
/** 车牌驼峰别名(与 pickup_plate_number 等价,后端兼容) */
|
||||
pickupPlateNumber?: string | null;
|
||||
};
|
||||
|
||||
export type PendingOrderSetB2bPickupPlateResponse = {
|
||||
@ -875,7 +887,11 @@ export type PendingOrderUpdateB2bOrderImagesParams = {
|
||||
/** 订单ID:单订单作业,仅允许传 1 个(单值或单元素数组) */
|
||||
ids: number[];
|
||||
/** 备货照片列表(全量覆盖;支持 file_id 或 { file_id, display_order }) */
|
||||
images: PendingOrderB2bImageInput[];
|
||||
images?: PendingOrderB2bImageInput[];
|
||||
/** file_id 数组简写(与 images 等价,后端兼容;与 fileIds 二选一) */
|
||||
file_ids?: number[];
|
||||
/** file_id 数组驼峰简写(与 file_ids 等价) */
|
||||
fileIds?: number[];
|
||||
};
|
||||
|
||||
export type PendingOrderUpdateB2bOrderImagesResponse = {
|
||||
@ -983,6 +999,10 @@ export type PendingOrderB2bPackingItem = {
|
||||
box_no: string;
|
||||
/** 该商品在该箱的正整数数量 */
|
||||
quantity: number;
|
||||
/** 商品明细ID 驼峰别名(与 order_item_id 等价,后端兼容) */
|
||||
orderItemId?: number;
|
||||
/** 箱号驼峰别名(与 box_no 等价) */
|
||||
boxNo?: string;
|
||||
};
|
||||
|
||||
export type PendingOrderUpdateB2bPackingItemsParams = {
|
||||
|
||||
@ -175,6 +175,12 @@ export type SettingWarehouseSubjectConfig = SettingWarehouseSenderConfig & {
|
||||
* 仅接受布尔/like-flag(true/1/'1'/'true' → true;false/0/'0'/'false' → false),非法值报 400
|
||||
*/
|
||||
single_weigh_require_pack?: boolean
|
||||
/**
|
||||
* B2B 备货完成是否校验逐商品分箱齐套(flag,默认 false 关闭)。开启后分箱数量合计须等于订单商品 plan_qty,
|
||||
* 且总箱数须等于箱号数;不符时备货完成接口返回 400(data.item_mismatches),事务回滚。
|
||||
* 仅接受布尔/like-flag(true/1/'1'/'true' → true;false/0/'0'/'false' → false),非法值报 400
|
||||
*/
|
||||
b2b_packing_quantity_check?: boolean
|
||||
/** 拆包最大录制时长,单位:分钟,默认 5,min 1;超过上限时拆包提交的结束时间自动截断为开始时间+上限 */
|
||||
return_unpack_max_record_minutes?: number
|
||||
max_wave_quantity?: number
|
||||
@ -447,6 +453,14 @@ export function normalizeWarehouseSubjectConfig(
|
||||
weighRequirePack === '1' ||
|
||||
weighRequirePack === 'true'
|
||||
|
||||
// B2B 备货完成是否校验逐商品分箱齐套(flag,默认 false 关闭;同一套 like-flag 口径)
|
||||
const b2bPackingCheck = base.b2b_packing_quantity_check
|
||||
base.b2b_packing_quantity_check =
|
||||
b2bPackingCheck === true ||
|
||||
b2bPackingCheck === 1 ||
|
||||
b2bPackingCheck === '1' ||
|
||||
b2bPackingCheck === 'true'
|
||||
|
||||
// 默认库位(库位ID,未配置时为 null)
|
||||
const locIdRaw = base.default_location_id
|
||||
if (locIdRaw === undefined || locIdRaw === null || locIdRaw === '') {
|
||||
|
||||
@ -51,6 +51,7 @@
|
||||
:table-size="tableSize"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100, 200]"
|
||||
:show-index="true"
|
||||
:show-selection="true"
|
||||
:show-actions="true"
|
||||
@ -67,6 +68,11 @@
|
||||
<span>{{ row.remask || row.counterparty_name }}</span>
|
||||
<span v-if="row.remask && row.remask !== row.counterparty_name" class="real-name">({{ row.counterparty_name }})</span>
|
||||
</template>
|
||||
<template #column-counterparty_role="{ row }">
|
||||
<span :class="getStatusTextClass(row.counterparty_role === 'warehouse' ? 'primary' : 'warning')">
|
||||
{{ getCounterpartyRoleLabel(row.counterparty_role) }}
|
||||
</span>
|
||||
</template>
|
||||
<template #column-auth_status="{ row }">
|
||||
<span :class="getStatusTextClass(getAuthStatusType(row.auth_status))">
|
||||
{{ row.auth_status_label || getAuthStatusLabel(row.auth_status) }}
|
||||
@ -152,12 +158,12 @@
|
||||
{{ currentSubject.company_name }}
|
||||
<el-tag size="small" type="primary" effect="plain" style="margin-left:6px">仓库方</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="签约货主" :span="currentSubject.company_name ? 1 : 2">
|
||||
<el-descriptions-item label="对方主体" :span="currentSubject.company_name ? 1 : 2">
|
||||
{{ selectedRow.remask || selectedRow.counterparty_name || '—' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
v-if="selectedRow.counterparty_name && selectedRow.remask"
|
||||
label="货主全称"
|
||||
label="对方全称"
|
||||
:span="2"
|
||||
>
|
||||
{{ selectedRow.counterparty_name }}
|
||||
@ -175,8 +181,13 @@
|
||||
{{ selectedRow.auth_status_label || getAuthStatusLabel(selectedRow.auth_status) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="货主ID">{{ selectedRow.store_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="仓库ID">{{ selectedRow.warehouse_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="己方主体ID">{{ selectedRow.store_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="对方主体ID">{{ selectedRow.warehouse_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="对方角色">
|
||||
<span :class="getStatusTextClass(selectedRow.counterparty_role === 'warehouse' ? 'primary' : 'warning')">
|
||||
{{ getCounterpartyRoleLabel(selectedRow.counterparty_role) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="使用状态">
|
||||
<span :class="getStatusTextClass(selectedRow.use_status === 1 ? 'success' : 'info')">
|
||||
{{ selectedRow.use_status === 1 ? '启用' : '禁用' }}
|
||||
@ -460,6 +471,7 @@ function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
|
||||
|
||||
const columns = [
|
||||
{ prop: 'counterparty_name', label: '对方主体', minWidth: 140 },
|
||||
{ prop: 'counterparty_role', label: '对方角色', width: 100 },
|
||||
{ prop: 'auth_status', label: '签约状态', width: 100 },
|
||||
{ prop: 'needs_my_confirm', label: '待确认', width: 90 },
|
||||
{ prop: 'use_status', label: '使用状态', width: 90 },
|
||||
@ -477,6 +489,17 @@ const availableFields = [
|
||||
group: '基础信息',
|
||||
placeholder: '搜索对方主体名或备注'
|
||||
},
|
||||
{
|
||||
label: '对方主体ID',
|
||||
value: 'warehouse_id',
|
||||
type: 'number',
|
||||
group: '基础信息',
|
||||
placeholder: '对方主体ID(兼容 counterparty_id)',
|
||||
// 文档:warehouse_id(兼容 counterparty_id),等值匹配
|
||||
operators: ['eq'],
|
||||
defaultOperator: 'eq',
|
||||
hideOperator: true
|
||||
},
|
||||
{
|
||||
label: '签约状态',
|
||||
value: 'auth_status',
|
||||
@ -485,7 +508,8 @@ const availableFields = [
|
||||
{ label: '待审核', value: 1 },
|
||||
{ label: '已通过', value: 2 },
|
||||
{ label: '已拒绝', value: 3 },
|
||||
{ label: '已解除', value: 4 }
|
||||
{ label: '已解除', value: 4 },
|
||||
{ label: '已过期', value: 5 }
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -689,15 +713,22 @@ function handleSelectionChange(rows: any[]) {
|
||||
}
|
||||
|
||||
function getAuthStatusType(status: number): string {
|
||||
const map: Record<number, string> = { 1: 'warning', 2: 'success', 3: 'danger', 4: 'info' }
|
||||
const map: Record<number, string> = { 1: 'warning', 2: 'success', 3: 'danger', 4: 'info', 5: 'danger' }
|
||||
return map[status] || 'info'
|
||||
}
|
||||
|
||||
function getAuthStatusLabel(status: number): string {
|
||||
const map: Record<number, string> = { 1: '待审核', 2: '已通过', 3: '已拒绝', 4: '已解除' }
|
||||
const map: Record<number, string> = { 1: '待审核', 2: '已通过', 3: '已拒绝', 4: '已解除', 5: '已过期' }
|
||||
return map[status] || '未知'
|
||||
}
|
||||
|
||||
/** 对方主体角色(文档 counterparty_role):warehouse=外部合作仓库,store=货主 */
|
||||
function getCounterpartyRoleLabel(role?: string): string {
|
||||
if (role === 'warehouse') return '仓库方'
|
||||
if (role === 'store') return '货主方'
|
||||
return '—'
|
||||
}
|
||||
|
||||
// ─── 修改备注(弹窗表单,对齐「手工录入运单号」) ─────────────────────────────
|
||||
const renameDialogVisible = ref(false)
|
||||
const renameLoading = ref(false)
|
||||
@ -742,7 +773,7 @@ async function handleRenameSubmit() {
|
||||
async function handleConfirmSign(row: any) {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确认与「${row.store_name || row.remask || row.counterparty_name}」的签约关系?`,
|
||||
`确认与「${row.counterparty_name || row.warehouse_name || row.remask || row.id}」的签约申请吗?`,
|
||||
'确认签约',
|
||||
{ type: 'warning', buttonSize: 'small' }
|
||||
)
|
||||
@ -763,7 +794,7 @@ async function handleUnbind(row: any, targetStatus: number) {
|
||||
const actionLabel = targetStatus === 0 ? '禁用' : '启用'
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确认要${actionLabel}与「${row.store_name || row.remask || row.counterparty_name}」的签约关系吗?`,
|
||||
`确认要${actionLabel}与「${row.counterparty_name || row.warehouse_name || row.remask || row.id}」的签约关系吗?`,
|
||||
`${actionLabel}签约`,
|
||||
{ type: targetStatus === 0 ? 'warning' : 'info', confirmButtonText: actionLabel, cancelButtonText: '取消', buttonSize: 'small' }
|
||||
)
|
||||
|
||||
@ -332,6 +332,13 @@ const FALLBACK_FIELDS: NormalizedField[] = [
|
||||
default: false,
|
||||
description: '默认关闭;开启后散单称重(订单波次范围 wave_scope 非 1 大团购/3 小团购)须处于打包中或已打包(pack_status=padding/fin),未打包或打包异常时拒绝称重并返回错误(like-flag:true/1/\'1\'/\'true\' 为开启)'
|
||||
},
|
||||
{
|
||||
key: 'b2b_packing_quantity_check',
|
||||
label: 'B2B备货齐套校验',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: '默认关闭;开启后 B2B 备货完成时逐商品校验「分箱数量合计 = 应备数量(plan_qty)」,并校验「总箱数 = 箱号数」,不符拒绝提交并返回差异明细(like-flag:true/1/\'1\'/\'true\' 为开启)'
|
||||
},
|
||||
{
|
||||
key: 'big_group_pack_coefficient',
|
||||
label: '大团购打包系数(秒/单)',
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
:table-size="tableSize"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100, 200]"
|
||||
:show-index="true"
|
||||
:show-selection="true"
|
||||
:show-actions="true"
|
||||
@ -157,9 +158,14 @@
|
||||
<div class="section">
|
||||
<div class="section-title">签约主体</div>
|
||||
<el-descriptions :column="2" border size="small" class="detail-descriptions">
|
||||
<el-descriptions-item v-if="currentSubject.company_name" label="当前货主">
|
||||
<el-descriptions-item v-if="currentSubject.company_name" :label="currentSubjectLabel">
|
||||
{{ currentSubject.company_name }}
|
||||
<el-tag size="small" type="warning" effect="plain" style="margin-left:6px">货主方</el-tag>
|
||||
<el-tag
|
||||
size="small"
|
||||
:type="currentSubjectRole === 'warehouse' ? 'primary' : 'warning'"
|
||||
effect="plain"
|
||||
style="margin-left:6px"
|
||||
>{{ currentSubjectRoleLabel }}</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="签约仓库" :span="currentSubject.company_name ? 1 : 2">
|
||||
{{ selectedRow.warehouse_name || selectedRow.remask || selectedRow.counterparty_name || '—' }}
|
||||
@ -177,7 +183,15 @@
|
||||
{{ selectedRow.auth_status_label || getAuthStatusLabel(selectedRow.auth_status) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="仓库ID">{{ selectedRow.warehouse_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="对方角色">
|
||||
<span :class="getStatusTextClass(selectedRow.counterparty_role === 'warehouse' ? 'primary' : 'warning')">
|
||||
{{ getCounterpartyRoleLabel(selectedRow.counterparty_role) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="己方主体ID">{{ selectedRow.store_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="对方主体ID">
|
||||
{{ selectedRow.counterparty_id ?? selectedRow.warehouse_id ?? '—' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="使用状态">
|
||||
<span :class="getStatusTextClass(selectedRow.use_status === 1 ? 'success' : 'info')">
|
||||
{{ selectedRow.use_status === 1 ? '启用' : '禁用' }}
|
||||
@ -187,6 +201,11 @@
|
||||
<span :class="{ 'text-danger': isExpired(selectedRow.auth_end) }">{{ selectedRow.auth_end || '—' }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="面单余额">{{ selectedRow.print_quantity ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="待我确认">
|
||||
<span :class="getStatusTextClass(selectedRow.needs_my_confirm ? 'warning' : 'info')">
|
||||
{{ selectedRow.needs_my_confirm ? '是' : '否' }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="奇门配置" :span="3">
|
||||
<span :class="getStatusTextClass(selectedRow.has_qimen_config ? 'success' : 'info')">
|
||||
{{ selectedRow.has_qimen_config ? '已配置' : '未配置' }}
|
||||
@ -222,6 +241,9 @@
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-business_type="{ row }">{{ row.business_type || '—' }}</template>
|
||||
<!-- 后端余额日志字段为 balance_before / balance_after,兼容旧字段名 -->
|
||||
<template #column-before_quantity="{ row }">{{ row.balance_before ?? row.before_quantity ?? '—' }}</template>
|
||||
<template #column-after_quantity="{ row }">{{ row.balance_after ?? row.after_quantity ?? '—' }}</template>
|
||||
<template #column-reason="{ row }">{{ row.reason || '—' }}</template>
|
||||
<template #column-operator_name="{ row }">{{ row.operator_name || '—' }}</template>
|
||||
<template #column-created_at="{ row }">{{ row.created_at || '—' }}</template>
|
||||
@ -655,6 +677,17 @@ const availableFields = [
|
||||
group: '基础信息',
|
||||
placeholder: '搜索仓库名或备注'
|
||||
},
|
||||
{
|
||||
label: '对方主体ID',
|
||||
value: 'warehouse_id',
|
||||
type: 'number',
|
||||
group: '基础信息',
|
||||
placeholder: '对方主体ID(兼容 counterparty_id)',
|
||||
// 文档:warehouse_id(兼容 counterparty_id),等值匹配
|
||||
operators: ['eq'],
|
||||
defaultOperator: 'eq',
|
||||
hideOperator: true
|
||||
},
|
||||
{
|
||||
label: '签约状态',
|
||||
value: 'auth_status',
|
||||
@ -684,6 +717,18 @@ const presetTree: any[] = []
|
||||
// ─── 当前主体信息(从列表接口返回) ────────────────────────────────────────
|
||||
const currentSubject = ref<{ store_id?: number; company_name?: string; role?: string }>({})
|
||||
|
||||
/** 当前主体角色(取自列表响应 current_subject.role):warehouse=仓库方,store=货主方 */
|
||||
const currentSubjectRole = computed(() => String(currentSubject.value.role || '').toLowerCase())
|
||||
const currentSubjectLabel = computed(() => (currentSubjectRole.value === 'warehouse' ? '当前仓库' : '当前货主'))
|
||||
const currentSubjectRoleLabel = computed(() => (currentSubjectRole.value === 'warehouse' ? '仓库方' : '货主方'))
|
||||
|
||||
/** 对方主体角色(文档 counterparty_role):warehouse=仓库方,store=货主方 */
|
||||
function getCounterpartyRoleLabel(role?: string): string {
|
||||
if (role === 'warehouse') return '仓库方'
|
||||
if (role === 'store') return '货主方'
|
||||
return '—'
|
||||
}
|
||||
|
||||
// ─── 列表状态 ──────────────────────────────────────────────────────────────
|
||||
const loading = ref(false)
|
||||
const queryTime = ref(0)
|
||||
@ -851,9 +896,16 @@ async function handleUnbind(row: any, targetStatus: number) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
await storeWarehouseUnbind({ id: row.id, store_use_status: targetStatus })
|
||||
ElMessage.success(`${action}成功`)
|
||||
loadList()
|
||||
// 实测(2026-11-19):当前主体 role=warehouse 时,传 store_use_status 与 warehouse_use_status
|
||||
// 均返回 success 但 use_status 不变(静默失败);文档语义:仓库侧传 warehouse_use_status,货主侧传 store_use_status
|
||||
const useStatusField = currentSubjectRole.value === 'store' ? 'store_use_status' : 'warehouse_use_status'
|
||||
const res = (await storeWarehouseUnbind({ id: row.id, [useStatusField]: targetStatus } as any)) as any
|
||||
if (res?.flag === 'success' || res?.code === 200) {
|
||||
ElMessage.success(`${action}成功`)
|
||||
loadList()
|
||||
} else {
|
||||
ElMessage.error(res?.message || `${action}失败`)
|
||||
}
|
||||
} catch (e) {
|
||||
ElMessage.error(`${action}失败`)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user