fix: 修复入驻误校验与商品品牌显示 0,并优化分类、运费模板交互

- 入驻第三步改为先回填再渲染,避免空字段进页即提示
- 入驻协议无内容时按空字符串处理,避免读取 null
- 商品品牌空值展示占位符,提交时再转为 0
- 店内分类为空时横向展示「暂无分类」
- 运费模板选择地址默认折叠,操作文案改为「选择地址」
This commit is contained in:
田香琪
2026-08-20 16:55:05 +08:00
parent 9540a1b98b
commit 085674dfa7
6 changed files with 99 additions and 45 deletions

View File

@@ -126,6 +126,12 @@ export default {
form: { // 表单数据
storeLogo: [],
goodsManagementCategory: [],
storeName: "",
storeAddressDetail: "",
storeDesc: "",
storeAddressIdPath: "",
storeAddressPath: "",
storeCenter: "",
},
rules: { // 验证规则
goodsManagementCategory: [
@@ -244,18 +250,42 @@ export default {
(id) => this.normalizeCategoryId(id)
);
},
createEmptyForm () {
return {
storeLogo: [],
goodsManagementCategory: [],
storeName: "",
storeAddressDetail: "",
storeDesc: "",
storeAddressIdPath: "",
storeAddressPath: "",
storeCenter: "",
};
},
initFormFromContent (content) {
const src = content && Object.keys(content).length
? JSON.parse(JSON.stringify(content))
: {};
this.form = {
...this.createEmptyForm(),
...src,
};
this.form.storeLogo = src.storeLogo
? String(src.storeLogo).split(",").filter(Boolean)
: [];
this.form.goodsManagementCategory = src.goodsManagementCategory
? String(src.goodsManagementCategory).split(",").filter(Boolean)
: [];
["storeName", "storeAddressDetail", "storeDesc", "storeAddressIdPath", "storeAddressPath", "storeCenter"].forEach((key) => {
if (this.form[key] == null) this.form[key] = "";
});
},
},
created () {
this.initFormFromContent(this.content);
},
mounted () {
this.accessToken.accessToken = storage.getItem('accessToken');
if (this.content && Object.keys(this.content).length) {
this.form = JSON.parse(JSON.stringify(this.content));
this.form.storeLogo = this.content.storeLogo
? String(this.content.storeLogo).split(',').filter(Boolean)
: [];
this.form.goodsManagementCategory = this.content.goodsManagementCategory
? String(this.content.goodsManagementCategory).split(',').filter(Boolean)
: [];
}
this.getCategoryList();
}
};