修改积分商城模块登录的逻辑
This commit is contained in:
parent
6edc620509
commit
5e5043b878
@ -43,7 +43,8 @@
|
|||||||
<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">
|
||||||
积分不足,还差{{ selectedGoodsInfo.points - userPoints }}积分哦
|
<text v-if="!uni.getStorageSync('ctoken')" >暂未登录,请先登录</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>
|
||||||
<!-- <button class="exchange-btn" @click="showSpecPopup = true">立即兑换</button> -->
|
<!-- <button class="exchange-btn" @click="showSpecPopup = true">立即兑换</button> -->
|
||||||
@ -171,6 +172,9 @@ export default {
|
|||||||
},
|
},
|
||||||
// 获取用户积分
|
// 获取用户积分
|
||||||
getPointNum() {
|
getPointNum() {
|
||||||
|
if (!uni.getStorageSync("ctoken")) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
request(apiArr2.getUserInfo, 'POST', {}, { silent: false }).then(res => {
|
request(apiArr2.getUserInfo, 'POST', {}, { silent: false }).then(res => {
|
||||||
this.userPoints = res.points;
|
this.userPoints = res.points;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -90,6 +90,9 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getNum() {
|
getNum() {
|
||||||
|
if (!uni.getStorageSync("ctoken")) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
request(apiArr2.getUserInfo, 'POST', {}, { silent: false }).then(res => {
|
request(apiArr2.getUserInfo, 'POST', {}, { silent: false }).then(res => {
|
||||||
this.pointsNum = res.points;
|
this.pointsNum = res.points;
|
||||||
});
|
});
|
||||||
@ -101,7 +104,7 @@ export default {
|
|||||||
},
|
},
|
||||||
getList() {
|
getList() {
|
||||||
if (this.loading || this.noMore) return;
|
if (this.loading || this.noMore) return;
|
||||||
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
const params = {
|
const params = {
|
||||||
category_id: this.activeCategory,
|
category_id: this.activeCategory,
|
||||||
@ -110,21 +113,21 @@ export default {
|
|||||||
}
|
}
|
||||||
request(apiArr.pointShopPage, 'POST', params, { silent: false }, false).then(res => {
|
request(apiArr.pointShopPage, 'POST', params, { silent: false }, false).then(res => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
|
||||||
const newProducts = res.row.map(item => {
|
const newProducts = res.row.map(item => {
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
commodity_pic: picUrl + item.commodity_pic,
|
commodity_pic: picUrl + item.commodity_pic,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 如果是第一页,直接替换数据,否则追加
|
// 如果是第一页,直接替换数据,否则追加
|
||||||
if (this.page_num === 1) {
|
if (this.page_num === 1) {
|
||||||
this.products = newProducts;
|
this.products = newProducts;
|
||||||
} else {
|
} else {
|
||||||
this.products = [...this.products, ...newProducts];
|
this.products = [...this.products, ...newProducts];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断是否还有更多数据
|
// 判断是否还有更多数据
|
||||||
if (newProducts.length < this.page_size) {
|
if (newProducts.length < this.page_size) {
|
||||||
this.noMore = true;
|
this.noMore = true;
|
||||||
@ -153,7 +156,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
toDetail(product) {
|
toDetail(product) {
|
||||||
NavgateTo('/packages/jfShop/detail/index?product=' + JSON.stringify(product) + '&pointNum=' + this.pointsNum);
|
NavgateTo('/packages/jfShop/detail/index?product=' + JSON.stringify(product) + '&pointNum=' + this.pointsNum, { isLogin: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user