fix(jd): 京东数据库价格列恢复显示+时间三列后移(2026-11-16 客户三问)

This commit is contained in:
2026-11-16 00:38:14 +08:00
parent ee3ff6fe8c
commit 46a334004a
4 changed files with 67 additions and 24 deletions
@@ -52,8 +52,10 @@ function item(id: number, over: Record<string, unknown> = {}) {
title: '304不锈钢保温杯大容量便携',
brand: '锅宝',
categoryPath: '家居 > 厨具 > 保温杯',
priceMin: '12.90',
priceMax: '15.90',
// 价格用 number 形状(2026-11-16 实录:后端 BigDecimal 序列化成 JSON number,
// 字符串夹具曾把「解析层丢数字形状」这个真红藏住=生产库有价、界面全「-」)。
priceMin: 12.9,
priceMax: 15.9,
stockTotal: 500,
saleStatus: '上架中',
listTab: 'search',
@@ -103,7 +105,7 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
expect(wrapper.find('.jd-summary').text()).toContain('共 42 条京东商品')
})
it('行列字段与顺序对齐京麦(2026-11-15 用户口径):勾选/分组/商品信息(图+标题+编码+货号+品牌·类目+SKU/信息分)/总库存/价格/上架时间·商品状态/创建/修改/同步/操作(10 列;店铺列 2026-11-15 客户口径「店铺不需要」下线)', async () => {
it('行列字段与顺序对齐京麦(2026-11-15 用户口径;时间三列 2026-11-16「时间移动到最后去」移到操作之后):勾选/分组/商品信息(图+标题+编码+货号+品牌·类目+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(10)
@@ -120,19 +122,20 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
expect(info.text()).toContain('12个SKU')
expect(info.text()).toContain('信息分 81')
expect(cells[3].text()).toBe('500', '第 3 数据列=总库存(京麦第 2 列)')
expect(cells[4].text()).toBe('12.90 ~ 15.90', '第 4 数据列=价格(京麦第 3 列)')
expect(cells[4].text()).toBe('12.9 ~ 15.9', '第 4 数据列=价格(京麦第 3 列;number 形状价格不许显示 -)')
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 数据列=操作(编辑/删除)')
expect(cells[6].text()).toContain('编辑', '第 6 数据列=操作(编辑/删除;2026-11-16 时间三列后移,操作前置)')
expect(cells[6].text()).toContain('删除', '操作列含删除按钮')
expect(cells[7].text()).not.toBe('-', '第 7 数据列=创建时间(2026-11-16 移到操作之后)')
expect(cells[8].text()).not.toBe('-', '第 8 数据列=修改时间')
expect(cells[9].text()).not.toBe('-', '第 9 数据列=同步时间(admin 专属,置末)')
// 表头字段名与顺序与京麦一致;品牌/类目不再是独立列(收进商品信息);店铺列已下线。
const headerText = wrapper.find('thead').text()
for (const gone of ['品牌', '类目', '店铺']) {
expect(headerText).not.toContain(gone, `${gone}不再是独立列(品牌/类目收进商品信息;店铺 2026-11-15 下线)`)
}
for (const head of ['商品信息', '总库存', '价格', '上架时间 / 商品状态', '创建时间', '修改时间', '同步时间']) {
for (const head of ['商品信息', '总库存', '价格', '上架时间 / 商品状态', '操作', '创建时间', '修改时间', '同步时间']) {
expect(headerText).toContain(head, `表头必须有「${head}」(京麦字段名)`)
}
expect(wrapper.find('.jd-thumb').exists()).toBe(true, '商品信息列渲染缩略图')
@@ -142,7 +145,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')[9]
const opsCell = wrapper.findAll('tbody tr')[0].findAll('td')[6]
await opsCell.findAll('button').find((b) => b.text() === '删除')!.trigger('click')
await flushPromises()
// 防冒泡:点删除不得顺手打开详情抽屉(抽屉的可视判据=.drawer 出现)。
@@ -152,7 +155,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')[9].findAll('button').find((b) => b.text() === '删除')!.trigger('click')
await wrapper.findAll('tbody tr')[0].findAll('td')[6].findAll('button').find((b) => b.text() === '删除')!.trigger('click')
await flushPromises()
expect(jdApi.deleteJdProducts).toHaveBeenCalledWith([1])
})
@@ -166,8 +169,8 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
brand: '锅宝',
categoryPath: '家居 > 厨具 > 保温杯',
itemNum: 'ITEM-1',
priceMin: '12.90',
priceMax: '15.90',
priceMin: 12.9,
priceMax: 15.9,
stockTotal: 500,
saleStatus: '上架中',
groupId: 7,
@@ -181,7 +184,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')[9]
const opsCell = wrapper.findAll('tbody tr')[0].findAll('td')[6]
await opsCell.findAll('button').find((b) => b.text() === '编辑')!.trigger('click')
await flushPromises()
await flushPromises()