feat: filter purchase tasks by successful SYB order writeback (#327)

This commit is contained in:
QiuSW
2026-09-19 15:38:42 +08:00
parent f66952f640
commit 368f2c2357
4 changed files with 87 additions and 3 deletions
@@ -157,7 +157,7 @@ export default {
setup() { return { RefreshLeft, Search } },
data() {
return {
loading: false, loadError: '', tasks: [], total: 0, statuses: statusOptions,
loading: false, loadError: '', tasks: [], total: 0, statuses: [...statusOptions, { value: 'syb_writeback_succeeded', label: '已回填 SYB' }],
orderWriteback: { open: false, saving: false, items: [] },
query: { page: 1, pageSize: 20, taskId: '', taskType: '', shopeeOrderNo: '', status: '', executionMode: 'live', sybProductId: '', pddOrderNo: '' },
detail: { open: false, loading: false, task: null, attempts: [], matching: null },
@@ -82,6 +82,28 @@ test('冲突显示原因且没有覆盖按钮', async ({ page }) => {
await expect(drawer.getByRole('button', { name: /回填 SYB 单号/ })).toHaveCount(0)
})
test('状态下拉框筛选已回填SYB,清空后恢复普通列表', async ({ page }) => {
const requests = await setup(page, 'succeeded')
const statuses: string[] = []
await page.route('**/api/admin/v1/purchase-tasks?**', async route => {
const query = new URL(route.request().url()).searchParams
statuses.push(query.get('status') || '')
expect(query.get('page')).toBe('1')
return route.fulfill({ json: { code: 200, data: { items: [{ id: 11, taskType: 'syb_order', executionMode: 'live', status: 'order_created', orderWriteback: { status: 'succeeded', canSubmit: false } }], total: 1 } } })
})
const field = page.locator('.search-form .el-form-item').filter({ has: page.locator('label').filter({ hasText: /^状态$/ }) })
await field.locator('.el-select').click()
await page.getByRole('option', { name: '已回填 SYB', exact: true }).click()
await page.getByRole('button', { name: '查询', exact: true }).click()
await expect.poll(() => statuses.at(-1)).toBe('syb_writeback_succeeded')
await expect(page.getByText('订单已创建', { exact: true }).first()).toBeVisible()
await field.locator('.el-select').hover()
await field.locator('.el-select__clear').click()
await page.getByRole('button', { name: '查询', exact: true }).click()
await expect.poll(() => statuses.at(-1)).toBe('')
expect(requests).toHaveLength(0)
})
for (const amount of ['0', '13.01']) {
test(`已创建订单补金额 ${amount},不重新采购或修改支付状态`, async ({ page }) => {
const requests = await setup(page)