Merge branch 'main' into dev

This commit is contained in:
2026-11-09 12:25:57 +08:00
147 changed files with 8065 additions and 3016 deletions
@@ -0,0 +1,41 @@
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import test from 'node:test'
test('标准商品列表按当前渠道筛选,并单独展示来源、主渠道和兜底渠道', async () => {
const source = await readFile(
new URL('../src/pages/admin/cost-center/ProductCatalogPanel.tsx', import.meta.url),
'utf8',
)
assert.ok(source.includes('channel: channelFilter'))
assert.ok(!source.includes('carrierType: productSourceFilter'))
assert.ok(source.includes("title: '来源'"))
assert.ok(source.includes("title: '当前履约'"))
assert.ok(source.includes('row.activePrimaryChannel'))
assert.ok(source.includes('row.fallbackChannels'))
assert.ok(source.includes('未路由'))
})
test('渠道映射的统计、目录、队列和商品下拉都使用当前渠道', async () => {
const [panel, catalog, queue] = await Promise.all([
readFile(
new URL('../src/pages/admin/cost-center/ChannelMappingPanel.tsx', import.meta.url),
'utf8',
),
readFile(
new URL('../src/pages/admin/cost-center/ChannelMappingCatalog.tsx', import.meta.url),
'utf8',
),
readFile(
new URL('../src/pages/admin/cost-center/ChannelMappingQueue.tsx', import.meta.url),
'utf8',
),
])
assert.ok(panel.includes('channel: channelFilter'))
assert.ok(panel.includes('item.activePrimaryChannel === channelFilter'))
assert.ok(!panel.includes('carrierType: productSourceFilter'))
assert.ok(catalog.includes('channelLabel'))
assert.ok(queue.includes('channelLabel'))
})
@@ -52,7 +52,7 @@ test('人工商品不再允许手工创建或执行旧批量归档', async () =>
assert.ok(!productSource.includes('归档跨渠道重复商品'))
assert.ok(!productSource.includes('归档纯历史人工商品'))
assert.ok(productSource.includes("productSourceFilter === 'manual'"))
assert.ok(productSource.includes("channelFilter === 'manual'"))
assert.ok(productSource.includes('manualNew=1'))
assert.ok(productSource.includes('人工标准商品由人工 SKU 配置自动创建'))
assert.ok(serviceSource.includes('cost_manual_product_managed_by_config'))
@@ -22,7 +22,13 @@ test('最近核销任务使用服务端分页', () => {
assert.ok(!panel.includes('pagination={false}\n scroll={{ x: 1200 }}'))
})
test('自动核销策略提供未命中履约渠道的平台兜底配置', () => {
test('自动核销策略提供独立于履约渠道的订单级触发配置', () => {
assert.ok(panel.includes("order_received: '订单级触发'"))
assert.ok(panel.includes("value: 'order_received'"))
assert.ok(panel.includes("title: '策略项'"))
})
test('旧未命中渠道兜底配置继续保留并兼容', () => {
assert.ok(panel.includes("unmatched: '未命中渠道兜底'"))
assert.ok(panel.includes("label: '未命中渠道后'"))
assert.ok(panel.includes("value: 'unmatched'"))
@@ -43,6 +43,6 @@ test('第三方卡券新增 SKU 一次完成商品、规则和采购价', async
assert.ok(service.includes("'/api/v1/admin/cost-center/voucher-products'"))
assert.ok(!service.includes('/voucher-products/ensure-rules'))
assert.ok(panel.includes("searchParams.get('voucherNew')"))
assert.ok(productCatalog.includes("productSourceFilter === 'third_party_voucher'"))
assert.ok(productCatalog.includes("channelFilter === 'third_party_voucher'"))
assert.ok(productCatalog.includes('voucherNew=1'))
})