diff --git a/admin-frontend-vue/src/pages/jd/JdDatabasePage.vue b/admin-frontend-vue/src/pages/jd/JdDatabasePage.vue index 321f8d8ca..43b209a7b 100644 --- a/admin-frontend-vue/src/pages/jd/JdDatabasePage.vue +++ b/admin-frontend-vue/src/pages/jd/JdDatabasePage.vue @@ -7,12 +7,14 @@ * 列表按京麦商品列表样式(2026-11-15 用户口径):分类前置为第 1 列;商品信息列=京麦同款 * 合并布局(主图+图下信息分+标题两行+商品编码/货号+SKU 数标签,编码带一键复制);类目/上架 * 时间/京东创建/修改时间仍收详情抽屉基本信息(B104「详情显示全部属性」口径不变)。 - * 商品状态筛选框/列与导出按钮随 2026-11-15 客户口径「这两个不要/导出也不用」从前端下线 - * (后端 sale_status 参数与 /export 端点保留;状态仍收详情抽屉);店铺筛选与店铺列同日 - * 客户口径「店铺不需要」下线(后端 shop_name 参数同窗撤;店铺仍收详情抽屉)。 - * 2026-11-16 两笔(用户截图反馈):① 创建/修改/同步三个时间列按「时间移动到最后去」移到 + * 商品状态筛选框与导出按钮随 2026-11-15 客户口径「这两个不要/导出也不用」从前端下线 + * (后端 sale_status 参数与 /export 端点保留);店铺筛选与店铺列同日客户口径「店铺不需要」 + * 下线(后端 shop_name 参数同窗撤);店铺仍收详情抽屉。 + * 2026-11-16 三笔(用户截图反馈):① 创建/修改/同步三个时间列按「时间移动到最后去」移到 * 操作列之后收尾;② 价格列修「采集到了却全显示 -」=模型解析层 text() 丢掉后端 BigDecimal - * 的 JSON number 形状(生产库 273/273 行 price_min 全有值,jd-product-model.ts decimalText 收口)。 + * 的 JSON number 形状(生产库 273/273 行 price_min 全有值,jd-product-model.ts decimalText 收口); + * ③ 「上架时间 / 商品状态」合并列整列下线(「不需要采集」口径,jd_online_at/sale_status 仍收 + * 详情抽屉),操作列随 2026-11-16「操作放最后一列」口径置末。 * 骨架像素复刻「外观专利数据库」页(panel-box + LoadFailureBar + 自绘 table + 旧式分页); * 超管切公司 tab = 清筛选重取(watch 体照外观专利页逐字形状);日期对护栏:起侧 max=止侧、 * 止侧 min=起侧、两侧 @change 用 orderedPair 把倒挂交换回来(clampJdSyncedRange 照 clampDatePair)。 @@ -325,11 +327,11 @@ onMounted(() => {
共 {{ total }} 条京东商品 + - {{ formatDateTime(row.jdCreatedAt || '') || '-' }} - {{ formatDateTime(row.jdUpdatedAt || '') || '-' }} - {{ formatDateTime(row.syncedAt || '') }} - 加载中... + 加载中... - 暂无京东商品数据 + 暂无京东商品数据 @@ -598,10 +594,13 @@ h3 { .jd-table-scroll > table { min-width: 1500px; } -/* 操作列(编辑/删除):双小按钮,放开换行不让按钮被裁。 */ +/* 操作列(编辑/删除):双小按钮需 138px(ops-cell-must-wrap 实测口径:两字按钮 53×2+24 padding)。 + overflow 显式放开:td 全局是 overflow:hidden(611 行),压线时第二颗(删除)会被裁成 + 「编辑+…」的形状——2026-11-16 用户报「删除没了」的真因,列宽 120px < 实测 138px。 */ .jd-ops-cell { - white-space: normal; + white-space: nowrap; text-overflow: clip; + overflow: visible; } .btn-sm { min-height: 28px; @@ -747,26 +746,6 @@ h3 { color: #3d5368; font-weight: 550; } -.jd-online-cell { - line-height: 1.45; -} -/* 商品状态(京麦同款圆点):上架中绿点,其余灰点。 */ -.jd-sale-status { - display: flex; - align-items: center; - gap: 5px; - color: #24384d; -} -.jd-sale-dot { - width: 7px; - height: 7px; - border-radius: 50%; - background: #2fb26b; - flex-shrink: 0; -} -.jd-sale-status.off .jd-sale-dot { - background: #9fb0c0; -} .jd-tag { display: inline-flex; align-items: center; 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 81e7fa130..cc8af939c 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 @@ -105,10 +105,10 @@ describe('京东数据库页(v1.4 Phase 5)', () => { expect(wrapper.find('.jd-summary').text()).toContain('共 42 条京东商品') }) - it('行列字段与顺序对齐京麦(2026-11-15 用户口径;时间三列 2026-11-16「时间移动到最后去」移到操作之后):勾选/分组/商品信息(图+标题+编码+货号+品牌·类目+SKU/信息分)/总库存/价格/上架时间·商品状态/操作/创建/修改/同步(10 列;店铺列 2026-11-15 客户口径「店铺不需要」下线)', async () => { + it('行列字段与顺序(2026-11-15 用户口径;时间三列 2026-11-16「时间移动到最后去」收尾;状态列整列下线+操作置末 2026-11-16「操作放最后一列」):勾选/分组/商品信息(图+标题+编码+货号+品牌·类目+SKU/信息分)/总库存/价格/创建/修改/同步/操作(9 列;店铺列 2026-11-15 客户口径「店铺不需要」下线;「上架时间 / 商品状态」列 2026-11-16 客户口径「不需要采集」下线,仍收详情抽屉)', 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) + expect(cells).toHaveLength(9) expect(cells[0].find('input[type="checkbox"]').exists()).toBe(true, '第 1 列是勾选框') expect(cells[1].text()).toBe('甲组', '第 2 列=分组(admin 专属)') // 商品信息列=京麦同款合并布局:主图+信息分+标题+商品编码+货号+品牌·类目行+SKU 标签。 @@ -123,19 +123,17 @@ describe('京东数据库页(v1.4 Phase 5)', () => { expect(info.text()).toContain('信息分 81') expect(cells[3].text()).toBe('500', '第 3 数据列=总库存(京麦第 2 列)') 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()).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 专属,置末)') - // 表头字段名与顺序与京麦一致;品牌/类目不再是独立列(收进商品信息);店铺列已下线。 + expect(cells[5].text()).not.toBe('-', '第 5 数据列=创建时间(2026-11-16 时间三列收尾)') + expect(cells[6].text()).not.toBe('-', '第 6 数据列=修改时间') + expect(cells[7].text()).not.toBe('-', '第 7 数据列=同步时间(admin 专属)') + expect(cells[8].text()).toContain('编辑', '第 8 数据列=操作(编辑/删除;2026-11-16「操作放最后一列」置末)') + expect(cells[8].text()).toContain('删除', '操作列含删除按钮') + // 表头字段名与顺序与京麦一致;品牌/类目不再是独立列(收进商品信息);店铺列/状态列已下线。 const headerText = wrapper.find('thead').text() - for (const gone of ['品牌', '类目', '店铺']) { - expect(headerText).not.toContain(gone, `${gone}不再是独立列(品牌/类目收进商品信息;店铺 2026-11-15 下线)`) + for (const gone of ['品牌', '类目', '店铺', '上架时间 / 商品状态']) { + expect(headerText).not.toContain(gone, `${gone}不再是独立列(品牌/类目收进商品信息;店铺 2026-11-15 下线;状态列 2026-11-16 下线)`) } - for (const head of ['商品信息', '总库存', '价格', '上架时间 / 商品状态', '操作', '创建时间', '修改时间', '同步时间']) { + for (const head of ['商品信息', '总库存', '价格', '创建时间', '修改时间', '同步时间', '操作']) { expect(headerText).toContain(head, `表头必须有「${head}」(京麦字段名)`) } expect(wrapper.find('.jd-thumb').exists()).toBe(true, '商品信息列渲染缩略图') @@ -145,7 +143,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')[6] + const opsCell = wrapper.findAll('tbody tr')[0].findAll('td')[8] await opsCell.findAll('button').find((b) => b.text() === '删除')!.trigger('click') await flushPromises() // 防冒泡:点删除不得顺手打开详情抽屉(抽屉的可视判据=.drawer 出现)。 @@ -155,7 +153,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')[6].findAll('button').find((b) => b.text() === '删除')!.trigger('click') + await wrapper.findAll('tbody tr')[0].findAll('td')[8].findAll('button').find((b) => b.text() === '删除')!.trigger('click') await flushPromises() expect(jdApi.deleteJdProducts).toHaveBeenCalledWith([1]) }) @@ -184,7 +182,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')[6] + const opsCell = wrapper.findAll('tbody tr')[0].findAll('td')[8] await opsCell.findAll('button').find((b) => b.text() === '编辑')!.trigger('click') await flushPromises() await flushPromises() @@ -422,7 +420,12 @@ describe('京东数据库页(v1.4 Phase 5)', () => { expect(wrapper.find('.drawer-mask').exists()).toBe(true) expect(jdApi.fetchJdProductDetail).toHaveBeenCalledTimes(1) expect(jdApi.fetchJdProductDetail).toHaveBeenCalledWith(1) - expect(wrapper.find('.drawer-mask').text()).toContain('基本信息') + // 2026-11-16 客户口径「详情页的样式要和京麦商品详情一样」:顶部改「左图右信息」hero + // 布局(左侧主图大图+缩略图,右侧关键信息),「基本信息」块标题随 hero 化下线。 + expect(wrapper.find('.detail-hero').exists()).toBe(true, '顶部左图右信息 hero 布局') + expect(wrapper.find('.hero-main').exists()).toBe(true, '左侧主图大图') + expect(wrapper.find('.hero-info').text()).toContain('价格区间') + expect(wrapper.find('.hero-info').text()).toContain('12.9 ~ 15.9', '价格走 decimalText(number/字符串都收)') expect(wrapper.find('.drawer-mask').text()).toContain('规格') expect(wrapper.find('.drawer-mask').text()).toContain('容量') expect(wrapper.find('.drawer-mask').text()).toContain('500ml') @@ -495,10 +498,13 @@ describe('京东数据库页(v1.4 Phase 5)', () => { jdApi.deleteJdProducts.mockResolvedValue({ deleted: 2, imagesDeleted: 18, objectsDeleted: 16, objectsKept: 2, objectsSkipped: 0 }) const wrapper = await mountWith({ items: [item(1), item(2)], total: 2, page: 1, pageSize: 20 }) + // 批量删除常显(2026-11-16 客户口径「不要勾选后才显示」):未勾选时就在,只是置灰。 + expect(wrapper.find('.jd-delete-btn').exists()).toBe(true, '工具栏「删除勾选」常显') + expect(wrapper.find('.jd-delete-btn').attributes('disabled')).toBeDefined() const boxes = wrapper.findAll('tbody input[type="checkbox"]') await boxes[0].setValue(true) await boxes[1].setValue(true) - expect(wrapper.find('.jd-delete-btn').exists()).toBe(true, '勾选后工具栏出「删除勾选」') + expect(wrapper.find('.jd-delete-btn').attributes('disabled')).toBeUndefined('勾选后按钮可点') await wrapper.find('.jd-delete-btn').trigger('click') await flushPromises() await flushPromises() @@ -514,9 +520,10 @@ describe('京东数据库页(v1.4 Phase 5)', () => { expect(jdApi.deleteJdProducts).toHaveBeenCalledWith([1, 2]) expect(document.body.textContent).toContain('已删除 2 个商品') expect(document.body.textContent).toContain('2 个共用图片保留', '共用对象计数要透出到反馈') - // 成功后重取列表并清勾选:工具栏按钮消失。 + // 成功后重取列表并清勾选:常显按钮回到置灰(不再消失)。 expect(jdApi.fetchJdProductList.mock.calls.length).toBeGreaterThan(1) - expect(wrapper.find('.jd-delete-btn').exists()).toBe(false) + expect(wrapper.find('.jd-delete-btn').exists()).toBe(true) + expect(wrapper.find('.jd-delete-btn').attributes('disabled')).toBeDefined() }) it('删除:确认弹窗点取消就不发请求(防误删的第一道闸)', async () => {