Browse Source

修复商品详情页产品包装字段显示

- 将商品详情页的产品包装显示字段从displayGrossWeight改为producting
- 修复字段位置,确保producting字段不被product对象覆盖
- 添加调试日志以帮助排查问题
pull/3/head
徐飞洋 2 months ago
parent
commit
fa2074e4c8
  1. 5
      pages/goods-detail/goods-detail.js
  2. 2
      pages/goods-detail/goods-detail.wxml

5
pages/goods-detail/goods-detail.js

@ -319,6 +319,8 @@ Page({
...product,
// 合并预加载数据中的字段
...(preloadedData || {}),
// 添加产品包装字段(放在product之后,确保不被覆盖)
producting: product.producting || '',
// 直接使用数据库字段名,确保与表结构完全一致,放在后面覆盖前面的值
product_contact: contactName,
contact_phone: contactPhone,
@ -329,7 +331,8 @@ Page({
console.log('最终格式化后的数据:', {
product_contact: formattedGoods.product_contact,
contact_phone: formattedGoods.contact_phone,
region: formattedGoods.region
region: formattedGoods.region,
producting: formattedGoods.producting
});
// 保存预加载数据中的isFavorite状态,确保是布尔值

2
pages/goods-detail/goods-detail.wxml

@ -93,7 +93,7 @@
<text class="info-label">产品包装</text>
</view>
<view class="info-value-container">
<text class="info-value">{{goodsDetail.displayGrossWeight || '暂无'}}</text>
<text class="info-value">{{goodsDetail.producting || '暂无'}}</text>
</view>
</view>
</view>

Loading…
Cancel
Save