aliChoice 填到最后一步(差「请选择物流属性」);修 fillRequiredSelects 三个真 bug(attr-label.required 不认 / 容器项误点 / 下拉读残留)

This commit is contained in:
admin9webs committed 2026-09-20 21:24:40 +08:00
1 parent acabadffd4
commit 924ca86fdc
6 files changed
+254 -40

No files matched your search

+37 -33
View File
@@ -1,41 +1,45 @@
# aliChoice(速卖通全托管)侦察 — 未跑通,下一轮从这里接着做
# aliChoice(速卖通全托管)配方 — 差最后一步,下一轮从「物流属性」接着做
路由:`https://www.dianxiaomi.com/web/smtChoice/add` 列表:`/web/smtChoice/{draft=采集箱, offline=待发布}`
页面标题:`店小秘--添加速卖通全托管产品`
## 已勘明(`alc_probe1.mjs`)
## 已经打通的(`alc_try1.mjs`,一条完整填到最后一步)
1. **店铺**:`店铺名称` 下拉(实测 2 家:`XYZ Store` / `UniStyle Bag Store`),取第一家 → `shopId=4393191`
2. **备货类型**:下拉 `国内履约` / `海外备货` → 取第一个(→ `productType='1'`)
3. **类目**:`选择分类` 弹窗 → 用 `sh_build.selectCategory(c, cat_kw, cat_kw)`(与 SHEIN/Temu 同一套)
4. **标题** → `smtChoiceAddBasicStore.formState.subject`(⚠️ **不是 Joom 的 `name`**)
5. **主图** → `smtChoiceAddProductStore.formState.mainImage[]`(吃 `{url,imgUrl,name,width,height}`)
6. **PC端描述** → `smtChoiceAddStore.describeInfoData.detail`(DOM 里是个 `TEXTAREA`)
7. **SKU 行** → `smtChoiceSkuDataStore.formState.skuDataList[]`
字段:`skuPrice / skuCode / scItemBarCode / packageWeight / packageLength / packageWidth /
packageHeight / logisticAttrListJson / logisticAttrList / imageList`
8. **必填类目属性**(品牌 / 高关注化学品 / 产地)→ `fillRequiredSelects()` 现已能自动填
(产地会输「中国」过滤后选 `中国大陆`)
### 店铺
`店铺名称` 是**下拉**,本例只有 **2 家**:`XYZ Store`、`UniStyle Bag Store`。
(上一轮侦察写的「64 家」是平台维度统计,实际可用店铺以后续页面为准。)
## ⛔ 当前唯一卡点:「请选择物流属性」
保存时钩子给 `MYJ.error: 校验失败`,DOM 里是一个**没有 label** 的报错块:
### 表单(可见,前 8 项)
`店铺名称 · 备货类型 · 产品标题 · 产品分类(+选择分类/自动识别分类) · 店小秘分类 · 来源URL · 产品属性`
```html
<div class="ant-form-item-has-error">
<span></span><i class="iconfont icon_edit2 link ml-4"></i>
<div class="text-red-500 font-size-12 mr-[20px]">请选择物流属性</div>
</div>
```
### store 与字段落点(**注意:和 Joom 共用 `smtChoice*`,但字段名不同**)
| store | 关键字段 |
|---|---|
| `smtChoiceAddBasicStore` | `shopId`、`categoryId`、`productType`、**`subject`(产品标题在这里,不是 `name`)** |
| `smtChoiceAddProductStore` | `mainImage[]`(数组)、`whiteBgImg`、`sceneImg`、`productManual`、`installVideo`、`videoData` |
| `smtChoiceSkuDataStore` | `skuDataList[]`(默认已生成 1 行) |
| `smtChoiceSkuAttrStore` | `skuAttrs[]` |
| `smtChoiceAddAttrStore` | `customAttrs[]` + 一大票汽配字段(`motorIds` / `vehicleEuAfids` …) |
| `smtChoiceAddOtherStore` | `packageFormState` / `otherInfoFormState` / `otherBusinessInfoState` |
| `smtChoiceAddStore` | `productInfo` / `attrsInfo` / `describeInfoData`(**没有 formState**) |
- 它带一个 `icon_edit2 link` 的编辑入口 → 点开大概率是「物流属性」弹窗/抽屉
- SKU 行里有 `logisticAttrListJson` / `logisticAttrList` 两个字段空着,应该就是它要填的
- 下一步:点那个 `icon_edit2`,dump 弹窗结构(很可能要按类目选物流渠道/时效)
⚠️ 和 Joom 的差异:Joom 标题在 `smtChoiceAddBasicStore.name`,这里在 `.subject`。
**别把 Joom 的填法直接抄过来。**
## 另一个未验证项:4 个规格组都是 0 选项
`smtChoiceSkuAttrStore.formState.skuAttrs` 有 4 组:
`Ships From(200007763) / Color(14) / Number of Pcs(200116262) / Bulk Buy(200483263)`,
但 `options` 都是 0(值在 `_options` 或要异步加载),DOM 里能看到值(卡其色/粉红/6Pc/Set…)。
**未验证变种值是否必须选**——先解物流属性,再看保存是否又冒出新的一层。
## 下一轮的顺序建议
1. 选店铺(下拉,取第一家 `XYZ Store`)
2. **备货类型**(必填,先探选项)
3. 类目:`选择分类` 弹窗(同 SHEIN/Temu 那套)+ 留意「自动识别分类」
4. 标题 → `smtChoiceAddBasicStore.subject`
5. 图片 → `smtChoiceAddProductStore.mainImage[]`
6. SKU 行 / 属性 / 包装 → 对应 store
7. **挂钩子再保存**(大概率还有层层递进的必填:参考 Temu 的省份→变种→尺寸→净重→预览图)
## 已知可复用的东西
- `shein建品/sh_lib.mjs`(`newPage`/`closePage`/`installHook`/`readHook`)
- `shein建品/sh_build.mjs` 的 `selectCategory` / `fillRequiredSelects`(SHEIN/Temu/Joom 都已验证)
- `joom建品/jmbatch.mjs` 的骨架(换字段名和控件类型即可)
## 本轮顺手修好的共享 bug(`shein建品/sh_build.mjs` 的 `fillRequiredSelects`)
之前它在 aliChoice 上**一个必填属性都填不上**,三个原因,都已修:
1. select 分支的必填判断只看 `label.ant-form-item-required`,而速卖通系的属性是
`.attr-label.required`(label 上还常带 `*` 前缀)→ 现在三种标记都认
2. 容器项「产品属性」本身也带 `*`,会被当成一个字段去点 → 现在跳过**含嵌套 `.ant-form-item`** 的项
3. 点开下拉后按 `.pop()` 取最后一个可见下拉,容易读到**上一个字段残留**的列表
(曾把化学物列表当国家列表)→ 现在①每次点前先 `Esc` ②按**与点击点的距离**挑下拉
③产地/Origin 先 `Input.insertText('中国')` 过滤