Compare commits
4 Commits
6edc620509
...
51874e8dab
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51874e8dab | ||
|
|
ec7f284035 | ||
|
|
7b46c3637a | ||
|
|
5e5043b878 |
@ -43,7 +43,8 @@
|
||||
<text class="points-label">当前积分{{ userPoints }}</text>
|
||||
</view>
|
||||
<view v-if="userPoints < selectedGoodsInfo.points" class="insufficient-points">
|
||||
积分不足,还差{{ selectedGoodsInfo.points - userPoints }}积分哦
|
||||
<text v-if="!isLoggedIn" >暂未登录,请先登录</text>
|
||||
<text v-else>积分不足,还差{{ selectedGoodsInfo.points - userPoints }}积分哦</text>
|
||||
</view>
|
||||
<button v-else class="exchange-btn" @click="showSpecPopup = true">立即兑换</button>
|
||||
<!-- <button class="exchange-btn" @click="showSpecPopup = true">立即兑换</button> -->
|
||||
@ -111,7 +112,8 @@ export default {
|
||||
selectedSpecId: 1,
|
||||
selectedSpec: '',
|
||||
quantity: 1,
|
||||
selectedGoodsInfo: {}
|
||||
selectedGoodsInfo: {},
|
||||
isLoggedIn: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -171,6 +173,9 @@ export default {
|
||||
},
|
||||
// 获取用户积分
|
||||
getPointNum() {
|
||||
if (!uni.getStorageSync("ctoken")) {
|
||||
return 0;
|
||||
}
|
||||
request(apiArr2.getUserInfo, 'POST', {}, { silent: false }).then(res => {
|
||||
this.userPoints = res.points;
|
||||
});
|
||||
@ -178,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
|
||||
|
||||
@ -38,9 +38,9 @@
|
||||
<scroll-view scroll-y="true" @scrolltolower="loadMore" style="height: calc(100vh - 300rpx);">
|
||||
<view class="product-list">
|
||||
<view v-for="(product, index) in products" :key="index" class="product-item">
|
||||
<image class="product-image" :src="product.commodity_pic" mode="aspectFill"></image>
|
||||
<view class="product-title">{{ product.commodity_name }}</view>
|
||||
<view class="product-info">
|
||||
<image class="product-image" :src="product.commodity_pic" mode="aspectFill" @click="toDetail(product)"></image>
|
||||
<view class="product-title" @click="toDetail(product)">{{ product.commodity_name }}</view>
|
||||
<view class="product-info" @click="toDetail(product)">
|
||||
<view class="product-points">{{ product.goods_info_list[0].points }} 积分</view>
|
||||
<view class="product-sold">已兑换{{ product.exchange_count }}件</view>
|
||||
</view>
|
||||
@ -90,6 +90,9 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getNum() {
|
||||
if (!uni.getStorageSync("ctoken")) {
|
||||
return 0;
|
||||
}
|
||||
request(apiArr2.getUserInfo, 'POST', {}, { silent: false }).then(res => {
|
||||
this.pointsNum = res.points;
|
||||
});
|
||||
@ -101,7 +104,7 @@ export default {
|
||||
},
|
||||
getList() {
|
||||
if (this.loading || this.noMore) return;
|
||||
|
||||
|
||||
this.loading = true;
|
||||
const params = {
|
||||
category_id: this.activeCategory,
|
||||
@ -110,21 +113,21 @@ export default {
|
||||
}
|
||||
request(apiArr.pointShopPage, 'POST', params, { silent: false }, false).then(res => {
|
||||
this.loading = false;
|
||||
|
||||
|
||||
const newProducts = res.row.map(item => {
|
||||
return {
|
||||
...item,
|
||||
commodity_pic: picUrl + item.commodity_pic,
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// 如果是第一页,直接替换数据,否则追加
|
||||
if (this.page_num === 1) {
|
||||
this.products = newProducts;
|
||||
} else {
|
||||
this.products = [...this.products, ...newProducts];
|
||||
}
|
||||
|
||||
|
||||
// 判断是否还有更多数据
|
||||
if (newProducts.length < this.page_size) {
|
||||
this.noMore = true;
|
||||
@ -153,7 +156,7 @@ export default {
|
||||
}
|
||||
},
|
||||
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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,6 +136,9 @@ page {
|
||||
.orderItem_row_label {
|
||||
width: 200rpx;
|
||||
}
|
||||
.orderItem_row_status{
|
||||
min-width: 90rpx;
|
||||
}
|
||||
|
||||
.orderItem_row_state {
|
||||
font-size: 28rpx;
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
<view class="orderItem_row_con">{{ item.room.name }}</view>
|
||||
</view>
|
||||
|
||||
<view :class="['orderItem_row_state', statusType[item.status].color]">
|
||||
<view class="orderItem_row_status" :class="['orderItem_row_state', statusType[item.status].color]">
|
||||
{{ statusType[item.status].desc }}
|
||||
</view>
|
||||
</view>
|
||||
@ -183,7 +183,9 @@ export default {
|
||||
const meun = menuButtonInfo();
|
||||
this.top = meun.top;
|
||||
this.localHeight = meun.height;
|
||||
this.communityId = JSON.parse(options.communityId);
|
||||
if (options.communityId) {
|
||||
this.communityId = JSON.parse(options.communityId);
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.page_num = 1;
|
||||
@ -193,7 +195,7 @@ export default {
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.flag) {
|
||||
this.init();
|
||||
this.getTabsList();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user