优化积分兑换详情页控制台报错问题

This commit is contained in:
赵毅 2025-12-29 17:17:27 +08:00
parent 7b46c3637a
commit ec7f284035

View File

@ -43,7 +43,7 @@
<text class="points-label">当前积分{{ userPoints }}</text> <text class="points-label">当前积分{{ userPoints }}</text>
</view> </view>
<view v-if="userPoints < selectedGoodsInfo.points" class="insufficient-points"> <view v-if="userPoints < selectedGoodsInfo.points" class="insufficient-points">
<text v-if="!uni.getStorageSync('ctoken')" >暂未登录,请先登录</text> <text v-if="!isLoggedIn" >暂未登录,请先登录</text>
<text v-else>积分不足还差{{ selectedGoodsInfo.points - userPoints }}积分哦</text> <text v-else>积分不足还差{{ selectedGoodsInfo.points - userPoints }}积分哦</text>
</view> </view>
<button v-else class="exchange-btn" @click="showSpecPopup = true">立即兑换</button> <button v-else class="exchange-btn" @click="showSpecPopup = true">立即兑换</button>
@ -112,7 +112,8 @@ export default {
selectedSpecId: 1, selectedSpecId: 1,
selectedSpec: '', selectedSpec: '',
quantity: 1, quantity: 1,
selectedGoodsInfo: {} selectedGoodsInfo: {},
isLoggedIn: false
}; };
}, },
computed: { computed: {
@ -182,9 +183,13 @@ export default {
}, },
onshow() { onshow() {
this.getPointNum(); this.getPointNum();
//
this.isLoggedIn = !!uni.getStorageSync("ctoken");
}, },
onLoad(options) { onLoad(options) {
this.getPointNum(); this.getPointNum();
//
this.isLoggedIn = !!uni.getStorageSync("ctoken");
const orderInfo = JSON.parse(options.product); const orderInfo = JSON.parse(options.product);
const params = { const params = {
id: orderInfo.id id: orderInfo.id