|
|
@@ -125,7 +125,8 @@ export default function GoodsDetailPage() {
|
|
|
staleTime: 5 * 60 * 1000,
|
|
|
})
|
|
|
|
|
|
- const hasSpecOptions = childGoodsData && childGoodsData.data && childGoodsData.data.length > 0
|
|
|
+ const hasSpecOptions = Boolean(childGoodsData && childGoodsData.data && childGoodsData.data.length > 0)
|
|
|
+
|
|
|
|
|
|
// 商品轮播图
|
|
|
const carouselItems = goods?.slideImages?.map((file: any) => ({
|
|
|
@@ -143,7 +144,6 @@ export default function GoodsDetailPage() {
|
|
|
|
|
|
// 如果显示价格与API价格不一致,记录警告
|
|
|
if (displayedPrice !== apiPrice) {
|
|
|
- console.warn('价格显示不一致:', { displayedPrice, apiPrice, goodsId: goods.id })
|
|
|
// 在实际项目中可以发送错误报告或显示用户提示
|
|
|
}
|
|
|
}
|
|
|
@@ -249,8 +249,8 @@ export default function GoodsDetailPage() {
|
|
|
|
|
|
// 处理输入框失去焦点(完成输入)
|
|
|
const handleQuantityBlur = () => {
|
|
|
- // 如果数量为0(表示空输入),设为1
|
|
|
- if (quantity === 0) {
|
|
|
+ // 如果数量小于1(表示空输入或负数),设为1
|
|
|
+ if (quantity < 1) {
|
|
|
setQuantity(1)
|
|
|
}
|
|
|
}
|
|
|
@@ -342,8 +342,6 @@ export default function GoodsDetailPage() {
|
|
|
totalAmount: targetPrice * finalQuantity
|
|
|
})
|
|
|
|
|
|
- // const buyNowData = Taro.getStorageSync('buyNow')
|
|
|
- // console.log("buyNowbefore:",buyNowData)
|
|
|
|
|
|
Taro.navigateTo({
|
|
|
url: '/pages/order-submit/index'
|
|
|
@@ -498,6 +496,7 @@ export default function GoodsDetailPage() {
|
|
|
</View>
|
|
|
</View>
|
|
|
|
|
|
+
|
|
|
<View className="button-section">
|
|
|
<Button
|
|
|
className="add-cart-btn"
|