feat(京东上架): 选分类=整分类上架+多店勾选不再整单拒(2026-11-26 晚客户口径)
客户口径「商品信息不要显示,选分类上架就行」「去掉一次只能发一家店的约束」: - 后端 JdPublishTaskService:resolveSingleShop→resolveSourceShops(多店不整单判死); applyTargetShop 四档——没带目标店且多店仍拒(老页面/老客户端 fail-closed), 带目标店时异店或多店一律 NEW;多店任务级来源店不钉死(明细行各带来源店快照) - 用户端:商品勾选列表/分页器下线,选中分类自动分页拉全整分类商品纳入上架集 (终止按累计行数对撞 total,不按本页满不满判);multi 档带 target=与 cross 同档 (协议≥4+琥珀人工确认),未检测=先点检测;建单目标店透传 - 台账:catch-silence blocks 338→339(loadProducts 拉取失败有红色出口,非静默) - 判据:JdPublishTaskServiceTest 多店两支(新增不钉来源/老口径仍拒)+ jd-publish-shop 纯函数+jd-publish-tab/mount 对齐
This commit is contained in:
@@ -42,13 +42,14 @@ import { useLiveTaskBoard } from '@/shared/composables/useLiveTaskBoard'
|
||||
import NotificationBell from '@/shared/components/NotificationBell.vue'
|
||||
import BrandApiSecretSettingsButton from '@/pages/brand/components/BrandApiSecretSettingsButton.vue'
|
||||
|
||||
/** 京东「商品上架」(v1.5 蓝图 §4 Phase 4):选分类 → 勾商品 → 改价规则 → 建单 → 右侧任务面板实时行级进度。
|
||||
/** 京东「商品上架」(v1.5 蓝图 §4 Phase 4;2026-11-26 晚客户口径「商品信息不要显示,选分类上架就行」):
|
||||
* 选分类(自动纳入该分类全部商品) → 改价规则 → 建单 → 右侧任务面板实时行级进度。
|
||||
*
|
||||
* 六条边界(照 v1.4/v1.5 已落地的采集契约与外观专利任务面板骨架,不另造流程):
|
||||
* 1. 分类选项唯一来源=jdCollect.groups 既有出口(B113-01,AC-9 源码绊线钉死:本页不得自拼
|
||||
* 分类 URL);分组下的商品列表走 jdPublish.products(2026-11-25 起作用域=本账号可见
|
||||
* 数据权限分组下的分类归属行,与分类下拉/徽标同源——同组同事采集的商品也能上架,
|
||||
* 跨公司/跨组看不到),页内翻页、勾选跨页累计;
|
||||
* 跨公司/跨组看不到),选中分类=分页拉全整分类商品自动纳入上架集,不再逐行勾选;
|
||||
* 2. 改价规则三档(none/percent/fixed,蓝图 §3 死契约),与勾选集一起进建单体;服务端按
|
||||
* 同一规则折算 SKU 价(铁律 27a 改价同源);
|
||||
* 3. 网页原样转交建单响应的 queuePayload;认领只由客户端与后端完成,投递失败仍可由客户端拉取;
|
||||
@@ -100,58 +101,48 @@ const GROUPS_EMPTY_HINT_TEXT =
|
||||
'本分组暂无分类——请联系管理员在后台「京东数据库 → 店铺分类」创建分类并归入你的分组后再上架。'
|
||||
const groupsEmpty = computed(() => !groupsLoading.value && groupOptions.value.length === 0)
|
||||
|
||||
// ---- 选品分页(作用域过滤在服务端:可见分组的分类归属行;勾选跨页累计在本地 Map,翻页不清空)----
|
||||
const PRODUCT_PAGE_SIZE = 12
|
||||
const products = ref<JdPublishProductVo[]>([])
|
||||
// ---- 选品(2026-11-26 晚客户口径「底下的商品信息就不要显示了,选分类上架就行」;
|
||||
// 作用域过滤仍在服务端:可见分组的分类归属行)----
|
||||
// 选中分类后**自动**分页拉全该分类下全部商品(100 条/页),整批纳入上架集:
|
||||
// 不再有商品行勾选、分页器与「全选分类」按钮;界面只显一行计数摘要。
|
||||
// 换分类=清空重拉,在飞循环按 request 令牌作废——迟到的旧分类商品绝不进新分类建单。
|
||||
const PRODUCT_FETCH_PAGE_SIZE = 100
|
||||
const productTotal = ref(0)
|
||||
const productPage = ref(1)
|
||||
const productsLoading = ref(false)
|
||||
const selectedProducts = ref(new Map<number, JdPublishProductVo>())
|
||||
let productRequest = 0
|
||||
|
||||
const selectedProductIds = computed(() => Array.from(selectedProducts.value.keys()))
|
||||
const wholePageSelected = computed(() => products.value.length > 0
|
||||
&& products.value.every((row) => selectedProducts.value.has(row.id)))
|
||||
const partOfPageSelected = computed(() => !wholePageSelected.value
|
||||
&& products.value.some((row) => selectedProducts.value.has(row.id)))
|
||||
|
||||
function togglePage(checked: boolean) {
|
||||
const next = new Map(selectedProducts.value)
|
||||
for (const row of products.value) {
|
||||
if (checked) next.set(row.id, row)
|
||||
else next.delete(row.id)
|
||||
}
|
||||
selectedProducts.value = next
|
||||
}
|
||||
|
||||
function toggleProduct(row: JdPublishProductVo, checked: boolean) {
|
||||
const next = new Map(selectedProducts.value)
|
||||
if (checked) next.set(row.id, row)
|
||||
else next.delete(row.id)
|
||||
selectedProducts.value = next
|
||||
}
|
||||
|
||||
function clearSelection() {
|
||||
selectedProducts.value = new Map()
|
||||
}
|
||||
|
||||
async function loadProducts() {
|
||||
const request = ++productRequest
|
||||
products.value = []
|
||||
selectedProducts.value = new Map()
|
||||
productTotal.value = 0
|
||||
if (selectedGroupId.value == null) {
|
||||
productTotal.value = 0
|
||||
productsLoading.value = false
|
||||
return
|
||||
}
|
||||
productsLoading.value = true
|
||||
try {
|
||||
const vo = await fetchJdPublishProducts(selectedGroupId.value, productPage.value, PRODUCT_PAGE_SIZE)
|
||||
if (request !== productRequest) return
|
||||
products.value = vo.items ?? []
|
||||
productTotal.value = vo.total ?? 0
|
||||
let fetched = 0
|
||||
for (let page = 1; ; page += 1) {
|
||||
const vo = await fetchJdPublishProducts(selectedGroupId.value, page, PRODUCT_FETCH_PAGE_SIZE)
|
||||
if (request !== productRequest) return
|
||||
const rows = vo.items ?? []
|
||||
if (rows.length > 0) {
|
||||
const merged = new Map(selectedProducts.value)
|
||||
for (const row of rows) merged.set(row.id, row)
|
||||
selectedProducts.value = merged
|
||||
}
|
||||
productTotal.value = typeof vo.total === 'number' ? vo.total : 0
|
||||
// 终止按「累计行数对撞 total」判,不按「本页满不满 100」判:服务端若收窄每页条数,
|
||||
// 满页判据会把第 1 页当末页漏掉后面全部商品。
|
||||
fetched += rows.length
|
||||
if (rows.length === 0 || fetched >= productTotal.value) break
|
||||
}
|
||||
} catch (err) {
|
||||
if (request === productRequest) {
|
||||
errorMessage.value = err instanceof Error ? err.message : '商品列表拉取失败,请稍后重试'
|
||||
errorMessage.value = err instanceof Error ? err.message : '分类商品读取失败,请稍后重试'
|
||||
}
|
||||
} finally {
|
||||
if (request === productRequest) productsLoading.value = false
|
||||
@@ -159,14 +150,6 @@ async function loadProducts() {
|
||||
}
|
||||
|
||||
function changeGroup() {
|
||||
productPage.value = 1
|
||||
productTotal.value = 0
|
||||
clearSelection()
|
||||
void loadProducts()
|
||||
}
|
||||
|
||||
function changePage(page: number) {
|
||||
productPage.value = page
|
||||
void loadProducts()
|
||||
}
|
||||
|
||||
@@ -207,8 +190,10 @@ const shopGuard = computed(() => evaluateShopGuard(selectedProductRows.value, cu
|
||||
/** 本机发布协议代次(0=读不到/老客户端;品牌要 ≥3、跨店要 ≥4,见 jd-publish-shop 常量)。 */
|
||||
const localProtocol = ref(0)
|
||||
const crossSupported = computed(() => localProtocol.value >= JD_PUBLISH_CROSS_PROTOCOL)
|
||||
/** 异店=跨店上架:目标店就是京麦当前登录店(服务端据此算 publishMode=NEW)。 */
|
||||
const usesCrossShop = computed(() => shopGuard.value.state === 'cross')
|
||||
/** 异店=跨店上架:目标店就是京麦当前登录店(服务端据此算 publishMode=NEW)。
|
||||
* 多店已检测=同一档(2026-11-26 晚「去掉一次只能发一家店的约束」):整单在京麦登录店新增。 */
|
||||
const usesCrossShop = computed(() => shopGuard.value.state === 'cross'
|
||||
|| (shopGuard.value.state === 'multi' && shopGuard.value.target != null))
|
||||
/** 跨店必须人工确认一次(会在目标店新建商品、要过京东审核),勾选或店铺变化即重置。 */
|
||||
const crossConfirmed = ref(false)
|
||||
watch(shopGuard, () => { crossConfirmed.value = false })
|
||||
@@ -225,7 +210,7 @@ async function readPublishProtocol(): Promise<number> {
|
||||
}
|
||||
}
|
||||
|
||||
/** 来源店铺文案:没取到/多家店/单店三档(多店由 shopGuard 直接拦)。 */
|
||||
/** 来源店铺文案:没取到/多家店/单店三档(多店已检测时整单走跨店新增,不再拦)。 */
|
||||
const sourceShopText = computed(() => {
|
||||
const guard = shopGuard.value
|
||||
if (guard.state === 'unknown') return '未取到(旧商品数据没有店铺信息)'
|
||||
@@ -234,9 +219,11 @@ const sourceShopText = computed(() => {
|
||||
})
|
||||
|
||||
/** 跨店档的目标店文案(同店/未检测档为空,模板按它决定是否显示目标店行)。 */
|
||||
const crossTargetText = computed(() => (usesCrossShop.value && shopGuard.value.state === 'cross'
|
||||
? shopLabel(shopGuard.value.target)
|
||||
: ''))
|
||||
const crossTargetText = computed(() => {
|
||||
const guard = shopGuard.value
|
||||
const target = guard.state === 'cross' || guard.state === 'multi' ? guard.target : null
|
||||
return usesCrossShop.value && target ? shopLabel(target) : ''
|
||||
})
|
||||
|
||||
const currentShopText = computed(() => (currentShop.value ? shopLabel(currentShop.value) : '未检测'))
|
||||
|
||||
@@ -761,8 +748,13 @@ async function startPublish() {
|
||||
errorMessage.value = shopIssue
|
||||
return
|
||||
}
|
||||
const targetShop = shopGuard.value.state === 'cross'
|
||||
? { shopId: shopGuard.value.target.shopId, shopName: shopGuard.value.target.shopName }
|
||||
// 跨店与「多店已检测」同档:目标店=京麦当前登录店,服务端据此算 publishMode=NEW。
|
||||
const guardForCreate = shopGuard.value
|
||||
const createTarget = guardForCreate.state === 'cross' || guardForCreate.state === 'multi'
|
||||
? guardForCreate.target
|
||||
: null
|
||||
const targetShop = createTarget
|
||||
? { shopId: createTarget.shopId, shopName: createTarget.shopName }
|
||||
: undefined
|
||||
const vo = targetShop
|
||||
? await createJdPublishTask(categoryId, productIds, priceRule, brand, targetShop)
|
||||
@@ -825,7 +817,7 @@ onUnmounted(() => {
|
||||
<router-link class="tool-head__back" :to="backHref">← 返回京东工具台</router-link>
|
||||
<span class="tool-head__title">商品上架</span>
|
||||
<span class="tool-head__desc">
|
||||
把京东数据库里的商品批量上架到京麦店铺:选分类、勾商品、可选统一改价,本机已登录京麦的客户端逐个发布。
|
||||
把京东数据库里的商品批量上架到京麦店铺:选分类即整分类上架、可选统一改价,本机已登录京麦的客户端逐个发布。
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -851,9 +843,11 @@ onUnmounted(() => {
|
||||
<span class="shop-line__value">{{ crossTargetText }}</span>
|
||||
</p>
|
||||
<p v-if="shopError" class="shop-alert">{{ shopError }}</p>
|
||||
<p v-else-if="shopGuard.state === 'multi'" class="shop-alert">{{ shopGuard.message }}</p>
|
||||
<p v-else-if="shopGuard.state === 'cross' && !crossSupported" class="shop-alert">{{ CROSS_UPGRADE_NOTICE }}</p>
|
||||
<template v-else-if="shopGuard.state === 'cross'">
|
||||
<!-- 多店还没检测:先点检测(没有目标店服务端也会拒)。 -->
|
||||
<p v-else-if="shopGuard.state === 'multi' && !shopGuard.target" class="shop-alert">{{ shopGuard.message }}</p>
|
||||
<!-- 跨店与多店同档:协议不够给升级提示,够则琥珀说明+人工确认。 -->
|
||||
<p v-else-if="(shopGuard.state === 'cross' || shopGuard.state === 'multi') && !crossSupported" class="shop-alert">{{ CROSS_UPGRADE_NOTICE }}</p>
|
||||
<template v-else-if="shopGuard.state === 'cross' || shopGuard.state === 'multi'">
|
||||
<p class="shop-alert shop-alert--cross">{{ shopGuard.message }}</p>
|
||||
<label class="shop-cross-confirm">
|
||||
<input v-model="crossConfirmed" type="checkbox" />
|
||||
@@ -880,42 +874,22 @@ onUnmounted(() => {
|
||||
:label="`${group.name}(${group.productCount ?? 0} 个商品)`" :value="group.id" />
|
||||
</el-select>
|
||||
<p v-if="groupsEmpty" class="category-hint category-hint--warn">{{ GROUPS_EMPTY_HINT_TEXT }}</p>
|
||||
<p v-else class="category-hint">分类由管理员在后台「京东数据库」维护;列表显示你可见分类下的商品(同组同事采集的也能上架)。</p>
|
||||
<p v-else class="category-hint">分类由管理员在后台「京东数据库」维护;选中分类即整分类上架,自动纳入你可见分类下的全部商品(同组同事采集的也能上架)。</p>
|
||||
</div>
|
||||
|
||||
<!-- 选品摘要(客户口径「商品信息不要显示,选分类上架就行」):选中分类=整分类上架。 -->
|
||||
<div class="product-block" v-loading="productsLoading">
|
||||
<div class="product-head">
|
||||
<span class="category-label">选择商品(已选 {{ selectedProducts.size }} 个,跨页累计)</span>
|
||||
<label v-if="products.length" class="category-hint">
|
||||
<input type="checkbox" class="product-select-page" :checked="wholePageSelected"
|
||||
:indeterminate.prop="partOfPageSelected"
|
||||
@change="togglePage(($event.target as HTMLInputElement).checked)" />
|
||||
全选本页
|
||||
</label>
|
||||
<button v-if="selectedProducts.size" class="shop-cat-clear" type="button"
|
||||
@click="clearSelection">清空勾选</button>
|
||||
<span class="category-label">上架商品(本分类全部)</span>
|
||||
</div>
|
||||
<div v-if="!products.length && !productsLoading" class="product-empty">
|
||||
{{ selectedGroupId ? '该分类下暂无商品' : '请先选择分类' }}
|
||||
</div>
|
||||
<label v-for="product in products" :key="product.id" class="product-row">
|
||||
<input type="checkbox" class="product-check"
|
||||
:checked="selectedProducts.has(product.id)"
|
||||
@change="toggleProduct(product, ($event.target as HTMLInputElement).checked)" />
|
||||
<img v-if="product.mainImageUrl" class="product-thumb" :src="product.mainImageUrl" alt="" loading="lazy" />
|
||||
<span v-else class="product-thumb product-thumb--empty">无图</span>
|
||||
<span class="product-info">
|
||||
<span class="product-title">{{ product.title }}</span>
|
||||
<span class="product-meta">
|
||||
<template v-if="product.shopName">店铺 {{ product.shopName }} · </template>
|
||||
¥{{ product.priceMin ?? '-' }}<template v-if="product.priceMax && product.priceMax !== product.priceMin">~{{ product.priceMax }}</template>
|
||||
· 库存 {{ product.stockTotal ?? '-' }}<template v-if="product.skuCount"> · {{ product.skuCount }}个SKU</template>
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
<el-pagination v-if="productTotal > PRODUCT_PAGE_SIZE" class="product-pager" layout="prev, pager, next"
|
||||
:total="productTotal" :page-size="PRODUCT_PAGE_SIZE" :current-page="productPage"
|
||||
@current-change="changePage" />
|
||||
<div v-if="!selectedGroupId" class="product-empty">请先选择分类</div>
|
||||
<p v-else-if="productsLoading && selectedProducts.size === 0" class="category-hint">
|
||||
正在读取本分类商品…
|
||||
</p>
|
||||
<div v-else-if="selectedProducts.size === 0" class="product-empty">该分类下暂无商品</div>
|
||||
<p v-else class="category-hint">
|
||||
已纳入本分类全部 {{ selectedProducts.size }} 个商品,点下方按钮整批上架(不再逐个勾选)。
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="category-block">
|
||||
@@ -940,7 +914,7 @@ onUnmounted(() => {
|
||||
<button class="collect-btn" type="button" :disabled="submitDisabled" @click="startPublish">
|
||||
{{ submitting ? '创建中…' : (usesCrossShop
|
||||
? `跨店上架 ${selectedProducts.size} 个商品到目标店`
|
||||
: `上架已选 ${selectedProducts.size} 个商品`) }}
|
||||
: `上架本分类 ${selectedProducts.size} 个商品`) }}
|
||||
</button>
|
||||
|
||||
<p class="collect-hint">
|
||||
@@ -1037,18 +1011,7 @@ onUnmounted(() => {
|
||||
.product-block { margin-bottom: 16px; }
|
||||
.product-head { display: flex; align-items: center; justify-content: space-between; }
|
||||
.product-head .category-label { margin-bottom: 8px; }
|
||||
.product-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 6px; border: 1px solid #2c3547; border-radius: 8px; background: #20283a; cursor: pointer; }
|
||||
.product-row:hover { border-color: #3e4a62; }
|
||||
.product-check { flex-shrink: 0; width: 15px; height: 15px; accent-color: #e1251b; cursor: pointer; }
|
||||
.product-thumb { flex-shrink: 0; width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: #232b3d; }
|
||||
.product-thumb--empty { display: inline-flex; align-items: center; justify-content: center; color: #5f6c85; font-size: 11px; }
|
||||
.product-info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
|
||||
.product-title { color: #d9e1ef; font-size: 12px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
||||
.product-meta { color: #8a97ad; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.product-empty { padding: 18px 0; color: #5f6c85; font-size: 12px; text-align: center; }
|
||||
.product-pager { margin-top: 8px; justify-content: center; }
|
||||
.product-pager :deep(.el-pager li), .product-pager :deep(.btn-prev), .product-pager :deep(.btn-next) { background: transparent; color: #c8d2e2; }
|
||||
.product-pager :deep(.el-pager li.is-active) { color: #6ea8ff; }
|
||||
.target-brand-input { box-sizing: border-box; width: 100%; padding: 8px 10px; border: 1px solid #3e4a62; border-radius: 6px; background: #232b3d; color: #c8d2e2; font: inherit; }
|
||||
.target-brand-input[aria-invalid="true"] { border-color: #fca5a5; }
|
||||
.price-input { width: 100%; margin-top: 8px; }
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
* 是哪一个店铺?」;2026-11-26 客户口径「要跨店」后判据从「必须同店」改成「同店与跨店都行」)。
|
||||
*
|
||||
* 三份身份,各有唯一出处,三层同一标记:
|
||||
* 1. **来源店铺**=所勾商品行的 `shopName/shopId`(京东数据库快照)。服务端建单时按它做
|
||||
* 「一单只能发到一家店」校验(`JdPublishTaskService.resolveSingleShop`),并把它钉进
|
||||
* 任务载荷与明细下发(`JdPublishItemsPageVo.shopId/shopName`);
|
||||
* 1. **来源店铺**=上架集商品行(2026-11-26 晚起=所选分类全部商品行)的 `shopName/shopId`
|
||||
* (京东数据库快照)。服务端建单时按它归一
|
||||
* 发布模式(`JdPublishTaskService.resolveSourceShops`:单店可克隆、异店/多店整单走新增;
|
||||
* 2026-11-26 晚客户口径「去掉一次只能发一家店的约束」后多店不再整单拒绝),
|
||||
* 单店时钉进任务载荷、多店时只有明细行各带来源店(`JdPublishItemsPageVo.shopId/shopName`);
|
||||
* 2. **京麦当前登录店铺**=桥 `get_jd_shop_info` 现拉(客户端起有头浏览器读京麦首屏),
|
||||
* 不是页面缓存、也不是上次「同步分类」的残留;跨店时它就是**目标店**(服务端据此算
|
||||
* `publishMode=NEW`,客户端走京麦「新增商品」路径);
|
||||
@@ -47,8 +49,12 @@ export type JdShopGuard =
|
||||
| { state: 'match'; expected: JdShopRef; actual: JdShopRef }
|
||||
/** 京麦登录的不是来源店 ⇒ 跨店上架(目标店=京麦当前登录店,走新增商品路径) */
|
||||
| { state: 'cross'; expected: JdShopRef; target: JdShopRef; message: string }
|
||||
/** 勾选的商品来自多家店 ⇒ 服务端也会拒(按店分开勾) */
|
||||
| { state: 'multi'; shops: JdShopRef[]; message: string }
|
||||
/**
|
||||
* 勾选的商品来自多家店(2026-11-26 晚客户口径「去掉一次只能发一家店的约束」):
|
||||
* 已检测京麦 ⇒ 整单按跨店新增放行(目标店=京麦登录店,服务端 publishMode=NEW,
|
||||
* 与 cross 档同样要协议 ≥4 与人工确认);未检测 ⇒ 拦(建单没有目标店,服务端也会拒)。
|
||||
*/
|
||||
| { state: 'multi'; shops: JdShopRef[]; target: JdShopRef | null; message: string }
|
||||
|
||||
function text(value: unknown): string {
|
||||
return String(value ?? '').trim()
|
||||
@@ -108,10 +114,19 @@ export function crossShopMessage(source: JdShopRef | null | undefined, target: J
|
||||
+ '否则该商品会按「目标店没有授权类目」逐行失败。')
|
||||
}
|
||||
|
||||
/** 跨店勾选整句(与服务端建单拒绝文案同口径:按店分开勾)。 */
|
||||
export function multiShopMessage(shops: ReadonlyArray<JdShopRef>): string {
|
||||
/** 多店已检测京麦:整单跨店新增的说明句(与服务端 NEW 档口径一致)。 */
|
||||
export function multiShopCrossMessage(shops: ReadonlyArray<JdShopRef>, target: JdShopRef): string {
|
||||
const labels = shops.map((shop) => shopLabel(shop)).join('、')
|
||||
return `本次勾选的商品来自多个店铺(${labels}),一次上架只能发到一家店,请按店铺分开勾选。`
|
||||
return (`本次勾选的商品来自多个店铺(${labels}),将全部在京麦当前登录的「${shopLabel(target)}」`
|
||||
+ '以「新增商品」方式新建上架(与各来源店的商品各自独立,需京东审核通过后才上架);'
|
||||
+ '目标店须已授权各商品的类目,否则按「目标店没有授权类目」逐行失败。')
|
||||
}
|
||||
|
||||
/** 多店还没检测京麦:先检测的指引句(不带目标店建单服务端也会拒)。 */
|
||||
export function multiShopDetectMessage(shops: ReadonlyArray<JdShopRef>): string {
|
||||
const labels = shops.map((shop) => shopLabel(shop)).join('、')
|
||||
return (`本次勾选的商品来自多个店铺(${labels}):多店商品只能整单在京麦当前登录店铺`
|
||||
+ '以新增商品方式上架,请先点「检测京麦店铺」确认登录店后再建单。')
|
||||
}
|
||||
|
||||
/** true/false=能比;null=两边都缺可比字段(只认同一维度:id 对 id、名对名)。 */
|
||||
@@ -127,10 +142,17 @@ export function evaluateShopGuard(
|
||||
detected: JdShopRef | null | undefined,
|
||||
): JdShopGuard {
|
||||
const refs = sourceShopRefs(products)
|
||||
if (refs.length > 1) return { state: 'multi', shops: refs, message: multiShopMessage(refs) }
|
||||
const actual = normalizeShopRef(detected)
|
||||
if (refs.length > 1) {
|
||||
return {
|
||||
state: 'multi',
|
||||
shops: refs,
|
||||
target: actual,
|
||||
message: actual ? multiShopCrossMessage(refs, actual) : multiShopDetectMessage(refs),
|
||||
}
|
||||
}
|
||||
const expected = refs[0]
|
||||
if (!expected) return { state: 'unknown' }
|
||||
const actual = normalizeShopRef(detected)
|
||||
if (!actual) return { state: 'undetected', expected }
|
||||
const same = sameShop(expected, actual)
|
||||
// 比不了(一边只有店名、另一边只有 id)不判不匹配:宁可留给客户端强拦截,也不误拦真实任务。
|
||||
@@ -140,16 +162,20 @@ export function evaluateShopGuard(
|
||||
}
|
||||
|
||||
/**
|
||||
* UI 唯一处断:多店必拦;跨店档默认拦(本机不支持跨店=协议 < 4),
|
||||
* ``crossAllowed`` 为真时放行(客户端会走新增商品路径)。
|
||||
* UI 唯一处断:跨店与「多店已检测」档默认拦(本机不支持跨店=协议 < 4),
|
||||
* ``crossAllowed`` 为真时放行(客户端会走新增商品路径);
|
||||
* 多店还没检测京麦必拦(建单没有目标店,服务端也会拒)。
|
||||
*/
|
||||
export function shopGuardBlocks(guard: JdShopGuard, crossAllowed = false): boolean {
|
||||
if (guard.state === 'cross') return !crossAllowed
|
||||
return guard.state === 'multi'
|
||||
if (guard.state === 'multi') return !guard.target || !crossAllowed
|
||||
return false
|
||||
}
|
||||
|
||||
/** 拦截文案(空串=可建单):跨店档在协议不够时给升级提示,见 ``CROSS_UPGRADE_NOTICE``。 */
|
||||
/** 拦截文案(空串=可建单):协议不够时给升级提示,见 ``CROSS_UPGRADE_NOTICE``。 */
|
||||
export function shopGuardMessage(guard: JdShopGuard, crossAllowed = false): string {
|
||||
if (guard.state === 'cross') return crossAllowed ? '' : CROSS_UPGRADE_NOTICE
|
||||
return guard.state === 'multi' ? guard.message : ''
|
||||
if (guard.state !== 'multi') return ''
|
||||
if (!guard.target) return guard.message
|
||||
return crossAllowed ? '' : CROSS_UPGRADE_NOTICE
|
||||
}
|
||||
@@ -3,7 +3,8 @@
|
||||
*
|
||||
* 一级入口在桌面首页(与「亚马逊 / 视频」并列,见 DesktopHomePage),进来后是这两个菜单:
|
||||
* 1. 获取店铺数据:一键抓已登录京麦后台的店铺商品(列表 + 详情 + 图片),落后台「京东数据库」;
|
||||
* 2. 商品上架(v1.5 Phase 4 转正式):选自定义分类勾商品建单,本机已登录京麦的客户端逐个发布;
|
||||
* 2. 商品上架(v1.5 Phase 4 转正式;2026-11-26 晚客户口径「选分类上架就行」):
|
||||
* 选自定义分类=整分类建单,本机已登录京麦的客户端逐个发布;
|
||||
*
|
||||
* 卡片形状照亚马逊工具台(tool-catalog.ts)的 ToolInfo,样式复用同一套深色卡片墙。
|
||||
*
|
||||
@@ -44,7 +45,7 @@ export const JD_TOOLS: ReadonlyArray<JdToolInfo> = [
|
||||
{
|
||||
id: 'jd-publish',
|
||||
name: '商品上架',
|
||||
desc: '把京东数据库里你自己的商品批量上架到京麦店铺:选分类、勾商品、可选统一改价,本机客户端逐个发布',
|
||||
desc: '把京东数据库里你自己的商品批量上架到京麦店铺:选分类即整分类上架、可选统一改价,本机客户端逐个发布',
|
||||
tag: '核心',
|
||||
href: '/jd-publish',
|
||||
permissionKeys: ['jd-publish'],
|
||||
|
||||
Reference in New Issue
Block a user