feat(jd): 店铺分类弹窗新建收成+图标/排序输入下线;京东数据库下线店铺筛选与列(后端 shop_name 参数同窗撤)
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
/** 京东数据库页(v1.4 Phase 5):公共的京东商品库(2026-11-15 用户定案「不区分公司、属于
|
||||
* 公共的」,分类同亚马逊口径全平台一份),筛选行(店铺/商品编码/标题关键字/分类/分类状态/
|
||||
* 公共的」,分类同亚马逊口径全平台一份),筛选行(商品编码/标题关键字/分类/分类状态/
|
||||
* 类目/同步起止 date 对)+查询/重置/店铺分类 + 自绘明细表(勾选列+点行开详情抽屉)
|
||||
* + 删除(单行/批量,先删桶对象、全成功才删库行,确认弹窗点名数量)+ OldPagination。
|
||||
* 公司维度只剩超管的公司 tab(=筛选管理员,非超管没有这个筛选、看到同一份公共全量);
|
||||
* 列表按京麦商品列表样式(2026-11-15 用户口径):店铺/分类前置为第 1/2 列;商品信息列=京麦同款
|
||||
* 列表按京麦商品列表样式(2026-11-15 用户口径):分类前置为第 1 列;商品信息列=京麦同款
|
||||
* 合并布局(主图+图下信息分+标题两行+商品编码/货号+SKU 数标签,编码带一键复制);类目/上架
|
||||
* 时间/京东创建/修改时间仍收详情抽屉基本信息(B104「详情显示全部属性」口径不变)。
|
||||
* 商品状态筛选框/列与导出按钮随 2026-11-15 客户口径「这两个不要/导出也不用」从前端下线
|
||||
* (后端 sale_status 参数与 /export 端点保留;状态仍收详情抽屉)。
|
||||
* (后端 sale_status 参数与 /export 端点保留;状态仍收详情抽屉);店铺筛选与店铺列同日
|
||||
* 客户口径「店铺不需要」下线(后端 shop_name 参数同窗撤;店铺仍收详情抽屉)。
|
||||
* 骨架像素复刻「外观专利数据库」页(panel-box + LoadFailureBar + 自绘 table + 旧式分页);
|
||||
* 超管切公司 tab = 清筛选重取(watch 体照外观专利页逐字形状);日期对护栏:起侧 max=止侧、
|
||||
* 止侧 min=起侧、两侧 @change 用 orderedPair 把倒挂交换回来(clampJdSyncedRange 照 clampDatePair)。
|
||||
@@ -117,7 +118,6 @@ async function load(): Promise<void> {
|
||||
const result = await fetchJdProductList({
|
||||
page: page.value,
|
||||
pageSize: pageSize.value,
|
||||
shopName: filter.shopName,
|
||||
productCode: filter.productCode,
|
||||
titleKeyword: filter.titleKeyword,
|
||||
category: filter.category,
|
||||
@@ -238,10 +238,10 @@ async function removeMany(picked: JdProductItem[], message: string): Promise<voi
|
||||
}
|
||||
}
|
||||
|
||||
// 超管切公司 tab = 重新取数:店铺/编码/关键字/类目/日期是按行集筛的自由值,在另一家的
|
||||
// 超管切公司 tab = 重新取数:编码/关键字/类目/日期是按行集筛的自由值,在另一家的
|
||||
// 行集里筛不出东西,必须一起清(分组与分类状态全平台一份,groupId/groupScope 与公司维度
|
||||
// 正交、不清);类目选项与行集同源,按新 tab 重取;分组选项是全局的、进页取一次即可。
|
||||
watch(() => companyTab.activeId, () => { filter.shopName = ''; filter.productCode = ''; filter.titleKeyword = ''; filter.category = ''; filter.syncedFrom = ''; filter.syncedTo = ''; page.value = 1; void loadCategoryOptions(); void load() })
|
||||
watch(() => companyTab.activeId, () => { filter.productCode = ''; filter.titleKeyword = ''; filter.category = ''; filter.syncedFrom = ''; filter.syncedTo = ''; page.value = 1; void loadCategoryOptions(); void load() })
|
||||
|
||||
onMounted(() => {
|
||||
void loadGroupOptions()
|
||||
@@ -259,10 +259,6 @@ onMounted(() => {
|
||||
</div>
|
||||
|
||||
<div class="jd-filter-row">
|
||||
<div class="form-group">
|
||||
<label>店铺</label>
|
||||
<input v-model="filter.shopName" type="text" placeholder="输入店铺名" @keyup.enter="apply" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>商品编码</label>
|
||||
<input v-model="filter.productCode" type="text" placeholder="输入商品编码" @keyup.enter="apply" />
|
||||
@@ -333,7 +329,6 @@ onMounted(() => {
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 42px"><input type="checkbox" :checked="allSelected" @change="toggleSelectAll(($event.target as HTMLInputElement).checked)" /></th>
|
||||
<th style="width: 130px">店铺</th>
|
||||
<th style="width: 96px">分类</th>
|
||||
<th>商品信息</th>
|
||||
<th style="width: 76px">总库存</th>
|
||||
@@ -349,7 +344,6 @@ onMounted(() => {
|
||||
<template v-if="rows.length">
|
||||
<tr v-for="row in rows" :key="row.id" class="jd-row" @click="openDetail(row)">
|
||||
<td @click.stop><input type="checkbox" :checked="selectedIds.has(row.id)" @change="toggleSelect(row, ($event.target as HTMLInputElement).checked)" /></td>
|
||||
<td :title="row.shopName || ''">{{ row.shopName || '-' }}</td>
|
||||
<td :title="row.groupName || ''">{{ row.groupName || '未分类' }}</td>
|
||||
<td class="jd-info-cell">
|
||||
<div class="jd-info-wrap">
|
||||
@@ -392,10 +386,10 @@ onMounted(() => {
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-else-if="loading">
|
||||
<td colspan="11" class="empty-tip">加载中...</td>
|
||||
<td colspan="10" class="empty-tip">加载中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td colspan="11" class="empty-tip">暂无京东商品数据</td>
|
||||
<td colspan="10" class="empty-tip">暂无京东商品数据</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
/** 京东商品「店铺分类」弹窗(2026-11-15 由「分组管理」小弹窗重做):左右分栏——左栏分类管理
|
||||
* (新建/改名/删除;分组全平台一份、措辞「分类」),右栏商品人工归类(独立件
|
||||
* (新建=输入行尾「+」图标,排序数字输入 2026-11-15 客户口径下线、sortOrder 恒 0;
|
||||
* 改名/删除;分组全平台一份、措辞「分类」),右栏商品人工归类(独立件
|
||||
* JdProductAssignPane:范围切换+搜索+勾选 →「归入所选分类」/「移出分类」,批量端点
|
||||
* batch-assign-group 与单行编辑同口径置 manual_locked=1——归类即人工干预,采集不再覆盖/
|
||||
* 清理该行)。左栏点亮的分类=右栏归类目标;目标被删时右栏自动拉回全量页签。
|
||||
@@ -30,9 +31,8 @@ const emit = defineEmits<{ (event: 'close'): void; (event: 'changed'): void }>()
|
||||
const loading = ref(false)
|
||||
const errorText = ref('')
|
||||
const groups = ref<JdProductGroup[]>([])
|
||||
/** 新建:名称 + 排序。 */
|
||||
/** 新建:只收名称(排序输入 2026-11-15 客户口径下线,sortOrder 恒 0,后端契约不变)。 */
|
||||
const createName = ref('')
|
||||
const createSortOrder = ref(0)
|
||||
const creating = ref(false)
|
||||
/** 改名:正在编辑的分类 id 与草稿名。 */
|
||||
const editingId = ref(0)
|
||||
@@ -73,9 +73,8 @@ async function submitCreate(): Promise<void> {
|
||||
creating.value = true
|
||||
errorText.value = ''
|
||||
try {
|
||||
await createJdProductGroup({ name, sortOrder: Math.floor(createSortOrder.value) || 0 })
|
||||
await createJdProductGroup({ name, sortOrder: 0 })
|
||||
createName.value = ''
|
||||
createSortOrder.value = 0
|
||||
await refreshAfterChange()
|
||||
} catch (error) {
|
||||
errorText.value = requestErrorMessage(error) || '新建分类失败'
|
||||
@@ -143,7 +142,6 @@ watch(
|
||||
if (visible) {
|
||||
cancelRename()
|
||||
createName.value = ''
|
||||
createSortOrder.value = 0
|
||||
errorText.value = ''
|
||||
selectedGroupId.value = 0
|
||||
void loadGroups()
|
||||
@@ -180,12 +178,16 @@ function onPaneChanged(): void {
|
||||
placeholder="输入新分类名称"
|
||||
@keyup.enter="submitCreate"
|
||||
/>
|
||||
<div class="group-create-row">
|
||||
<input v-model.number="createSortOrder" type="number" class="sort-input" aria-label="排序" />
|
||||
<button class="btn" type="button" :disabled="!canCreate" @click="submitCreate">
|
||||
{{ creating ? '新建中...' : '新建分类' }}
|
||||
</button>
|
||||
</div>
|
||||
<!-- 新建=输入行尾「+」图标(2026-11-15 客户口径:原第二行文字按钮收成图标上移,
|
||||
排序数字输入下线——sortOrder 恒 0,后端契约不变)。 -->
|
||||
<button
|
||||
class="create-icon-btn"
|
||||
type="button"
|
||||
title="新建分类"
|
||||
aria-label="新建分类"
|
||||
:disabled="!canCreate"
|
||||
@click="submitCreate"
|
||||
>+</button>
|
||||
</div>
|
||||
<p v-if="loading" class="pane-tip">加载中...</p>
|
||||
<ul class="group-list">
|
||||
@@ -305,11 +307,12 @@ function onPaneChanged(): void {
|
||||
}
|
||||
.group-create {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.group-create input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
min-height: 36px;
|
||||
padding: 6px 12px;
|
||||
@@ -325,12 +328,23 @@ function onPaneChanged(): void {
|
||||
background: #ffffff;
|
||||
border-color: #5f85ad;
|
||||
}
|
||||
.group-create-row {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
/* 新建「+」图标按钮:与输入同行(原第二行文字按钮上移收成图标)。 */
|
||||
.create-icon-btn {
|
||||
flex: none;
|
||||
width: 36px;
|
||||
min-height: 36px;
|
||||
padding: 0;
|
||||
border: 1px solid #4f78a5;
|
||||
border-radius: 9px;
|
||||
background: linear-gradient(135deg, #5f85ad, #4f78a5);
|
||||
color: #ffffff;
|
||||
font-size: 18px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
.sort-input {
|
||||
flex: 0 0 72px !important;
|
||||
.create-icon-btn:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.6;
|
||||
}
|
||||
.group-list {
|
||||
flex: 1;
|
||||
|
||||
@@ -25,7 +25,6 @@ export async function fetchJdProductList(
|
||||
): Promise<JdProductPageResult> {
|
||||
const query = toJdProductListParams(
|
||||
{
|
||||
shopName: params.shopName ?? '',
|
||||
productCode: params.productCode ?? '',
|
||||
titleKeyword: params.titleKeyword ?? '',
|
||||
category: params.category ?? '',
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/** 京东数据库页筛选纯函数(v1.4 Phase 5):店铺/商品编码/标题关键字/类目/分组/分类状态/同步起止 + snake 分页参数。
|
||||
* 产出与后端契约 §列表 query 逐字对撞:`page`/`page_size`(默认 20、上限 100)、`shop_name`、
|
||||
/** 京东数据库页筛选纯函数(v1.4 Phase 5):商品编码/标题关键字/类目/分组/分类状态/同步起止 + snake 分页参数。
|
||||
* 产出与后端契约 §列表 query 逐字对撞:`page`/`page_size`(默认 20、上限 100)、
|
||||
* `product_code`、`title_keyword`、`category`(京麦末级类目等值过滤,2026-11-15 增)、
|
||||
* `group_id`、`grouped`(只看已分类,2026-11-15 客户口径「查询已分类的跟未分类,分类好的
|
||||
* 可以不显示」增)、`ungrouped`(只看未分类,页面「分类状态」档与店铺分类弹窗共用)、
|
||||
* `synced_from`/`synced_to`(ISO yyyy-MM-dd;空白不下发)。
|
||||
* 商品状态筛选与导出(2026-11-15 客户口径「这两个不要/导出也不用」)已从前端下线;
|
||||
* 店铺筛选同日客户口径「店铺不需要」从前端下线(后端 shop_name 参数同窗撤,DB 列与详情不动)。
|
||||
* 后端 `sale_status` 参数与 `/export` 端点保留(无 UI 入口),重上时从 git 历史找回取值口。
|
||||
* 分页钳制(铁律 15):page < 1 归 1、上限 10_000(后端 CR-18 同值),(page-1)*page_size
|
||||
* 最大 999_900,Number.MAX_SAFE_INTEGER 也不会把乘积顶出安全整数。纯逻辑,node --test 直测。
|
||||
@@ -21,8 +22,6 @@ export const JD_PRODUCT_MAX_PAGE_SIZE = 100
|
||||
export const JD_PRODUCT_MAX_PAGE = 10_000
|
||||
|
||||
export interface JdProductFilterState {
|
||||
/** 店铺名(模糊),空串不限。 */
|
||||
shopName: string
|
||||
/** 商品编码,空串不限。 */
|
||||
productCode: string
|
||||
/** 标题关键字,空串不限。 */
|
||||
@@ -41,12 +40,11 @@ export interface JdProductFilterState {
|
||||
}
|
||||
|
||||
export function createJdProductFilterState(): JdProductFilterState {
|
||||
return { shopName: '', productCode: '', titleKeyword: '', category: '', groupId: '', groupScope: '', syncedFrom: '', syncedTo: '' }
|
||||
return { productCode: '', titleKeyword: '', category: '', groupId: '', groupScope: '', syncedFrom: '', syncedTo: '' }
|
||||
}
|
||||
|
||||
/** 是否有任一激活筛选条件。 */
|
||||
export function jdProductFilterActive(state: JdProductFilterState): boolean {
|
||||
if ((state.shopName || '').trim()) return true
|
||||
if ((state.productCode || '').trim()) return true
|
||||
if ((state.titleKeyword || '').trim()) return true
|
||||
if ((state.category || '').trim()) return true
|
||||
@@ -60,7 +58,6 @@ export function jdProductFilterActive(state: JdProductFilterState): boolean {
|
||||
export interface JdProductQuery {
|
||||
page: number
|
||||
page_size: number
|
||||
shop_name?: string
|
||||
product_code?: string
|
||||
title_keyword?: string
|
||||
/** 京麦末级类目等值过滤(后端 JdProductQueryService.Filter.category)。 */
|
||||
@@ -81,7 +78,6 @@ export interface JdProductQuery {
|
||||
export interface JdProductListParams {
|
||||
page: number
|
||||
pageSize: number
|
||||
shopName?: string
|
||||
productCode?: string
|
||||
titleKeyword?: string
|
||||
category?: string
|
||||
@@ -98,8 +94,6 @@ export interface JdProductListParams {
|
||||
/** 过滤态 → 过滤面参数(snake_case,仅下发非空字段)。 */
|
||||
function toJdProductFilterQuery(state: JdProductFilterState): Omit<JdProductQuery, 'page' | 'page_size'> {
|
||||
const query: Omit<JdProductQuery, 'page' | 'page_size'> = {}
|
||||
const shopName = (state.shopName || '').trim()
|
||||
if (shopName) query.shop_name = shopName
|
||||
const productCode = (state.productCode || '').trim()
|
||||
if (productCode) query.product_code = productCode
|
||||
const titleKeyword = (state.titleKeyword || '').trim()
|
||||
|
||||
Reference in New Issue
Block a user