Merge branch 'main' into dev_match

This commit is contained in:
2026-11-07 10:41:19 +08:00
15 changed files with 265 additions and 49 deletions
@@ -42,6 +42,7 @@ const CHANNEL_LABEL: Record<VoucherConsumeChannel, string> = {
manual: '人工客服',
on_account: '统一结算',
third_party_voucher: '第三方卡券',
unmatched: '未命中渠道兜底',
}
const MODE_OPTIONS: Record<
@@ -75,6 +76,10 @@ const MODE_OPTIONS: Record<
{ value: 'after_order_received', label: '收到订单后' },
{ value: 'manual', label: '人工核销' },
],
unmatched: [
{ value: 'after_order_received', label: '未命中渠道后' },
{ value: 'manual', label: '人工核销' },
],
}
type PolicyRow = {
@@ -103,6 +108,7 @@ const CHANNEL_FILTER_OPTIONS: Array<{ value: VoucherConsumeChannel; label: strin
{ value: 'manual', label: CHANNEL_LABEL.manual },
{ value: 'third_party_voucher', label: CHANNEL_LABEL.third_party_voucher },
{ value: 'on_account', label: CHANNEL_LABEL.on_account },
{ value: 'unmatched', label: CHANNEL_LABEL.unmatched },
]
const JOB_STATUS_FILTER_OPTIONS: Array<{
@@ -2399,10 +2399,12 @@ export default function WorkOrdersPanel() {
setPage(1)
}}
/>
<Button type="primary" icon={<SearchOutlined />} onClick={searchOrders}>
查询
</Button>
<Button onClick={clearOrderFilters}>清空筛选</Button>
<div className="worker-orders-filter-actions">
<Button type="primary" icon={<SearchOutlined />} onClick={searchOrders}>
查询
</Button>
<Button onClick={clearOrderFilters}>清空筛选</Button>
</div>
</div>
<div className="worker-orders-mock">
<Typography.Text type="secondary">本地 Mock</Typography.Text>
@@ -167,6 +167,7 @@ export type VoucherConsumeChannel =
| 'manual'
| 'on_account'
| 'third_party_voucher'
| 'unmatched'
export type VoucherConsumeMode =
| 'manual'
| 'after_order_received'
+25 -19
View File
@@ -139,49 +139,55 @@
min-width: 0;
}
/* 单行筛选栏:搜索框、筛选条件、清空按钮同一行且不换行;空间不足时行内横向滚动 */
/* 筛选条件按内容分配宽度;空间不足时整组换行,避免单个下拉挤占整行。 */
.worker-orders-filter-bar {
display: flex;
align-items: center;
flex-wrap: nowrap;
flex-wrap: wrap;
gap: 8px;
width: 100%;
overflow-x: auto;
scrollbar-width: thin;
padding-bottom: 2px;
}
.worker-orders-search-input {
flex: 1.4 1 240px;
min-width: 180px;
max-width: 300px;
flex: 1 1 260px;
min-width: 220px;
max-width: 340px;
}
.worker-orders-filter-select {
flex: 1 1 110px;
min-width: 88px;
flex: 0 1 165px;
width: 165px;
min-width: 145px;
max-width: 185px;
}
.worker-orders-filter-select--wide {
flex: 1.6 1 140px;
min-width: 112px;
flex: 0 1 220px;
width: 220px;
min-width: 190px;
max-width: 240px;
}
/* 状态:多选标签可截断,宽度让给时间区间 */
/* 状态是多选标签,保留独立宽度但不再随剩余空间无限拉伸。 */
.worker-orders-filter-select--compact {
flex: 0.9 1 96px;
min-width: 80px;
flex: 0 1 170px;
width: 170px;
min-width: 150px;
max-width: 190px;
}
/* 时间区间:留足两个完整日期(YYYY-MM-DD)与「开始日期/结束日期」占位文案的宽度 */
.worker-orders-date-range {
flex: 0 0 230px;
width: 230px;
min-width: 230px;
flex: 0 0 220px;
width: 220px;
min-width: 220px;
}
.worker-orders-filter-bar > .ant-btn {
.worker-orders-filter-actions {
display: flex;
align-items: center;
flex: 0 0 auto;
gap: 8px;
}
.worker-orders-mock {
@@ -34,11 +34,10 @@ export type ConsignmentWorkerDisplayInfo = {
}
/**
* 内部现货履约单:由客服/内部仓代交付,工单上没有接单打手。
* 尚未匹配打手的内部现货履约单:由客服/内部仓代交付,工单上没有接单打手。
*
* 口径必须与后端「内部寄售匹配」筛选(work-order-query-repo 的 internal_consignment 分支)一致:
* `material.consignment.inventoryId` 有值、`fulfillmentType ≠ worker_deposit`、
* `consignment.workerId` 缺失或为 0(后端按字符串 '0' 也视为无打手)、且工单未指派打手。
* 这是操作能力判断,不用于「内部寄售」来源筛选;来源筛选允许匹配前后,
* 因此可以和接单人员条件叠加。
*/
export function isInternalConsignmentOrder(row: { material?: unknown; worker?: unknown }): boolean {
const consignment = asRecord(asRecord(row.material).consignment)
@@ -21,3 +21,9 @@ test('最近核销任务使用服务端分页', () => {
assert.ok(panel.includes('setPageSize(nextPageSize)'))
assert.ok(!panel.includes('pagination={false}\n scroll={{ x: 1200 }}'))
})
test('自动核销策略提供未命中履约渠道的平台兜底配置', () => {
assert.ok(panel.includes("unmatched: '未命中渠道兜底'"))
assert.ok(panel.includes("label: '未命中渠道后'"))
assert.ok(panel.includes("value: 'unmatched'"))
})
@@ -0,0 +1,18 @@
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import test from 'node:test'
test('接单工单筛选按内容分配宽度,店铺下拉不能吞掉查询区', async () => {
const [panel, css] = await Promise.all([
readFile(new URL('../src/pages/admin/panels/WorkOrdersPanel.tsx', import.meta.url), 'utf8'),
readFile(new URL('../src/styles/worker.css', import.meta.url), 'utf8'),
])
assert.ok(panel.includes('className="worker-orders-filter-actions"'))
assert.ok(css.includes('flex-wrap: wrap'))
assert.ok(css.includes('.worker-orders-filter-select--wide'))
assert.ok(css.includes('width: 220px'))
assert.ok(css.includes('max-width: 240px'))
assert.ok(css.includes('.worker-orders-filter-actions'))
assert.ok(!css.includes('overflow-x: auto;\n scrollbar-width: thin;'))
})