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
@@ -10,6 +10,9 @@
* 商品状态筛选框/列与导出按钮随 2026-11-15 客户口径「这两个不要/导出也不用」从前端下线
* (后端 sale_status 参数与 /export 端点保留;状态仍收详情抽屉);店铺筛选与店铺列同日
* 客户口径「店铺不需要」下线(后端 shop_name 参数同窗撤;店铺仍收详情抽屉)。
* 2026-11-16 两笔(用户截图反馈):① 创建/修改/同步三个时间列按「时间移动到最后去」移到
* 操作列之后收尾;② 价格列修「采集到了却全显示 -」=模型解析层 text() 丢掉后端 BigDecimal
* 的 JSON number 形状(生产库 273/273 行 price_min 全有值,jd-product-model.ts decimalText 收口)。
* 骨架像素复刻「外观专利数据库」页(panel-box + LoadFailureBar + 自绘 table + 旧式分页);
* 超管切公司 tab = 清筛选重取(watch 体照外观专利页逐字形状);日期对护栏:起侧 max=止侧、
* 止侧 min=起侧、两侧 @change 用 orderedPair 把倒挂交换回来(clampJdSyncedRange 照 clampDatePair)。
@@ -342,10 +345,11 @@ onMounted(() => {
<th style="width: 76px">总库存</th>
<th style="width: 120px">价格</th>
<th style="width: 170px">上架时间 / 商品状态</th>
<!-- 创建/修改/同步三个时间列 2026-11-16 客户口径「时间移动到最后去」移到操作列之后收尾。 -->
<th style="width: 120px">操作</th>
<th style="width: 150px">创建时间</th>
<th style="width: 150px">修改时间</th>
<th style="width: 170px">同步时间</th>
<th style="width: 120px">操作</th>
</tr>
</thead>
<tbody>
@@ -383,14 +387,15 @@ onMounted(() => {
<span class="jd-sale-dot"></span>{{ row.saleStatus }}
</div>
</td>
<td>{{ formatDateTime(row.jdCreatedAt || '') || '-' }}</td>
<td>{{ formatDateTime(row.jdUpdatedAt || '') || '-' }}</td>
<td>{{ formatDateTime(row.syncedAt || '') }}</td>
<!-- 操作列(2026-11-15 用户口径):编辑/删除;@click.stop 防冒泡开详情抽屉。 -->
<!-- 操作列(2026-11-15 用户口径):编辑/删除;@click.stop 防冒泡开详情抽屉。
2026-11-16 客户口径「时间移动到最后去」:操作列前置,创建/修改/同步三列收尾。 -->
<td class="jd-ops-cell" @click.stop>
<button class="btn btn-sm" type="button" @click="openEdit(row)">编辑</button>
<button class="btn btn-sm btn-danger" type="button" :disabled="deleting" @click="removeOne(row)">删除</button>
</td>
<td>{{ formatDateTime(row.jdCreatedAt || '') || '-' }}</td>
<td>{{ formatDateTime(row.jdUpdatedAt || '') || '-' }}</td>
<td>{{ formatDateTime(row.syncedAt || '') }}</td>
</tr>
</template>
<tr v-else-if="loading">
@@ -19,7 +19,11 @@ export interface JdProductItem {
title: string
brand: string
categoryPath: string
/** 价格区间下限(京麦 priceDetailVO.minJdPrice):后端 BigDecimal 序列化成 JSON number,
* decimalText 数值/字符串都收——2026-11-16 实录:text() 把 number 丢成空串=生产库
* 273/273 行 price_min 全有值而列表价格全显示「-」(用户报「价格没采集到」的真因)。 */
priceMin: string
/** 价格区间上限(京麦 priceDetailVO.maxJdPrice),解析口径同 priceMin。 */
priceMax: string
stockTotal: number | null
/** 上架中/已下架/审核中/草稿。 */
@@ -59,10 +63,13 @@ function numberOrNull(value: unknown): number | null {
return typeof value === 'number' && Number.isFinite(value) ? Math.floor(value) : null
}
/** 价格区间展示:min/max 都空为 -,只空一侧给单值。 */
/** 价格区间展示:min/max 都空为 -,只空一侧给单值。输入数值/字符串都收
* (后端 BigDecimal 序列化成 JSON number;列表行解析层之外,mount 测试 mock
* 绕过解析层时 number 会原样进这里——对 number 直接 .trim() 抛 TypeError
* 炸整页渲染,2026-11-16 实录),统一 decimalText 归一后再拼。 */
export function jdPriceRange(item: Pick<JdProductItem, 'priceMin' | 'priceMax'>): string {
const min = (item.priceMin || '').trim()
const max = (item.priceMax || '').trim()
const min = decimalText(item.priceMin).trim()
const max = decimalText(item.priceMax).trim()
if (min && max) return min === max ? min : `${min} ~ ${max}`
return min || max || ''
}
@@ -85,8 +92,11 @@ export function toJdProductItem(raw: unknown): JdProductItem | null {
title: text(record.title),
brand: text(record.brand),
categoryPath: text(record.categoryPath ?? record.category_path),
priceMin: text(record.priceMin ?? record.price_min),
priceMax: text(record.priceMax ?? record.price_max),
// 价格必须走 decimalText(数值/字符串都收):后端 BigDecimal 序列化成 JSON number,
// text() 对非字符串一律回空串=采集到的价格在解析层被丢掉(2026-11-16 生产库 273 行
// price_min 全有值、列表全「-」实录)。与详情 SKU 价(decimalText)同一出口。
priceMin: decimalText(record.priceMin ?? record.price_min),
priceMax: decimalText(record.priceMax ?? record.price_max),
stockTotal: numberOrNull(record.stockTotal ?? record.stock_total),
saleStatus: text(record.saleStatus ?? record.sale_status),
listTab: text(record.listTab ?? record.list_tab),