From 0f9cc1087f3f950297b36020edd8dca74a78eb84 Mon Sep 17 00:00:00 2001 From: jing <1683105490@qq.com> Date: Fri, 18 Sep 2026 16:44:14 +0800 Subject: [PATCH] =?UTF-8?q?chore=EF=BC=9A=E5=95=86=E5=93=81=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E6=A8=A1=E6=9D=BF5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .local.config.js | 2 +- components-diy/diy-category-item.vue | 77 +++++++++++++++++++--------- 2 files changed, 55 insertions(+), 24 deletions(-) diff --git a/.local.config.js b/.local.config.js index d571fd9..564de8a 100644 --- a/.local.config.js +++ b/.local.config.js @@ -243,7 +243,7 @@ const localDevConfig = ({ // })['local-11']; // 选择要使用的环境配置 // })['2811']; // 本地 //})['5g-317']; // 电磁兼容 -})['5g-312']; // +})['5g-351']; // // })['local-2']; // 本地 // })['local-11']; // 本地 // })['1-test']; // test diff --git a/components-diy/diy-category-item.vue b/components-diy/diy-category-item.vue index 5115d15..76ab68e 100644 --- a/components-diy/diy-category-item.vue +++ b/components-diy/diy-category-item.vue @@ -99,8 +99,7 @@ + 模板5 不走这里: 它有专属分支 value.template == 5(后台"展示分类"决定渲染商品网格或二级分类网格) --> {{ category.category_name }} @@ -141,8 +140,51 @@ - - + + + + {{ category.category_name }} + + + + + + {{ item.label_name }} + + + + {{ isEnEnv ? item.en_goods_name : item.goods_name }} + + + + + {{ $lang('common.currencySymbol') }} + {{ parseFloat(showPrice(item)).toFixed(2).split('.')[0] }} + .{{ parseFloat(showPrice(item)).toFixed(2).split('.')[1] }} + + + + {{ $lang('common.currencySymbol') }} + {{ showMarketPrice(item) }} + + + + {{ $lang('components-diy.diy-category-item.consultNow') }} + + + + + + + 暂无商品 + + + + + {{ category.category_name }} - - - - {{ one.category_name }} - - - - - - {{ two.category_name }} - - - - + @@ -619,7 +647,7 @@ export default { * 三级分类 (value.level == 3) → true → 按二级分类分别显示各自商品 */ isGroupedDisplay() { - // 仅模板1 走"按二级分类分组显示商品"; 模板5 渲染分类网格, 见下方 categoryLevel 分支 + // 仅模板1 走"按二级分类分组显示商品"; 模板5 的层级由 value.level 直接决定(见下方 value.template == 5 分支) return this.value.template == 1 && this.value.level == 3; }, /** @@ -667,10 +695,13 @@ export default { // 模板1:根据后台"展示分类"配置 + 数据层级决定加载方式 // 三级分类模式 (isGroupedDisplay) + 有二级分类时,按二级分类分别加载各自商品 // 其他情况(二级分类模式 / 无二级分类),直接加载当前一级分类下的所有商品 - // 模板5 渲染的是"分类网格"(与 Branch_5cfee417 一致), 有子分类时是静态网格, 无需加载商品; - // 只有一级分类下没有子分类时, 才回退到商品网格, 此时才需要加载商品 + // 模板5 渲染规则: + // 二级分类(value.level == 2) → 商品网格(图2), 需要加载该一级分类下所有商品(合并其二级分类) + // 三级分类(value.level == 3) → 二级分类网格(图3), 静态网格无需加载商品 + // 若该一级分类下没有子分类(兜底), 仍需要加载商品 const template5NeedGoods = this.value.template == 5 && - !(this.category && this.category.child_list && this.category.child_list.length); + (this.value.level == 2 || + !(this.category && this.category.child_list && this.category.child_list.length)); if ((this.value.template == 1 || template5NeedGoods) && this.category && this.category.category_id) { if (this.isGroupedDisplay && this.category.child_list && this.category.child_list.length) { this.category.child_list.forEach(child => {