Files
SupplierSystem/server/tests/mpPickingScopeSelect.test.ts
T
雨天 93437263ca
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
fix(分拣/订单/库存): 区域标签、详情标记与取货扣库
① 小程序分拣「按区域」看不到区域:taskPickerLabel 漏 zone 分支,标签落到兜底显示订单号(一个订单拆出的多张区域拣货单在选择器里长得一样)。

② 订单详情打开丢「主系统单」标记:openOrderDetail 用直连 orders.select('*') 重建 selectedOrder,而 is_main_system_order 是列表接口别名、非表列 ⇒ 变 undefined ⇒ 偶发出现「添加」、「缺货」消失;改以列表行为基底、真实列覆盖。

③ 主系统骑手上门取货单收口不扣库存:picked_up → 90 的同一事务里按既有出库口径软扣一次 delivery_loading_out;直送/免入库/加菜行自动跳过、orderHasOutboundOnClient 幂等。

测试:服务端套件失败集合与基线逐字一致(33 文件/41 例,0 新失败);前端 typecheck 通过;node --check 小程序面板通过;设计门禁四道全过。
2026-10-13 18:15:07 +08:00

42 lines
1.9 KiB
TypeScript

import { readFileSync } from 'fs';
import { describe, expect, it } from 'vitest';
const wxml = readFileSync(
new URL('../../miniprogram/components/picking-panel/index.wxml', import.meta.url),
'utf8'
);
const js = readFileSync(
new URL('../../miniprogram/components/picking-panel/index.js', import.meta.url),
'utf8'
);
describe('小程序分拣范围选择框', () => {
it('页内点击选范围:按订单/分类/商品都走选择框;完成组不占位', () => {
expect(wxml).not.toContain('scroll-x class="task-tabs"');
expect(wxml).toContain('toggleScopeMenu');
expect(wxml).toContain('scope-menu');
expect(wxml).toContain('wx:if="{{scopeGroups.length}}"');
expect(wxml).not.toContain('!skuCatalogMode');
expect(js).toContain('function groupStillOpen');
expect(js).toContain('onScopeOptionTap');
expect(js).toContain('scopeMenuOpen');
expect(js).toContain("if (type === 'category') return String(task.scope_label");
expect(js).toContain("if (type === 'sku') return String(task.scope_label");
// 区域模式:选择器/分组标签必须显示区域名,不得落到兜底显示订单号(2026-10-13 修)
expect(js).toContain("if (type === 'zone') return String(task.scope_label");
expect(js).toContain("if (type === 'category' || type === 'sku' || type === 'zone')");
expect(js).toContain('this.selectGroupByKey(activeGroupKey)');
expect(js).not.toContain('this.applyPickingDayView()');
});
it('日期轴仍在;小程序不做打印(2026-10-12 起)', () => {
expect(wxml).toContain('date-axis');
expect(js).toContain('confirmAllPicks');
// 小程序不做打印:行上打印按钮与下发打印的代码均已移除
expect(wxml).not.toContain('printCurrentPick');
expect(wxml).not.toContain('btn-print-row');
expect(js).not.toContain('printCurrentPick');
expect(js).not.toContain('printPickLabels');
});
});