feat(jd): 店铺分类弹窗新建收成+图标/排序输入下线;京东数据库下线店铺筛选与列(后端 shop_name 参数同窗撤)
This commit is contained in:
@@ -757,14 +757,15 @@ const WATCH_BODY_PINS: ReadonlyArray<{
|
||||
{ file: 'src/pages/patent/appearance-patent-clean-api.ts', shapes: [/company_id\s*=\s*params\.companyId\b/] },
|
||||
],
|
||||
},
|
||||
// ↓ 批次 8(2026-11-14 v1.4 京东数据库;2026-11-15 公共化改口径):店铺/商品编码/标题是
|
||||
// ↓ 批次 8(2026-11-14 v1.4 京东数据库;2026-11-15 公共化改口径):商品编码/标题是
|
||||
// 按行集筛的自由文本,类目选项集与超管当前 tab 的行集同源 ⇒ 上一家的筛选值与 category
|
||||
// 在新一家的行集/选项集里不存在,切 tab 必清且类目选项重取;页码回 1 同外观专利页。
|
||||
// 分组 2026-11-15 起全平台一份(公共),groupId 与公司维度正交——不清、选项也不随 tab 重取。
|
||||
// 店铺筛选 2026-11-15 客户口径「店铺不需要」下线(watch 体不再清 shopName,参数面无它)。
|
||||
{
|
||||
file: 'src/pages/jd/JdDatabasePage.vue',
|
||||
token: "filter.shopName = ''; filter.productCode = ''; filter.titleKeyword = ''; filter.category = ''; filter.syncedFrom = ''; filter.syncedTo = ''; page.value = 1; void loadCategoryOptions(); void load()",
|
||||
why: '店铺/商品编码/标题是按行集筛的自由文本,上一家的值在新一家的行里不存在 ⇒ 切 tab 后首屏被筛成「暂无商品」,'
|
||||
token: "filter.productCode = ''; filter.titleKeyword = ''; filter.category = ''; filter.syncedFrom = ''; filter.syncedTo = ''; page.value = 1; void loadCategoryOptions(); void load()",
|
||||
why: '商品编码/标题是按行集筛的自由文本,上一家的值在新一家的行里不存在 ⇒ 切 tab 后首屏被筛成「暂无商品」,'
|
||||
+ '而输入框还显示着上一家填的值;类目选项集与超管当前 tab 的行集同源,上一家选的 category 在新一家的选项里不存在,'
|
||||
+ '同罪必清且选项重取;页码回 1 是因为新一家的行数更少,末尾的 void load() 才让切 tab 真的换数据',
|
||||
premise: [
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
*
|
||||
* 覆盖:
|
||||
* 1. **snake 参数形状**:toJdProductListParams 产出 `page`/`page_size`(默认 20、上限 100)、
|
||||
* `shop_name`/`product_code`/`title_keyword`/`group_id`/`synced_from`/`synced_to`
|
||||
* `product_code`/`title_keyword`/`group_id`/`synced_from`/`synced_to`
|
||||
* (ISO yyyy-MM-dd;空白不下发;groupId 空串→不带、有值→snake group_id);分页钳制(铁律 15)。
|
||||
* 商品状态筛选与导出参数口已随 2026-11-15 客户口径下线,不再出现在参数面。
|
||||
* 商品状态筛选与导出参数口已随 2026-11-15 客户口径下线,不再出现在参数面;
|
||||
* 店铺筛选同日客户口径「店铺不需要」下线(shop_name 也不在参数面)。
|
||||
* 2. **详情解析**:parseJdProductDetail 解析 attrGroups/images(camel 为正 snake 容错、缺 url 弃行),
|
||||
* attrGroups 解析不出时 attrJsonRaw 原文兜底;列表行解析缺 id 弃行。
|
||||
*
|
||||
@@ -32,7 +33,6 @@ import {
|
||||
test('京东列表参数——snake 形状:groupId 空→不带、有值→group_id,日期空白/非法不下发', () => {
|
||||
const full = toJdProductListParams(
|
||||
{
|
||||
shopName: ' 旗舰自营店 ',
|
||||
productCode: ' JD-10086 ',
|
||||
titleKeyword: ' 保温杯 ',
|
||||
groupId: ' 7 ',
|
||||
@@ -45,20 +45,20 @@ test('京东列表参数——snake 形状:groupId 空→不带、有值→gro
|
||||
assert.deepEqual(full, {
|
||||
page: 2,
|
||||
page_size: 20,
|
||||
shop_name: '旗舰自营店',
|
||||
product_code: 'JD-10086',
|
||||
title_keyword: '保温杯',
|
||||
group_id: 7,
|
||||
synced_from: '2026-11-01',
|
||||
synced_to: '2026-11-09',
|
||||
})
|
||||
assert.equal('shop_name' in full, false, '店铺筛选已下线,参数面不再出现 shop_name')
|
||||
|
||||
// 全空态只有分页两项;脏值(非数字分组、非法日期)同罪不下发。
|
||||
const blank = toJdProductListParams(createJdProductFilterState(), 1, 20)
|
||||
assert.deepEqual(blank, { page: 1, page_size: 20 })
|
||||
assert.equal('group_id' in blank, false, 'groupId 空串不带 group_id')
|
||||
const dirty = toJdProductListParams(
|
||||
{ shopName: ' ', productCode: '', titleKeyword: '', groupId: 'abc', syncedFrom: '2026/11/01', syncedTo: 'not-a-date' },
|
||||
{ productCode: '', titleKeyword: '', groupId: 'abc', syncedFrom: '2026/11/01', syncedTo: 'not-a-date' },
|
||||
1,
|
||||
20,
|
||||
)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/**
|
||||
* 京东数据库页(v1.4 Phase 5)的挂载契约。
|
||||
*
|
||||
* 形态:panel-box + 筛选行(店铺/商品编码/标题关键字/分类/同步起止 date 对)+
|
||||
* 形态:panel-box + 筛选行(商品编码/标题关键字/分类/分类状态/类目/同步起止 date 对)+
|
||||
* 查询/重置/店铺分类 + 自绘明细表(点行开详情抽屉)+ OldPagination;
|
||||
* 公司 tab 切换=清筛选重取(company-tab-wiring 同口径)。
|
||||
* 商品状态筛选/列与导出按钮已随 2026-11-15 客户口径从前端下线(后端端点保留)。
|
||||
* 商品状态筛选/列与导出按钮已随 2026-11-15 客户口径从前端下线(后端端点保留);
|
||||
* 店铺筛选与店铺列同日客户口径「店铺不需要」下线(后端 shop_name 参数同窗撤,店铺仍收详情抽屉)。
|
||||
* 不用 readFileSync(source-pin-ratchet 对台账外新文件带读点即红),全部走真实挂载断言。
|
||||
*
|
||||
* 跑法:`npx vitest run tests/mount/jd-database-page.mount.test.ts`
|
||||
@@ -102,15 +103,14 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
|
||||
expect(wrapper.find('.jd-summary').text()).toContain('共 42 条京东商品')
|
||||
})
|
||||
|
||||
it('行列字段与顺序对齐京麦(2026-11-15 用户口径):勾选/店铺/分组/商品信息(图+标题+编码+货号+品牌·类目+SKU/信息分)/总库存/价格/上架时间·商品状态/创建/修改/同步/操作(11 列)', async () => {
|
||||
it('行列字段与顺序对齐京麦(2026-11-15 用户口径):勾选/分组/商品信息(图+标题+编码+货号+品牌·类目+SKU/信息分)/总库存/价格/上架时间·商品状态/创建/修改/同步/操作(10 列;店铺列 2026-11-15 客户口径「店铺不需要」下线)', async () => {
|
||||
const wrapper = await mountWith({ items: [item(1)], total: 1, page: 1, pageSize: 20 })
|
||||
const cells = wrapper.findAll('tbody tr')[0].findAll('td')
|
||||
expect(cells).toHaveLength(11)
|
||||
expect(cells).toHaveLength(10)
|
||||
expect(cells[0].find('input[type="checkbox"]').exists()).toBe(true, '第 1 列是勾选框')
|
||||
expect(cells[1].text()).toBe('旗舰自营店', '第 2 列=店铺(admin 专属,置前)')
|
||||
expect(cells[2].text()).toBe('甲组', '第 3 列=分组(admin 专属)')
|
||||
expect(cells[1].text()).toBe('甲组', '第 2 列=分组(admin 专属)')
|
||||
// 商品信息列=京麦同款合并布局:主图+信息分+标题+商品编码+货号+品牌·类目行+SKU 标签。
|
||||
const info = cells[3]
|
||||
const info = cells[2]
|
||||
expect(info.find('.jd-thumb').exists()).toBe(true, '商品信息列含主图')
|
||||
expect(info.text()).toContain('304不锈钢保温杯')
|
||||
expect(info.text()).toContain('JD-1001', '商品编码并入商品信息列')
|
||||
@@ -119,18 +119,18 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
|
||||
expect(info.text()).toContain('家居 > 厨具 > 保温杯', '类目随品牌·类目行上列表(京麦同款)')
|
||||
expect(info.text()).toContain('12个SKU')
|
||||
expect(info.text()).toContain('信息分 81')
|
||||
expect(cells[4].text()).toBe('500', '第 4 数据列=总库存(京麦第 2 列)')
|
||||
expect(cells[5].text()).toBe('12.90 ~ 15.90', '第 5 数据列=价格(京麦第 3 列)')
|
||||
expect(cells[6].text()).toContain('上架中', '第 6 数据列=上架时间/商品状态(京麦合并列)')
|
||||
expect(cells[6].find('.jd-sale-dot').exists()).toBe(true, '状态带京麦同款圆点')
|
||||
expect(cells[7].text()).not.toBe('-', '第 7 数据列=创建时间')
|
||||
expect(cells[8].text()).not.toBe('-', '第 8 数据列=修改时间')
|
||||
expect(cells[9].text()).not.toBe('-', '第 9 数据列=同步时间(admin 专属,置末)')
|
||||
expect(cells[10].text()).toContain('编辑', '第 10 数据列=操作(编辑/删除)')
|
||||
// 表头字段名与顺序与京麦一致;品牌/类目不再是独立列(收进商品信息)。
|
||||
expect(cells[3].text()).toBe('500', '第 3 数据列=总库存(京麦第 2 列)')
|
||||
expect(cells[4].text()).toBe('12.90 ~ 15.90', '第 4 数据列=价格(京麦第 3 列)')
|
||||
expect(cells[5].text()).toContain('上架中', '第 5 数据列=上架时间/商品状态(京麦合并列)')
|
||||
expect(cells[5].find('.jd-sale-dot').exists()).toBe(true, '状态带京麦同款圆点')
|
||||
expect(cells[6].text()).not.toBe('-', '第 6 数据列=创建时间')
|
||||
expect(cells[7].text()).not.toBe('-', '第 7 数据列=修改时间')
|
||||
expect(cells[8].text()).not.toBe('-', '第 8 数据列=同步时间(admin 专属,置末)')
|
||||
expect(cells[9].text()).toContain('编辑', '第 9 数据列=操作(编辑/删除)')
|
||||
// 表头字段名与顺序与京麦一致;品牌/类目不再是独立列(收进商品信息);店铺列已下线。
|
||||
const headerText = wrapper.find('thead').text()
|
||||
for (const gone of ['品牌', '类目']) {
|
||||
expect(headerText).not.toContain(gone, `${gone}不再是独立列(京麦把它们收进商品信息)`)
|
||||
for (const gone of ['品牌', '类目', '店铺']) {
|
||||
expect(headerText).not.toContain(gone, `${gone}不再是独立列(品牌/类目收进商品信息;店铺 2026-11-15 下线)`)
|
||||
}
|
||||
for (const head of ['商品信息', '总库存', '价格', '上架时间 / 商品状态', '创建时间', '修改时间', '同步时间']) {
|
||||
expect(headerText).toContain(head, `表头必须有「${head}」(京麦字段名)`)
|
||||
@@ -142,7 +142,7 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
|
||||
const wrapper = await mountWith({ items: [item(1)], total: 1, page: 1, pageSize: 20 })
|
||||
// beforeEach 默认 confirm=true;本例先翻回 false 验「取消不动」。
|
||||
confirmMock.mockResolvedValue(false)
|
||||
const opsCell = wrapper.findAll('tbody tr')[0].findAll('td')[10]
|
||||
const opsCell = wrapper.findAll('tbody tr')[0].findAll('td')[9]
|
||||
await opsCell.findAll('button').find((b) => b.text() === '删除')!.trigger('click')
|
||||
await flushPromises()
|
||||
// 防冒泡:点删除不得顺手打开详情抽屉(抽屉的可视判据=.drawer 出现)。
|
||||
@@ -152,7 +152,7 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
|
||||
// 确认后:deleteJdProducts 按 id 直删(公共库写侧无公司维度,2026-11-15 公共化)。
|
||||
confirmMock.mockResolvedValue(true)
|
||||
jdApi.deleteJdProducts.mockResolvedValueOnce({ deleted: 1, imagesDeleted: 0, objectsDeleted: 0, objectsKept: 0, objectsSkipped: 0 })
|
||||
await wrapper.findAll('tbody tr')[0].findAll('td')[10].findAll('button').find((b) => b.text() === '删除')!.trigger('click')
|
||||
await wrapper.findAll('tbody tr')[0].findAll('td')[9].findAll('button').find((b) => b.text() === '删除')!.trigger('click')
|
||||
await flushPromises()
|
||||
expect(jdApi.deleteJdProducts).toHaveBeenCalledWith([1])
|
||||
})
|
||||
@@ -181,7 +181,7 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
|
||||
attrJsonRaw: '',
|
||||
})
|
||||
const wrapper = await mountWith({ items: [item(1)], total: 1, page: 1, pageSize: 20 })
|
||||
const opsCell = wrapper.findAll('tbody tr')[0].findAll('td')[10]
|
||||
const opsCell = wrapper.findAll('tbody tr')[0].findAll('td')[9]
|
||||
await opsCell.findAll('button').find((b) => b.text() === '编辑')!.trigger('click')
|
||||
await flushPromises()
|
||||
await flushPromises()
|
||||
@@ -217,18 +217,17 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
|
||||
|
||||
it('分类读不到的那行展示「未分类」(不猜名字;2026-11-15「分组管理」改「店铺分类」只换措辞)', async () => {
|
||||
const wrapper = await mountWith({ items: [item(1, { groupId: null, groupName: '' })], total: 1, page: 1, pageSize: 20 })
|
||||
expect(wrapper.findAll('tbody tr')[0].findAll('td')[2].text()).toBe('未分类')
|
||||
expect(wrapper.findAll('tbody tr')[0].findAll('td')[1].text()).toBe('未分类')
|
||||
})
|
||||
|
||||
it('筛选生效:店铺/编码/关键字/分组/起止日期,查询回第一页重发', async () => {
|
||||
it('筛选生效:编码/关键字/分组/起止日期,查询回第一页重发(店铺筛选 2026-11-15 下线)', async () => {
|
||||
jdApi.fetchJdProductGroups.mockResolvedValue([{ id: 7, name: '甲组', sortOrder: 0, productCount: 3 }])
|
||||
const wrapper = await mountWith({ items: [], total: 0, page: 1, pageSize: 20 })
|
||||
|
||||
const textInputs = wrapper.findAll('.form-group input[type="text"]')
|
||||
expect(textInputs).toHaveLength(3, '店铺+商品编码+标题关键字三个文本筛选框(商品状态已下线)')
|
||||
await textInputs[0].setValue('旗舰自营店')
|
||||
await textInputs[1].setValue('JD-1001')
|
||||
await textInputs[2].setValue('保温杯')
|
||||
expect(textInputs).toHaveLength(2, '商品编码+标题关键字两个文本筛选框(店铺/商品状态已下线)')
|
||||
await textInputs[0].setValue('JD-1001')
|
||||
await textInputs[1].setValue('保温杯')
|
||||
await wrapper.find('select').setValue('7')
|
||||
const dateInputs = wrapper.findAll('input[type="date"]')
|
||||
await dateInputs[0].setValue('2026-11-01')
|
||||
@@ -238,7 +237,6 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
|
||||
|
||||
const last = jdApi.fetchJdProductList.mock.calls.at(-1)![0]
|
||||
expect(last).toMatchObject({
|
||||
shopName: '旗舰自营店',
|
||||
productCode: 'JD-1001',
|
||||
titleKeyword: '保温杯',
|
||||
groupId: '7',
|
||||
@@ -247,6 +245,7 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
|
||||
page: 1,
|
||||
companyId: 1,
|
||||
})
|
||||
expect(last).not.toHaveProperty('shopName', '店铺筛选已下线,入参不再带 shopName')
|
||||
expect(last).not.toHaveProperty('saleStatus', '商品状态筛选已下线,入参不再带 saleStatus')
|
||||
})
|
||||
|
||||
@@ -314,8 +313,8 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
|
||||
it('重置把筛选面回空并回第一页重取', async () => {
|
||||
const wrapper = await mountWith({ items: [], total: 0, page: 1, pageSize: 20 })
|
||||
const textInputs = wrapper.findAll('.form-group input[type="text"]')
|
||||
await textInputs[0].setValue('旗舰自营店')
|
||||
await textInputs[2].setValue('保温杯')
|
||||
await textInputs[0].setValue('JD-1001')
|
||||
await textInputs[1].setValue('保温杯')
|
||||
const callsBefore = jdApi.fetchJdProductList.mock.calls.length
|
||||
|
||||
await wrapper.findAll('button').find((b) => b.text() === '重置')!.trigger('click')
|
||||
@@ -323,7 +322,7 @@ 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({ shopName: '', titleKeyword: '', page: 1 }, '重置后筛选全空、回第一页')
|
||||
expect(last).toMatchObject({ productCode: '', titleKeyword: '', page: 1 }, '重置后筛选全空、回第一页')
|
||||
})
|
||||
|
||||
it('翻页与改每页条数都重发请求,改条数回第一页', async () => {
|
||||
@@ -580,8 +579,8 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
|
||||
jdApi.fetchJdProductGroups.mockResolvedValue([{ id: 7, name: '甲组', sortOrder: 0, productCount: 3 }])
|
||||
const wrapper = await mountWith({ items: [item(1)], total: 1, page: 1, pageSize: 20 })
|
||||
const textInputs = wrapper.findAll('.form-group input[type="text"]')
|
||||
await textInputs[0].setValue('旗舰自营店')
|
||||
await textInputs[2].setValue('保温杯')
|
||||
await textInputs[0].setValue('JD-1001')
|
||||
await textInputs[1].setValue('保温杯')
|
||||
await wrapper.find('select').setValue('7')
|
||||
const callsBefore = jdApi.fetchJdProductList.mock.calls.length
|
||||
|
||||
@@ -592,10 +591,11 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
|
||||
expect(jdApi.fetchJdProductList.mock.calls.length).toBeGreaterThan(callsBefore)
|
||||
const last = jdApi.fetchJdProductList.mock.calls.at(-1)![0]
|
||||
expect(last.companyId).toBe(2)
|
||||
expect(last.shopName).toBe('', '切公司必须清掉上一家的店铺名')
|
||||
expect(last.productCode).toBe('', '切公司必须清掉上一家的商品编码')
|
||||
expect(last.titleKeyword).toBe('', '切公司必须清掉上一家的标题关键字')
|
||||
expect(last.groupId).toBe('7', '分组全平台一份(公共),groupId 与公司维度正交——切 tab 不清')
|
||||
expect(last).not.toHaveProperty('category', '切公司必须清掉上一家选的类目')
|
||||
expect(last).not.toHaveProperty('shopName', '店铺筛选已下线,入参不再带 shopName')
|
||||
expect(last.page).toBe(1)
|
||||
// 分组选项是全局的:切 tab 不重取(首屏那一次之后就不再增长),且任何一次拉取都不带公司维度。
|
||||
for (const call of jdApi.fetchJdProductGroups.mock.calls) {
|
||||
|
||||
Reference in New Issue
Block a user