积分兑换

This commit is contained in:
liuye
2023-04-13 16:26:56 +08:00
parent fe9ff22748
commit 94d54f85fd
6 changed files with 270 additions and 124 deletions

View File

@@ -4,7 +4,7 @@
<div class="header">
<div class="num">
<p>积分余额</p>
<h3>562</h3>
<h3>{{total}}</h3>
</div>
<div class="btn" @click="toMyOrder">我的订单</div>
</div>
@@ -23,8 +23,8 @@
</div>
</div>
</div>
<div class="list-content">
<u-waterfall v-model="flowList">
<div class="list-content" v-if="goodsList.length">
<u-waterfall v-model="goodsList">
<template v-slot:left="{leftList}">
<div v-for="(item, index) in leftList" :key="index" @click="toProductDetail(item)">
<div class="item">
@@ -33,33 +33,37 @@
<div class="content">
<p class="text">{{item.title}}</p>
<div class="item-money">
<h3>50积分</h3>
<p>+2.00</p>
<span>兑换后再付</span>
<h3>{{item.integralPrice}}积分</h3>
<p v-if="item.type == 1">+{{item.payMoney}}</p>
<span v-if="item.type == 1">兑换后再付</span>
</div>
<div class="btn btn0">去兑换</div>
<div class="btn" :class="total >= item.integralPrice ? 'btn1' : 'btn0'" @click.stop="toOrder(item)" v-if="item.status == 1 && item.stock > 0">{{total >= item.integralPrice ? '去兑换' : '积分不足'}}</div>
<div class="btn btn0" :class="`btn`+item.status" v-else>商品缺货</div>
</div>
</div>
</div>
</template>
<template v-slot:right="{rightList}">
<div v-for="(item, index) in rightList" :key="index">
<div v-for="(item, index) in rightList" :key="index" @click="toProductDetail(item)">
<div class="item">
<img src="https://cdn.cunwuyun.cn/dvcp/h5/watermark/8.png" alt="">
<div class="type type0">京东低价商品</div>
<img :src="item.picUrl" alt="">
<div class="type" :class="`type`+item.type">{{ $dict.getLabel('integralSGType', item.type) }}</div>
<div class="content">
<p class="text">无染(wuro)本色抽纸无染(wuro)本色抽纸无无染(wuro)本色抽纸无染(wuro)本色抽</p>
<p class="text">{{item.title}}</p>
<div class="item-money">
<h3>50积分</h3>
<h3>{{item.integralPrice}}积分</h3>
<p v-if="item.type == 1">+{{item.payMoney}}</p>
<span v-if="item.type == 1">兑换后再付</span>
</div>
<div class="btn btn0">去兑换</div>
<div class="btn" :class="total >= item.integralPrice ? 'btn1' : 'btn0'" @click.stop="toOrder(item)" v-if="item.status == 1 && item.stock > 0">{{total >= item.integralPrice ? '去兑换' : '积分不足'}}</div>
<div class="btn btn0" :class="`btn`+item.status" v-else>商品缺货</div>
</div>
</div>
</div>
</template>
</u-waterfall>
</div>
<!-- <AiEmpty v-else></AiEmpty> -->
<AiEmpty v-else></AiEmpty>
</div>
</template>
@@ -86,25 +90,45 @@ export default {
currentPoint: 0,
leftList: [],
rightList: [],
flowList: [],
goodsList: [],
total: 0
}
},
computed: {
...mapState(['user']),
},
onLoad() {
this.getToatl()
this.$dict.load(['integralSGType']).then(() => {
this.getList()
})
},
methods: {
getToatl() {
this.$instance.post(`/app/appintegraluser/integralUserInfoFD`).then(res => {
if (res?.data) {
this.total = res.data.integral || 0
}
})
},
getListInit() {
this.goodsList = []
this.leftList = []
this.rightList = []
this.current = 1
},
getList() {
this.$instance.post(`/app/appintegralsupermarketshop/goodsListXCX`).then(res => {
this.$instance.post(`/app/appintegralsupermarketshop/goodsListXCX`, null, {
params: {
goodsType: this.currentTabs, //商品类型0全部、1免费兑、2京东低价商品默认0
orderType: this.currentType == 0 ? 1 : 0, //排序类型0积分升序、1上架时间倒序默认0
filterIntegral: this.currentType == 2 ? true : false, //过滤我可兑换的默认false
integralRange: this.currentType == 1 ? this.currentPoint : '', //积分区间类型0全部、150分以下、2:100分以下、3200分以下、45000分以下默认0
current: this.current
}
}).then(res => {
if (res.code === 0) {
this.flowList = res.data.records
this.goodsList = this.current == 1 ? res.data.records : [...this.goodsList, ...res.data.records]
if(res.data && res.data.records.length) {
res.data.records.map((item, index) => {
if(index%2 == 0) {
@@ -119,26 +143,31 @@ export default {
},
changeTab(index) {
this.currentTabs = index
// this.getListInit()
this.getListInit()
},
typeClick(index) {
this.currentType = index
// this.getListInit()
this.getListInit()
},
pointClick(index) {
this.currentPoint = index
// this.getListInit()
this.getListInit()
},
toProductDetail(item) {
uni.navigateTo({url: `./productDetails?id=${item.id}`})
uni.navigateTo({url: `./productDetails?shopGoodsId=${item.shopGoodsId}&total=${this.total}`})
},
toMyOrder() {
uni.navigateTo({url: './myOrderList'})
}
},
toOrder(item) {
if(this.total >= item.integralPrice && item.stock > 0) {
uni.navigateTo({url: `./placeOrder?shopGoodsId=${item.shopGoodsId}&total=${this.total}&backLevel=2`})
}
},
},
onReachBottom() {
// this.current = this.current + 1
// this.getList()
this.current = this.current + 1
this.getList()
},
}
</script>
@@ -228,6 +257,8 @@ export default {
img {
width: 100%;
height: 340px;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
}
.type {
padding: 8px 16px;
@@ -301,11 +332,11 @@ export default {
bottom: 24px;
right: 16px;
}
.btn0 {
.btn1 {
background-color: #2D7DFF;
color: #FFF;
}
.btn1 {
.btn0 {
background-color: #E2E2E2;
color: #666;
}