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,