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内可成交
+
+