From f3642907e6e9660f98e914469d731f21990de40b Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Fri, 27 Jun 2025 14:49:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20pc/mobile=20=E4=BA=A7=E5=93=81=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/controller/Product.php | 2 ++ app/index/view/mobile/product/detail.html | 34 +++++++++++------------ app/index/view/pc/product/detail.html | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/index/controller/Product.php b/app/index/controller/Product.php index a8291e2e..a7843d3d 100644 --- a/app/index/controller/Product.php +++ b/app/index/controller/Product.php @@ -373,6 +373,8 @@ class Product extends Common // 获取属性名称 $attrs = ProductAttrModel::bypks(array_unique(Arr::pluck($sku_attrs, 'attr_id')))->column(['attr_name'], 'id'); foreach ($sku_attrs as $v) { + if (empty($v['attr_value'])) continue; + $v['attr_name'] = $attrs[$v['attr_id']]?? ''; // 按属性分组 $product_sku_attrs[$v['attr_id']]['attr_id'] = $v['attr_id']; diff --git a/app/index/view/mobile/product/detail.html b/app/index/view/mobile/product/detail.html index a23cad5f..e74277f2 100644 --- a/app/index/view/mobile/product/detail.html +++ b/app/index/view/mobile/product/detail.html @@ -44,9 +44,9 @@ {/volist} {/notempty} - +
- + {notempty name="product_sku_attrs"}
@@ -56,22 +56,20 @@ {notempty name="ps.attr_values"}
    {volist name="ps.attr_values" id="pv" key="pk"} - {notempty name="pv.attr_value"} - {assign name="attr_value_type" value=":rgb_or_image($pv.attr_value)" /} - {between name="ps.attr_id" value="1,2"} -
  • - {else/} -
  • - {/between} - {eq name="attr_value_type" value="IMAGE"} - - {elseif condition="$attr_value_type == 'RGB'" /} - $pv.attr_value])}> - {else/} - {$pv.attr_value} - {/eq} -
  • - {/notempty} + {assign name="attr_value_type" value=":rgb_or_image($pv.attr_value)" /} + {between name="ps.attr_id" value="1,2"} +
  • + {else/} +
  • + {/between} + {eq name="attr_value_type" value="IMAGE"} + + {elseif condition="$attr_value_type == 'RGB'" /} + $pv.attr_value])}> + {else/} + {$pv.attr_value} + {/eq} +
  • {/volist}
{/notempty} diff --git a/app/index/view/pc/product/detail.html b/app/index/view/pc/product/detail.html index aba4524e..17f59b1e 100644 --- a/app/index/view/pc/product/detail.html +++ b/app/index/view/pc/product/detail.html @@ -82,7 +82,7 @@ {/volist}
- + {volist name="product_sku_attrs" id="ps"}
{$ps.attr_name}