feat(phase-4/5 用户端): 恢复巡店删除与指定删除ASIN两个功能页与全部表件

用户口径:这两个功能是随 fdaae3c5 连带删错(该退役的只有紫鸟新版/旧版选项控件),
本次按历史逐字找回并摘掉紫鸟引用。

- 页面:BrandDeleteBrandTab.vue(1740行) / BrandPatrolDeleteTab.vue(1370行) 从 fdaae3c5~1 找回,
  两页各摘 5 处 ZiniaoVersionSetting/useZiniaoVersion 引用与 1 个 ziniao_version 载荷字段
  (checkQueuePayload 只钉 taskId,摘掉不触闸;全树其余读点 0 处)
- 表件:router 两条路由、tool-catalog 18→20 工具与四条图标/详情、BrandTopBar 导航两条、
  endpoints 两块(deleteBrand 10 键 / patrolDelete 16 键)、progress-light 10→12、
  java-modules re-export、module-templates 联合、withdraw.ts 巡店段整文件找回(513 行,
  含两个 ProductRisk*Vo import)
- 测试面:9 支退役时改过的用例从 fdaae3c5~1 逐字找回(含 modules-delete-brand.test.ts 167 行/11 例)
- 自证:npm test 854/854 绿(基线 840+找回 14 例)、vue-tsc --noEmit 与 vite build 通过
- 未触碰他人在飞件:BrandSimilarAsinTab.vue / task-status-text.ts / similar-asin-fake-completed.test.ts

注:恢复后的三支大文件将顶破 ops 侧 readability 棘轮,基线随本轮在 ops 仓重锚并登记。
This commit is contained in:
2026-10-16 20:04:40 +08:00
parent ffeb777c38
commit 11ad68eea4
21 changed files with 4090 additions and 30 deletions
+103 -3
View File
@@ -15,6 +15,21 @@ import {
getWithdrawResultDownloadUrl,
deleteWithdrawTask,
deleteWithdrawHistory,
listPatrolDeleteCandidates,
addPatrolDeleteCandidate,
deletePatrolDeleteCandidate,
listPatrolDeleteConditions,
addPatrolDeleteCondition,
deletePatrolDeleteCondition,
matchPatrolDeleteShops,
getPatrolDeleteDashboard,
getPatrolDeleteHistory,
getPatrolDeleteTaskProgressBatch,
createPatrolDeleteTask,
submitPatrolDeleteTaskResult,
getPatrolDeleteResultDownloadUrl,
deletePatrolDeleteTask,
deletePatrolDeleteHistory,
} from '../src/shared/api/types/modules/withdraw.ts'
function setupWindow() {
@@ -126,12 +141,91 @@ test('test_withdraw_match', async (t) => {
assert.deepEqual(calls[0].data, { user_id: 42, shop_names: ['店铺A'] })
})
test('test_patrol_delete_candidates_conditions', async (t) => {
setupWindow()
const calls: { url?: string; method?: string; params?: Record<string, unknown>; data?: unknown }[] = []
mockRequest(t, (config) => {
calls.push(config)
return okResponse({ id: 1, shop_name: 's1' })
})
await listPatrolDeleteCandidates()
await addPatrolDeleteCandidate('店铺A')
await deletePatrolDeleteCandidate(3)
await listPatrolDeleteConditions()
await addPatrolDeleteCondition('条件X')
await deletePatrolDeleteCondition(5)
assert.equal(calls[0].url, '/newApi/api/patrol-delete/candidates')
assert.deepEqual(calls[0].params, { user_id: 42 })
assert.equal(calls[1].url, '/newApi/api/patrol-delete/candidates')
assert.equal(calls[1].method, 'POST')
assert.deepEqual(calls[1].data, { user_id: 42, shop_name: '店铺A' })
assert.equal(calls[2].url, '/newApi/api/patrol-delete/candidates/3')
assert.equal(calls[2].method, 'DELETE')
assert.equal(calls[3].url, '/newApi/api/patrol-delete/conditions')
assert.deepEqual(calls[3].params, { user_id: 42 })
assert.equal(calls[4].url, '/newApi/api/patrol-delete/conditions')
assert.equal(calls[4].method, 'POST')
assert.deepEqual(calls[4].data, { user_id: 42, conditionText: '条件X' })
assert.equal(calls[5].url, '/newApi/api/patrol-delete/conditions/5')
assert.equal(calls[5].method, 'DELETE')
})
test('test_patrol_delete_create_submit', async (t) => {
setupWindow()
const calls: { url?: string; method?: string; data?: unknown }[] = []
mockRequest(t, (config) => {
calls.push(config)
return okResponse({ taskId: 1, items: [] })
})
const item = {
shopName: '店铺A',
matched: true,
countrySections: [{ country: 'US', rows: [{ status: 'ok', quantity: '1', deleteQuantity: '0', processStatus: 'done' }] }],
cartRatios: [{ country: 'US', ratio: '0.5' }],
}
await createPatrolDeleteTask([item])
assert.equal(calls[0].url, '/newApi/api/patrol-delete/tasks')
assert.equal(calls[0].method, 'POST')
assert.deepEqual(calls[0].data, { user_id: 42, items: [item], delete_conditions: [] })
const payload = { shops: [{ shopName: '店铺A', countrySections: item.countrySections, cartRatios: item.cartRatios, shopDone: true, chunkIndex: 0, chunkTotal: 1 }] }
await submitPatrolDeleteTaskResult(7, payload)
assert.equal(calls[1].url, '/newApi/api/patrol-delete/tasks/7/result')
assert.deepEqual(calls[1].data, payload)
})
test('test_patrol_delete_progress_dashboard_download', async (t) => {
setupWindow()
const calls: { url?: string; method?: string; data?: unknown; timeout?: number; params?: Record<string, unknown> }[] = []
mockRequest(t, (config) => {
calls.push(config)
return okResponse({ items: [], missingTaskIds: [] })
})
await getPatrolDeleteTaskProgressBatch([5, 3])
await getPatrolDeleteDashboard()
await getPatrolDeleteHistory()
await matchPatrolDeleteShops(['店铺A'])
await deletePatrolDeleteTask(7)
await deletePatrolDeleteHistory(9)
assert.equal(calls[0].url, '/newApi/api/patrol-delete/tasks/progress/batch')
assert.equal(calls[0].method, 'POST')
assert.deepEqual(calls[0].data, { taskIds: [3, 5], userId: 42 })
assert.equal(calls[0].timeout, 10000)
assert.equal(calls[1].url, '/newApi/api/patrol-delete/dashboard')
assert.deepEqual(calls[1].params, { user_id: 42 })
assert.equal(calls[2].url, '/newApi/api/patrol-delete/history')
assert.equal(calls[3].url, '/newApi/api/patrol-delete/match-shops')
assert.deepEqual(calls[3].data, { user_id: 42, shop_names: ['店铺A'] })
assert.equal(calls[4].url, '/newApi/api/patrol-delete/tasks/7')
assert.equal(calls[4].method, 'DELETE')
assert.equal(calls[5].url, '/newApi/api/patrol-delete/history/9')
assert.equal(calls[5].method, 'DELETE')
assert.equal(
getPatrolDeleteResultDownloadUrl(7),
'http://localhost/newApi/api/patrol-delete/results/7/download?user_id=42',
)
})
// 2026-10-15 旧版界面退役:巡店删除的 15 个 API 函数随功能从 withdraw.ts 切掉,
// 本格只剩提款一组(原 test_withdraw_patrol_export_compat)。
test('test_withdraw_export_compat', async (t) => {
test('test_withdraw_patrol_export_compat', async (t) => {
setupWindow()
const fromJavaModules = await import('../src/shared/api/java-modules.ts')
const fromWithdraw = await import('../src/shared/api/types/modules/withdraw.ts')
@@ -141,6 +235,12 @@ test('test_withdraw_export_compat', async (t) => {
'getWithdrawHistory', 'getWithdrawTaskProgressBatch', 'createWithdrawTask',
'submitWithdrawTaskResult', 'getWithdrawResultDownloadUrl',
'deleteWithdrawTask', 'deleteWithdrawHistory',
'listPatrolDeleteCandidates', 'addPatrolDeleteCandidate', 'deletePatrolDeleteCandidate',
'listPatrolDeleteConditions', 'addPatrolDeleteCondition', 'deletePatrolDeleteCondition',
'matchPatrolDeleteShops', 'getPatrolDeleteDashboard', 'getPatrolDeleteHistory',
'getPatrolDeleteTaskProgressBatch', 'createPatrolDeleteTask',
'submitPatrolDeleteTaskResult', 'getPatrolDeleteResultDownloadUrl',
'deletePatrolDeleteTask', 'deletePatrolDeleteHistory',
]
for (const name of names) {
assert.equal(fromJavaModules[name], fromWithdraw[name], `${name} 应为同一引用`)