From 7e24001a5259c5700503c8a41809c41e3647c95a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?=
<15778543+xufeiyang6017@user.noreply.gitee.com>
Date: Tue, 6 Jan 2026 11:38:44 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=96=B0=E9=B2=9C?=
=?UTF-8?q?=E7=A8=8B=E5=BA=A6=E5=92=8C=E9=87=87=E8=B4=AD=E4=BB=B7=E6=A0=BC?=
=?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/goods-update/goods-update.js | 4 +++-
pages/goods-update/goods-update.wxml | 12 ++++++++----
pages/goods/index.wxml | 2 +-
server-example/server-mysql.js | 3 ++-
4 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/pages/goods-update/goods-update.js b/pages/goods-update/goods-update.js
index 9d6ca0d..69338a6 100644
--- a/pages/goods-update/goods-update.js
+++ b/pages/goods-update/goods-update.js
@@ -519,7 +519,9 @@ Page({
// 确保地区信息正确显示,放在最后覆盖所有来源的值
region: finalRegion,
// 确保reservedCount字段使用我们计算得到的值,放在最后以覆盖其他来源的值
- reservedCount: finalReservationCount
+ reservedCount: finalReservationCount,
+ // 添加新鲜程度字段
+ freshness: product.freshness || ''
};
console.log('最终formattedGoods.region:', formattedGoods.region);
diff --git a/pages/goods-update/goods-update.wxml b/pages/goods-update/goods-update.wxml
index 65a3213..6f86dec 100644
--- a/pages/goods-update/goods-update.wxml
+++ b/pages/goods-update/goods-update.wxml
@@ -66,8 +66,12 @@
- 价格:
- {{goodsDetail.price}}
+ 销售价格:
+ {{goodsDetail.price || '暂无'}}
+
+
+ 采购价格:
+ {{goodsDetail.costprice || '暂无'}}
@@ -86,10 +90,10 @@
- 关注人数
+ 新鲜程度
- {{goodsDetail.reservedCount || '0'}}
+ {{goodsDetail.freshness || '暂无'}}
diff --git a/pages/goods/index.wxml b/pages/goods/index.wxml
index 0b649b1..e45bb78 100644
--- a/pages/goods/index.wxml
+++ b/pages/goods/index.wxml
@@ -100,7 +100,7 @@
{{item.specification || item.spec || '无'}} | {{item.yolk}}
- {{item.costprice ? '¥' + item.costprice : '无采购价'}}
+ {{item.price ? '¥' + item.price : '无销售价格'}}
{{item.region || ''}}
{{item.description || ''}}
diff --git a/server-example/server-mysql.js b/server-example/server-mysql.js
index bf415c8..3816dc4 100644
--- a/server-example/server-mysql.js
+++ b/server-example/server-mysql.js
@@ -3866,7 +3866,7 @@ app.post('/api/products/detail', async (req, res) => {
// 查询商品详情 - 排除hidden状态商品,直接使用Product表中的reservedCount字段
const product = await Product.findOne({
- attributes: ['productId', 'productName', 'price', 'quantity', 'grossWeight', 'imageUrls', 'created_at', 'specification', 'yolk', 'sourceType', 'supplyStatus', 'producting', 'product_contact', 'contact_phone', 'region'],
+ attributes: ['productId', 'productName', 'price', 'quantity', 'grossWeight', 'imageUrls', 'created_at', 'specification', 'yolk', 'sourceType', 'supplyStatus', 'producting', 'product_contact', 'contact_phone', 'region', 'freshness', 'costprice','description'],
where: {
productId,
status: { [Sequelize.Op.not]: 'hidden' }
@@ -3944,6 +3944,7 @@ app.post('/api/products/detail', async (req, res) => {
console.log('商品详情 - 最终返回的毛重值:', updatedProduct.grossWeight, '类型:', typeof updatedProduct.grossWeight);
console.log('商品详情 - 返回的收藏人数:', updatedProduct.reservedCount, '类型:', typeof updatedProduct.reservedCount);
console.log('商品详情 - producting字段:', updatedProduct.producting, '类型:', typeof updatedProduct.producting);
+ console.log('商品详情 - description字段:', updatedProduct.description, '类型:', typeof updatedProduct.description);
res.json({
success: true,