diff --git a/buyer/src/pages/shopEntry/ShopEntry.vue b/buyer/src/pages/shopEntry/ShopEntry.vue index 92698666..778c9014 100644 --- a/buyer/src/pages/shopEntry/ShopEntry.vue +++ b/buyer/src/pages/shopEntry/ShopEntry.vue @@ -130,9 +130,9 @@ export default { Object.assign(this.thirdData, Object.fromEntries(third.map((key) => [key, data[key]]))); }, getArticle() { - // 入驻协议 + // 入驻协议:库中无 STORE_REGISTER 文章时 result 为 null,不能直接读 content agreement().then((res) => { - this.agreementCon = res.result.content; + this.agreementCon = res.result?.content || ""; }); }, getData(status) { @@ -164,21 +164,19 @@ export default { }); }, refreshApplyData() { - applyStatus().then((res) => { + return applyStatus().then((res) => { if (res.success && res.result) { this.assignApplyData(res.result); } - }); + }).catch(() => {}); }, - // 下一步 - nextPage(step) { + // 下一步:先拉最新申请数据,再切步骤,避免第三步挂载后再改 content 触发校验 + async nextPage(step) { if (typeof step !== "number") return; - this.currentIndex = step; - if (step > 0 && step < 3) { - this.refreshApplyData(); - } else if (step === 3) { - this.refreshApplyData(); + if (step > 0 && step <= 3) { + await this.refreshApplyData(); } + this.currentIndex = step; }, }, created() { diff --git a/buyer/src/pages/shopEntry/ThirdApply.vue b/buyer/src/pages/shopEntry/ThirdApply.vue index 3c40b8b8..d827d0be 100644 --- a/buyer/src/pages/shopEntry/ThirdApply.vue +++ b/buyer/src/pages/shopEntry/ThirdApply.vue @@ -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(); } }; diff --git a/seller/src/views/goods/goods-seller/addGoods.scss b/seller/src/views/goods/goods-seller/addGoods.scss index 7a937f0c..71d154b8 100644 --- a/seller/src/views/goods/goods-seller/addGoods.scss +++ b/seller/src/views/goods/goods-seller/addGoods.scss @@ -524,8 +524,9 @@ div.base-info-item { } .tree-bar { + width: 100%; height: auto !important; - max-height: auto !important; + max-height: none !important; min-height: 240px !important; } diff --git a/seller/src/views/goods/goods-seller/goodsOperationSec.vue b/seller/src/views/goods/goods-seller/goodsOperationSec.vue index 8077853f..a76178f2 100644 --- a/seller/src/views/goods/goods-seller/goodsOperationSec.vue +++ b/seller/src/views/goods/goods-seller/goodsOperationSec.vue @@ -28,7 +28,6 @@ -
{{ currentGoodsTypeDesc }}
- + @@ -466,7 +471,7 @@

商品详情描述

-
+
+ > + +
@@ -499,7 +508,7 @@

商品物流信息

- + @@ -618,12 +627,6 @@ export default { needsLogistics() { return this.baseInfoForm.goodsType === "PHYSICAL_GOODS"; }, - currentGoodsTypeDesc() { - const matched = this.goodsTypeOptions.find( - (item) => item.value === this.baseInfoForm.goodsType - ); - return matched ? matched.desc : ""; - }, }, data() { // 表单验证项,商品价格 @@ -732,7 +735,7 @@ export default { recommend: 1, /** 店铺分类 */ storeCategoryPath: "", - brandId: 0, + brandId: "", /** 计量单位 **/ goodsUnit: "", /** 商品类型 **/ @@ -1108,7 +1111,7 @@ export default { this.categoryId = ""; this.baseInfoForm.categoryPath = ""; this.baseInfoForm.categoryName = []; - this.baseInfoForm.brandId = 0; + this.baseInfoForm.brandId = ""; this.brandList = []; this.goodsParams = []; this.params_panel = []; @@ -1117,7 +1120,7 @@ export default { this.categoryId = val[2]; this.baseInfoForm.categoryPath = val.join(","); this.baseInfoForm.categoryName = this.getCategoryNames(val); - this.baseInfoForm.brandId = 0; + this.baseInfoForm.brandId = ""; this.getGoodsBrandList(); this.GET_GoodsParams(); }, @@ -1331,6 +1334,12 @@ export default { } }, + /** 无品牌时后端用 0,选择器空值用空字符串,避免 el-select 直接显示 0 */ + normalizeBrandId(id) { + if (id === 0 || id === "0" || id == null || id === "") return ""; + return id; + }, + /** 查询商品品牌列表 */ getGoodsBrandList(type) { API_GOODS.getCategoryBrandListDataSeller(this.categoryId).then( @@ -1402,6 +1411,7 @@ export default { this.invalidGoodsGalleryFiles = []; this.baseInfoForm = { ...this.baseInfoForm, ...response.result }; this.baseInfoForm.release = 1; //即使是被放入仓库,修改的时候也会显示会立即发布 + this.baseInfoForm.brandId = this.normalizeBrandId(this.baseInfoForm.brandId); this.categoryId = response.result.categoryPath.split(",")[2]; this.syncSelectedCategoryFromPath(); @@ -2368,6 +2378,7 @@ export default { return; } if (submit.templateId === "") submit.templateId = 0; + if (submit.brandId === "" || submit.brandId == null) submit.brandId = 0; if (this.isECouponGoods) { submit.templateId = 0; submit.salesModel = "RETAIL"; @@ -2521,6 +2532,29 @@ export default { white-space: nowrap; } @import "./addGoods.scss"; + +.tree-bar.is-empty { + min-height: auto !important; +} + +.tree-bar :deep(.el-tree__empty-block) { + display: flex; + align-items: center; + justify-content: flex-start; + min-height: 32px; + height: auto; + width: auto; +} + +.tree-bar :deep(.el-tree__empty-text), +.shop-category-empty { + position: static; + left: auto; + top: auto; + transform: none; + white-space: nowrap; + writing-mode: horizontal-tb; +}