fix: 修正积分显示逻辑,将 points_required 字段显示为整数并更新默认值。

This commit is contained in:
邹方成 2026-01-06 02:13:22 +08:00
parent c75946676a
commit b9246bc728
2 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@
<view class="title">{{ detail.title || detail.name || '-' }}</view>
<view class="price-row">
<view class="points-wrap">
<text class="points-val">{{ (detail.points_required ? (detail.points_required / 100).toFixed(1) : '0.0') || (detail.price ? (detail.price / 100).toFixed(1) : '0.0') }}</text>
<text class="points-val">{{ (detail.points_required ? (detail.points_required).toFixed(0) : '0') || (detail.price ? (detail.price / 100).toFixed(1) : '0.0') }}</text>
<text class="points-unit">积分</text>
</view>
</view>
@ -115,7 +115,7 @@ async function onRedeem() {
return
}
const points = (detail.value.points_required ? (detail.value.points_required / 100).toFixed(1) : '0.0') || (detail.value.price ? (detail.value.price / 100).toFixed(1) : '0.0')
const points = (detail.value.points_required ? (detail.value.points_required).toFixed(0) : '0') || (detail.value.price ? (detail.value.price / 100).toFixed(1) : '0.0')
uni.showModal({
title: '确认兑换',
content: `是否消耗 ${points} 积分兑换 ${p.title || p.name}`,

View File

@ -252,7 +252,7 @@ function normalizeItems(list, kind) {
image: cleanUrl(i.main_image || i.image || ''),
title: i.name || i.title || '',
price: i.price || i.discount_value || 0,
points: i.points_required ? (i.points_required / 100).toFixed(1) : (i.price ? (i.price / 100).toFixed(1) : (i.discount_value ? (i.discount_value / 100).toFixed(1) : '0.0')),
points: i.points_required ? (i.points_required).toFixed(0) : (i.price ? (i.price / 100).toFixed(1) : (i.discount_value ? (i.discount_value / 100).toFixed(1) : '0')),
stock: i.in_stock ? 99 : 0, // Simplified stock check if returned as bool
discount_value: i.discount_value || 0,
min_spend: i.min_spend || 0,