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

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>
</view>
<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>
</view>
<button v-else class="exchange-btn" @click="showSpecPopup = true">立即兑换</button>
@ -112,7 +112,8 @@ export default {
selectedSpecId: 1,
selectedSpec: '',
quantity: 1,
selectedGoodsInfo: {}
selectedGoodsInfo: {},
isLoggedIn: false
};
},
computed: {
@ -182,9 +183,13 @@ export default {
},
onshow() {
this.getPointNum();
//
this.isLoggedIn = !!uni.getStorageSync("ctoken");
},
onLoad(options) {
this.getPointNum();
//
this.isLoggedIn = !!uni.getStorageSync("ctoken");
const orderInfo = JSON.parse(options.product);
const params = {
id: orderInfo.id