diff --git a/admin-frontend-vue/src/pages/jd/JdCategoryCascader.vue b/admin-frontend-vue/src/pages/jd/JdCategoryCascader.vue index 043d20cd6..8d2d529ce 100644 --- a/admin-frontend-vue/src/pages/jd/JdCategoryCascader.vue +++ b/admin-frontend-vue/src/pages/jd/JdCategoryCascader.vue @@ -29,6 +29,7 @@ const props = defineProps<{ groupId?: string createVersion?: number busy?: boolean + treeOnly?: boolean }>() const emit = defineEmits<{ @@ -179,7 +180,7 @@ function clear(): void {
-
+
自定义分类
diff --git a/admin-frontend-vue/src/pages/jd/JdDatabasePage.vue b/admin-frontend-vue/src/pages/jd/JdDatabasePage.vue index 64c3b6f61..cfd8bba85 100644 --- a/admin-frontend-vue/src/pages/jd/JdDatabasePage.vue +++ b/admin-frontend-vue/src/pages/jd/JdDatabasePage.vue @@ -1,11 +1,7 @@ + + + + diff --git a/admin-frontend-vue/src/pages/jd/JdProductGroupDialog.vue b/admin-frontend-vue/src/pages/jd/JdProductGroupDialog.vue new file mode 100644 index 000000000..d7640b56f --- /dev/null +++ b/admin-frontend-vue/src/pages/jd/JdProductGroupDialog.vue @@ -0,0 +1,459 @@ + + + + + diff --git a/admin-frontend-vue/tests/mount/jd-database-page.mount.test.ts b/admin-frontend-vue/tests/mount/jd-database-page.mount.test.ts index aa28d5a15..49de9a922 100644 --- a/admin-frontend-vue/tests/mount/jd-database-page.mount.test.ts +++ b/admin-frontend-vue/tests/mount/jd-database-page.mount.test.ts @@ -16,6 +16,7 @@ import { flushPromises, mount, type VueWrapper } from '@vue/test-utils' import { createPinia, setActivePinia, type Pinia } from 'pinia' import JdDatabasePage from '@/pages/jd/JdDatabasePage.vue' +import OldPagination from '@/components/OldPagination.vue' import { useAdminSessionStore } from '@/stores/admin-session' @@ -92,6 +93,176 @@ async function mountWith(payload: unknown): Promise> { return wrapper } +describe('店铺分类弹窗', () => { + it('外层店铺分类与京麦类目独立组合,选全部立即清除分组', async () => { + jdApi.fetchJdProductGroups.mockResolvedValue([{ id: 7, name: '甲组', sortOrder: 0, productCount: 1 }]) + const wrapper = await mountWith({ items: [item(1)], total: 1, page: 1, pageSize: 20 }) + const select = wrapper.get('[aria-label="筛选店铺分类"]') + await select.setValue('7') + await flushPromises() + expect(jdApi.fetchJdProductList.mock.calls.at(-1)![0]).toMatchObject({ groupId: '7', page: 1 }) + await wrapper.get('.cat-trigger').trigger('click') + expect(wrapper.find('.cat-custom').exists()).toBe(false) + await wrapper.get('.cat-search').setValue('艺考') + await wrapper.get('.cat-col-search .cat-row').trigger('click') + await flushPromises() + expect(jdApi.fetchJdProductList.mock.calls.at(-1)![0]).toMatchObject({ groupId: '7', category: '艺考形体服', page: 1 }) + await select.setValue('') + await flushPromises() + expect(jdApi.fetchJdProductList.mock.calls.at(-1)![0]).toMatchObject({ groupId: '', category: '艺考形体服', page: 1 }) + expect(wrapper.get('.jd-toolbar').text()).not.toMatch(/归入分类|移除分类/) + wrapper.unmount() + }) + it('入口恢复,按京麦类目筛选并将商品归入或移出左侧目标', async () => { + jdApi.fetchJdProductGroups.mockResolvedValue([{ id: 7, name: '甲组', sortOrder: 0, productCount: 1 }]) + jdApi.fetchJdProductCategories.mockResolvedValue([{ name: '历史京麦类目', productCount: 1 }]) + jdApi.batchAssignJdProductGroup.mockResolvedValue(1) + const wrapper = await mountWith({ items: [item(1)], total: 1, page: 1, pageSize: 20 }) + await wrapper.findAll('button').find(b => b.text() === '店铺分类')!.trigger('click') + await flushPromises() + const modal = wrapper.get('.group-modal') + expect(modal.text()).toContain('价格/库存等字段停更') + expect(modal.find('.scope-tabs').exists()).toBe(false) + await modal.get('.group-row').trigger('click') + await modal.get('.cat-trigger').trigger('click') + expect(modal.find('.cat-custom').exists()).toBe(false) + await modal.get('.cat-search').setValue('历史京麦类目') + await modal.findAll('.cat-row').find(row => row.text().includes('历史京麦类目'))!.trigger('click') + await flushPromises() + expect(jdApi.fetchJdProductList.mock.calls.at(-1)![0]).toMatchObject({ category: '历史京麦类目', page: 1 }) + await modal.get('tbody input[type="checkbox"]').setValue(true) + await modal.findAll('button').find(b => b.text().includes('归入「甲组」'))!.trigger('click') + await flushPromises() + expect(jdApi.batchAssignJdProductGroup).toHaveBeenCalledWith([1], 7) + await modal.get('tbody input[type="checkbox"]').setValue(true) + await modal.findAll('button').find(b => b.text() === '移出分类')!.trigger('click') + await flushPromises() + expect(jdApi.batchAssignJdProductGroup).toHaveBeenCalledWith([1], null) + await modal.get('.modal-close').trigger('click') + expect(wrapper.find('.group-modal').exists()).toBe(false) + wrapper.unmount() + }) + + it('加载期间立即清除勾选并阻止操作,旧请求不能覆盖新结果', async () => { + jdApi.fetchJdProductGroups.mockResolvedValue([{ id: 7, name: '甲组', sortOrder: 0, productCount: 1 }]) + const wrapper = await mountWith({ items: [item(1)], total: 1, page: 1, pageSize: 20 }) + await wrapper.findAll('button').find(b => b.text() === '店铺分类')!.trigger('click') + await flushPromises() + const modal = wrapper.get('.group-modal') + await modal.get('.group-row').trigger('click') + await modal.get('tbody input').setValue(true) + let resolveOld!: (value: unknown) => void + let resolveNew!: (value: unknown) => void + jdApi.fetchJdProductList.mockImplementationOnce(() => new Promise(resolve => { resolveOld = resolve })) + .mockImplementationOnce(() => new Promise(resolve => { resolveNew = resolve })) + await modal.get('.keyword-input').setValue('旧') + await modal.get('.keyword-input').trigger('keyup.enter') + expect(modal.text()).toContain('已勾选 0 个商品') + expect(modal.findAll('button').find(b => b.text().includes('归入「甲组」'))!.attributes('disabled')).toBeDefined() + expect(modal.findAll('button').find(b => b.text() === '移出分类')!.attributes('disabled')).toBeDefined() + await modal.get('.keyword-input').setValue('新') + await modal.get('.keyword-input').trigger('keyup.enter') + resolveNew({ items: [item(2, { title: '新结果' })], total: 1, page: 1, pageSize: 20 }) + await flushPromises() + resolveOld({ items: [item(1, { title: '旧结果' })], total: 1, page: 1, pageSize: 20 }) + await flushPromises() + expect(modal.text()).toContain('新结果') + expect(modal.text()).not.toContain('旧结果') + wrapper.unmount() + }) + + it('翻页开始时清除勾选且禁止批量操作', async () => { + jdApi.fetchJdProductGroups.mockResolvedValue([{ id: 7, name: '甲组', sortOrder: 0, productCount: 1 }]) + const wrapper = await mountWith({ items: [item(1)], total: 40, page: 1, pageSize: 20 }) + await wrapper.findAll('button').find(b => b.text() === '店铺分类')!.trigger('click') + await flushPromises() + const modal = wrapper.get('.group-modal') + await modal.get('.group-row').trigger('click') + await modal.get('tbody input').setValue(true) + let resolvePage!: (value: unknown) => void + jdApi.fetchJdProductList.mockImplementationOnce(() => new Promise(resolve => { resolvePage = resolve })) + modal.getComponent(OldPagination).vm.$emit('change', 2) + await wrapper.vm.$nextTick() + expect(modal.text()).toContain('已勾选 0 个商品') + expect(modal.findAll('button').find(b => b.text().includes('归入「甲组」'))!.attributes('disabled')).toBeDefined() + resolvePage({ items: [item(2)], total: 40, page: 2, pageSize: 20 }) + await flushPromises() + expect(modal.text()).toContain('JD-1002') + wrapper.unmount() + }) + + it('移出只提交已分类商品,未分类商品不会被锁', async () => { + jdApi.batchAssignJdProductGroup.mockResolvedValue(1) + const wrapper = await mountWith({ items: [item(1), item(2, { groupId: null, groupName: '' })], total: 2, page: 1, pageSize: 20 }) + await wrapper.findAll('button').find(b => b.text() === '店铺分类')!.trigger('click') + await flushPromises() + const modal = wrapper.get('.group-modal') + await modal.get('thead input').setValue(true) + await modal.findAll('button').find(b => b.text() === '移出分类')!.trigger('click') + await flushPromises() + expect(jdApi.batchAssignJdProductGroup).toHaveBeenCalledWith([1], null) + wrapper.unmount() + }) + + it('删除当前筛选分类后刷新两侧并清除主页面筛选,即使分类列表刷新失败', async () => { + jdApi.fetchJdProductGroups.mockResolvedValue([{ id: 7, name: '甲组', sortOrder: 0, productCount: 1 }]) + const wrapper = await mountWith({ items: [item(1)], total: 1, page: 1, pageSize: 20 }) + await wrapper.get('[aria-label="筛选店铺分类"]').setValue('7') + await flushPromises() + await wrapper.findAll('button').find(b => b.text() === '店铺分类')!.trigger('click') + await flushPromises() + const modal = wrapper.get('.group-modal') + const callsBefore = jdApi.fetchJdProductList.mock.calls.length + jdApi.fetchJdProductGroups.mockRejectedValue(new Error('网络中断')) + await modal.findAll('button').find(b => b.text() === '删除')!.trigger('click') + await flushPromises() + expect(modal.text()).toContain('操作已成功,分类列表刷新失败') + expect(modal.text()).not.toContain('删除分类失败') + const calls = jdApi.fetchJdProductList.mock.calls.slice(callsBefore).map(call => call[0]) + expect(calls.some(call => call.groupId === '')).toBe(true) + expect(calls.some(call => call.category === '' && !('groupId' in call))).toBe(true) + wrapper.unmount() + }) + + it('改名后重新加载弹窗商品行', async () => { + jdApi.fetchJdProductGroups.mockResolvedValue([{ id: 7, name: '甲组', sortOrder: 0, productCount: 1 }]) + const wrapper = await mountWith({ items: [item(1)], total: 1, page: 1, pageSize: 20 }) + await wrapper.findAll('button').find(b => b.text() === '店铺分类')!.trigger('click') + await flushPromises() + const modal = wrapper.get('.group-modal') + const before = jdApi.fetchJdProductList.mock.calls.length + await modal.findAll('button').find(b => b.text() === '改名')!.trigger('click') + await modal.get('.group-row input').setValue('新名称') + await modal.findAll('button').find(b => b.text() === '保存')!.trigger('click') + await flushPromises() + const calls = jdApi.fetchJdProductList.mock.calls.slice(before).map(call => call[0]) + expect(calls.some(call => call.category === '' && !('groupId' in call))).toBe(true) + wrapper.unmount() + }) + + it('左侧支持新增、改名和确认删除', async () => { + jdApi.fetchJdProductGroups.mockResolvedValue([{ id: 7, name: '甲组', sortOrder: 0, productCount: 1 }]) + const wrapper = await mountWith({ items: [], total: 0, page: 1, pageSize: 20 }) + await wrapper.findAll('button').find(b => b.text() === '店铺分类')!.trigger('click') + await flushPromises() + const modal = wrapper.get('.group-modal') + await modal.get('.group-create input').setValue('新分类') + await modal.get('.create-icon-btn').trigger('click') + await flushPromises() + expect(jdApi.createJdProductGroup).toHaveBeenCalledWith({ name: '新分类', sortOrder: 0 }) + await modal.findAll('button').find(b => b.text() === '改名')!.trigger('click') + await modal.get('.group-row input').setValue('改名后') + await modal.findAll('button').find(b => b.text() === '保存')!.trigger('click') + await flushPromises() + expect(jdApi.updateJdProductGroup).toHaveBeenCalledWith(7, { name: '改名后', sortOrder: 0 }) + await modal.findAll('button').find(b => b.text() === '删除')!.trigger('click') + await flushPromises() + expect(confirmMock).toHaveBeenCalled() + expect(jdApi.deleteJdProductGroup).toHaveBeenCalledWith(7) + wrapper.unmount() + }) +}) + describe('京东数据库页(v1.4 Phase 5)', () => { it('挂载后按首屏分页参数取列表(pageSize 默认 20、不带公司维度),行数=本页条数', async () => { const wrapper = await mountWith({ items: [item(1), item(2), item(3)], total: 42, page: 1, pageSize: 20 }) @@ -227,8 +398,7 @@ describe('京东数据库页(v1.4 Phase 5)', () => { expect(textInputs).toHaveLength(2, '商品编码+标题关键字两个文本筛选框(店铺/商品状态已下线)') await textInputs[0].setValue('JD-1001') await textInputs[1].setValue('保温杯') - await wrapper.find('.cat-trigger').trigger('click') - await wrapper.find('.cat-group-pick').trigger('click') + await wrapper.get('[aria-label="筛选店铺分类"]').setValue('7') const dateInputs = wrapper.findAll('input[type="date"]') await dateInputs[0].setValue('2026-11-01') await dateInputs[1].setValue('2026-11-09') @@ -251,22 +421,6 @@ describe('京东数据库页(v1.4 Phase 5)', () => { expect(last).not.toHaveProperty('companyId') }) - it('分组下拉选中即查', async () => { jdApi.fetchJdProductGroups.mockResolvedValue([ - { id: 7, name: '甲组', sortOrder: 0, productCount: 3 }, - { id: 8, name: '乙组', sortOrder: 1, productCount: 1 }, - ]) - const wrapper = await mountWith({ items: [], total: 0, page: 1, pageSize: 20 }) - expect(jdApi.fetchJdProductGroups).toHaveBeenCalledWith() - - await wrapper.find('.cat-trigger').trigger('click') - expect(wrapper.find('.cat-custom').text()).toContain('甲组') - const callsBeforeSelect = jdApi.fetchJdProductList.mock.calls.length - await wrapper.find('.cat-group-pick').trigger('click') - await flushPromises() - expect(jdApi.fetchJdProductList.mock.calls.length).toBe(callsBeforeSelect + 1, '选中分组必须立刻重查') - expect(jdApi.fetchJdProductList.mock.calls.at(-1)![0]).toMatchObject({ groupId: '7', page: 1 }) - }) - it('类目京麦同款级联面板(2026-11-16 真树重做):授权一级 3 个逐级下钻,点末级即查回第一页', async () => { jdApi.fetchJdProductCategories.mockResolvedValue([ { name: '艺考形体服', productCount: 120 }, @@ -360,11 +514,18 @@ describe('京东数据库页(v1.4 Phase 5)', () => { const wrapper = await mountWith({ items: [], total: 0, page: 1, pageSize: 20 }) expect(wrapper.find('.jd-filter-row').text()).not.toContain('分类状态') expect(wrapper.find('.jd-filter-row select').exists()).toBe(false) - expect(wrapper.findAll('button').some(button => button.text() === '店铺分类')).toBe(false) + expect(wrapper.findAll('button').some(button => button.text() === '店铺分类')).toBe(true) }) it('重置把筛选面回空并回第一页重取', async () => { + jdApi.fetchJdProductGroups.mockResolvedValue([{ id: 7, name: '甲组', sortOrder: 0, productCount: 1 }]) const wrapper = await mountWith({ items: [], total: 0, page: 1, pageSize: 20 }) + const select = wrapper.get('[aria-label="筛选店铺分类"]') + expect(select.text()).toContain('全部分类') + await select.setValue('7') + await wrapper.get('.cat-trigger').trigger('click') + await wrapper.get('.cat-search').setValue('艺考') + await wrapper.get('.cat-col-search .cat-row').trigger('click') const textInputs = wrapper.findAll('.form-group input[type="text"]') await textInputs[0].setValue('JD-1001') await textInputs[1].setValue('保温杯') @@ -375,7 +536,8 @@ describe('京东数据库页(v1.4 Phase 5)', () => { expect(jdApi.fetchJdProductList.mock.calls.length).toBeGreaterThan(callsBefore) const last = jdApi.fetchJdProductList.mock.calls.at(-1)![0] - expect(last).toMatchObject({ productCode: '', titleKeyword: '', page: 1 }, '重置后筛选全空、回第一页') + expect(last).toMatchObject({ productCode: '', titleKeyword: '', groupId: '', category: '', page: 1 }, '重置后筛选全空、回第一页') + expect((select.element as HTMLSelectElement).value).toBe('') }) it('翻页与改每页条数都重发请求,改条数回第一页', async () => { @@ -551,133 +713,6 @@ describe('京东数据库页(v1.4 Phase 5)', () => { expect(wrapper.find('.jd-delete-btn').exists()).toBe(true) }) - it('移除分类(2026-11-16 页工具栏):计数只算勾选中已分类的行(未分类行不参与=不白吃人工锁)→ 确认点名数量与人工锁后果 → (ids, null) 调批量归类,成功后刷新并清勾选', async () => { - jdApi.fetchJdProductGroups.mockResolvedValueOnce([{ id: 7, name: '甲组', sortOrder: 0, productCount: 3 }]) - .mockResolvedValueOnce([{ id: 7, name: '甲组', sortOrder: 0, productCount: 1 }]) - const wrapper = await mountWith({ - items: [item(1), item(2, { groupId: null, groupName: '' }), item(3)], - total: 3, page: 1, pageSize: 20, - }) - - // 常显(同删除口径);未勾选时置灰。 - const removeBtn = () => wrapper.find('.jd-remove-btn') - expect(removeBtn().exists()).toBe(true) - expect(removeBtn().attributes('disabled')).toBeDefined() - - // 只勾未分类行:没有分类可移,按钮仍置灰(标题给原因,不靠猜)。 - const boxes = wrapper.findAll('tbody input[type="checkbox"]') - await boxes[1].setValue(true) - expect(removeBtn().attributes('disabled')).toBeDefined() - expect(removeBtn().attributes('title')).toBe('勾选中没有已分类的商品') - - // 勾选 1、3 两行已分类 → 计数=2 且可点(未分类的 2 号行不在发送名单里)。 - await boxes[0].setValue(true) - await boxes[2].setValue(true) - expect(removeBtn().attributes('disabled')).toBeUndefined() - expect(removeBtn().text()).toContain('移除分类(2)') - - jdApi.batchAssignJdProductGroup.mockResolvedValue(2) - await removeBtn().trigger('click') - await flushPromises() - await flushPromises() - - expect(confirmMock).toHaveBeenCalledTimes(1) - const options = confirmMock.mock.calls[0][0] - expect(options.title).toBe('移除分类') - expect(options.message).toContain('确定把勾选的 2 个商品移出分类吗') - expect(options.message).toContain('人工编辑锁', '确认弹窗必须点名人工编辑锁后果(价格/库存随锁停更)') - expect(options.danger).toBe(false, '移除分类是可恢复动作,非 danger 形态(danger-exit-ledger 口径)') - expect(jdApi.batchAssignJdProductGroup).toHaveBeenCalledTimes(1) - expect(jdApi.batchAssignJdProductGroup).toHaveBeenCalledWith([1, 3], null) - expect(document.body.textContent).toContain('已把 2 个商品移出分类') - // 成功后重取列表并清勾选:按钮回到置灰。 - expect(jdApi.fetchJdProductList.mock.calls.length).toBeGreaterThan(1) - expect(removeBtn().attributes('disabled')).toBeDefined() - await wrapper.find('.cat-trigger').trigger('click') - expect(jdApi.fetchJdProductGroups).toHaveBeenCalledTimes(2) - expect(wrapper.find('.cat-custom').text()).toContain('甲组(1)') - }) - - it('移除分类:确认弹窗点取消就不发请求(防误操作的第一道闸)', async () => { - confirmMock.mockResolvedValue(false) - const wrapper = await mountWith({ items: [item(1)], total: 1, page: 1, pageSize: 20 }) - await wrapper.findAll('tbody input[type="checkbox"]')[0].setValue(true) - await wrapper.find('.jd-remove-btn').trigger('click') - await flushPromises() - - expect(confirmMock).toHaveBeenCalledTimes(1) - expect(jdApi.batchAssignJdProductGroup).not.toHaveBeenCalled() - }) - - it('移除分类失败把后端中文文案弹出来(勾选保留可重试)', async () => { - jdApi.batchAssignJdProductGroup.mockRejectedValue(new Error('分类不存在,请刷新分类后重试')) - const wrapper = await mountWith({ items: [item(1)], total: 1, page: 1, pageSize: 20 }) - await wrapper.findAll('tbody input[type="checkbox"]')[0].setValue(true) - await wrapper.find('.jd-remove-btn').trigger('click') - await flushPromises() - await flushPromises() - - expect(document.body.textContent).toContain('分类不存在,请刷新分类后重试') - }) - - it('归类先提示人工锁,取消不发送请求', async () => { - jdApi.fetchJdProductGroups.mockResolvedValue([{ id: 7, name: '甲组', sortOrder: 0, productCount: 3 }]) - confirmMock.mockResolvedValue(false) - const wrapper = await mountWith({ items: [item(1)], total: 1, page: 1, pageSize: 20 }) - await wrapper.find('tbody input[type="checkbox"]').setValue(true) - await wrapper.find('[aria-label="选择归入的分类"]').setValue('7') - await wrapper.findAll('button').find(b => b.text().includes('归入分类'))!.trigger('click') - await flushPromises() - expect(confirmMock).toHaveBeenCalledTimes(1) - expect(confirmMock.mock.calls[0][0].message).toContain('人工编辑锁') - expect(confirmMock.mock.calls[0][0].message).toContain('不再被采集自动覆盖') - expect(jdApi.batchAssignJdProductGroup).not.toHaveBeenCalled() - }) - - it('分类增删、筛选切换和勾选归类', async () => { - jdApi.fetchJdProductGroups.mockResolvedValue([{ id: 7, name: '甲组', sortOrder: 0, productCount: 3 }]) - jdApi.createJdProductGroup.mockRejectedValueOnce(new Error('分类已存在')).mockResolvedValueOnce({}) - jdApi.deleteJdProductGroup.mockResolvedValue(undefined) - jdApi.batchAssignJdProductGroup.mockResolvedValue(1) - const wrapper = await mountWith({ items: [item(1)], total: 1, page: 1, pageSize: 20 }) - await wrapper.find('.cat-trigger').trigger('click') - await wrapper.find('[aria-label="新建分类名称"]').setValue('新分类') - await wrapper.find('.cat-create').trigger('submit') - await flushPromises() - expect(document.body.textContent).toContain('分类已存在') - expect((wrapper.find('[aria-label="新建分类名称"]').element as HTMLInputElement).value).toBe('新分类') - await wrapper.find('.cat-create').trigger('submit') - await flushPromises() - expect(jdApi.createJdProductGroup).toHaveBeenCalledWith({ name: '新分类', sortOrder: 0 }) - confirmMock.mockResolvedValueOnce(false) - await wrapper.find('[aria-label="删除分类 甲组"]').trigger('click') - await flushPromises() - expect(jdApi.deleteJdProductGroup).not.toHaveBeenCalled() - await wrapper.find('.cat-group-pick').trigger('click') - await flushPromises() - expect(jdApi.fetchJdProductList.mock.calls.at(-1)![0]).toMatchObject({ groupId: '7', category: '' }) - await wrapper.find('.cat-trigger').trigger('click') - await wrapper.findAll('.cat-col')[0].find('.cat-search').setValue('艺考') - await wrapper.find('.cat-col-search .cat-row').trigger('click') - await flushPromises() - expect(jdApi.fetchJdProductList.mock.calls.at(-1)![0]).toMatchObject({ groupId: '', category: '艺考形体服' }) - await wrapper.find('.cat-trigger').trigger('click') - await wrapper.find('.cat-group-pick').trigger('click') - await flushPromises() - expect(jdApi.fetchJdProductList.mock.calls.at(-1)![0]).toMatchObject({ groupId: '7', category: '' }) - await wrapper.find('tbody input[type="checkbox"]').setValue(true) - await wrapper.find('[aria-label="选择归入的分类"]').setValue('7') - await wrapper.findAll('button').find(b => b.text().includes('归入分类'))!.trigger('click') - await flushPromises() - expect(jdApi.batchAssignJdProductGroup).toHaveBeenCalledWith([1], 7) - await wrapper.find('.cat-trigger').trigger('click') - await wrapper.find('[aria-label="删除分类 甲组"]').trigger('click') - await flushPromises() - expect(confirmMock.mock.calls.at(-1)![0].message).toContain('商品将保留') - expect(jdApi.deleteJdProductGroup).toHaveBeenCalledWith(7) - expect(jdApi.fetchJdProductList.mock.calls.at(-1)![0].groupId).toBe('') - }) - it('空态与加载失败条(失败给重试,不把整页打死)', async () => { const empty = await mountWith({ items: [], total: 0, page: 1, pageSize: 20 }) const tip = empty.find('.empty-tip')