From 039ac1b520d998f42f0bb1aeae3f655ab00883a5 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: Sun, 22 Feb 2026 15:55:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AE=B2=E4=BB=B7=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=9A=E6=A0=B9=E6=8D=AE=E4=BB=B7=E6=A0=BC=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E5=8A=A8=E6=80=81=E8=B0=83=E6=95=B4=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8D=95=E4=BD=8D=E5=92=8C=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E9=98=88=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goods-detail/goods-detail.js | 39 +++++++++++++++++++++------- pages/goods-detail/goods-detail.wxml | 19 ++++++++++++++ 2 files changed, 48 insertions(+), 10 deletions(-) diff --git a/pages/goods-detail/goods-detail.js b/pages/goods-detail/goods-detail.js index 3f8d330..583fbad 100644 --- a/pages/goods-detail/goods-detail.js +++ b/pages/goods-detail/goods-detail.js @@ -770,23 +770,28 @@ Page({ } } - const minPrice = middlePrice - 5; - const maxPrice = middlePrice + 5; + const priceRange = middlePrice < 20 ? 1 : 5; + const minPrice = middlePrice - priceRange; + const maxPrice = middlePrice + priceRange; const defaultPrice = parseFloat(middlePrice.toFixed(2)); + const priceThreshold = middlePrice < 20 ? 0.1 : 2; console.log('计算后的价格数据:', { middlePrice: middlePrice, minPrice: minPrice, maxPrice: maxPrice, - defaultPrice: defaultPrice + defaultPrice: defaultPrice, + priceThreshold: priceThreshold }); this.setData({ showBargainModal: true, bargainPrice: defaultPrice, + basePrice: middlePrice, // 设置基础价格 selectedSpecIndex: 0, // 默认选中第一条规格 minPrice: minPrice, maxPrice: maxPrice, + priceThreshold: priceThreshold, // 设置价格判断阈值 sliderProgress: 50 // 默认滑块位置 }, () => { console.log('setData 完成后的 bargainPrice:', this.data.bargainPrice); @@ -827,16 +832,19 @@ Page({ } } - const minPrice = middlePrice - 5; - const maxPrice = middlePrice + 5; + const priceRange = middlePrice < 20 ? 1 : 5; + const minPrice = middlePrice - priceRange; + const maxPrice = middlePrice + priceRange; const currentPrice = parseFloat(middlePrice.toFixed(2)); + const priceThreshold = middlePrice < 20 ? 0.3 : 2; console.log('选择规格 - 价格数据:', { index: index, middlePrice: middlePrice, minPrice: minPrice, maxPrice: maxPrice, - currentPrice: currentPrice + currentPrice: currentPrice, + priceThreshold: priceThreshold }); this.setData({ @@ -844,6 +852,8 @@ Page({ minPrice: minPrice, maxPrice: maxPrice, bargainPrice: currentPrice, + basePrice: middlePrice, // 更新基础价格 + priceThreshold: priceThreshold, // 更新价格判断阈值 sliderProgress: 50 }); }, @@ -871,7 +881,8 @@ Page({ }); if (bargainPrice > minPrice) { - const newPrice = parseFloat((bargainPrice - 1).toFixed(2)); + const step = bargainPrice < 20 ? 0.1 : 1; + const newPrice = parseFloat((bargainPrice - step).toFixed(2)); console.log('计算新价格:', newPrice); this.updatePrice(newPrice); } @@ -887,7 +898,8 @@ Page({ }); if (bargainPrice < maxPrice) { - const newPrice = parseFloat((bargainPrice + 1).toFixed(2)); + const step = bargainPrice < 20 ? 0.1 : 1; + const newPrice = parseFloat((bargainPrice + step).toFixed(2)); console.log('计算新价格:', newPrice); this.updatePrice(newPrice); } @@ -980,7 +992,7 @@ Page({ // 滑块移动 onSliderMove(e) { try { - const { minPrice, maxPrice } = this.data; + const { minPrice, maxPrice, bargainPrice } = this.data; if (!minPrice || !maxPrice) return; const touch = e.touches[0]; @@ -996,7 +1008,14 @@ Page({ progress = Math.max(0, Math.min(100, progress)); const priceRange = maxPrice - minPrice; - const price = Math.round(minPrice + (progress / 100) * priceRange); + let price = minPrice + (progress / 100) * priceRange; + + if (bargainPrice < 20) { + price = Math.round(price * 10) / 10; + } else { + price = Math.round(price); + } + const clampedPrice = Math.max(minPrice, Math.min(maxPrice, price)); this.setData({ diff --git a/pages/goods-detail/goods-detail.wxml b/pages/goods-detail/goods-detail.wxml index d8f60de..7073600 100644 --- a/pages/goods-detail/goods-detail.wxml +++ b/pages/goods-detail/goods-detail.wxml @@ -496,6 +496,25 @@ ¥{{maxPrice}} + + + + 🎊 + 当前出价高于商家报价,可立即成交 + + + + + 😅 + 基于商品的市场价值,成交率低 + + + + + 🤲 + 该价格区间合理,预估24h内可成交 + +