xinelu-applet-ui/pagesB/exchangerecords/exchangerecords.vue

164 lines
3.1 KiB
Vue
Raw Normal View History

2023-09-22 15:29:53 +08:00
<template>
<view class="app">
2023-10-16 11:21:27 +08:00
<view class="" v-if="list&&list.length>0">
<view class="content" v-for="item in list">
<view class="time">
{{item.exchangeDate?item.exchangeDate:''}}
<span>
{{item.score?item.score:0}} 积分
</span>
</view>
2024-03-05 09:57:45 +08:00
<u-image width="180rpx" height="180rpx" :src="item.src"></u-image>
2023-10-16 11:21:27 +08:00
<view class="servename">
{{item.prizeName?item.prizeName:''}}
</view>
<view class="servetime" v-if='item.useDate'>
服务时间{{item.useDate}}
</view>
2023-09-26 17:59:59 +08:00
</view>
</view>
2023-10-16 11:21:27 +08:00
<u-empty v-else mode="list" icon-size='220' text='暂无兑换记录'></u-empty>
2023-09-22 15:29:53 +08:00
</view>
</template>
<script>
2023-10-16 11:21:27 +08:00
import {
prizeExchangelist
} from '@/api/pagesB/exchangerecords/index.js'
2024-03-05 09:57:45 +08:00
import {
getImgById
} from '@/api/pagesB/getimg/index.js'
2023-09-22 15:29:53 +08:00
export default {
data() {
return {
2023-10-16 11:21:27 +08:00
query: {
identity: uni.getStorageSync('userinfo').cardNo,
pageNum: 1,
pageSize: 10,
},
list: [],
total: 0,
2023-09-22 15:29:53 +08:00
};
2023-10-16 11:21:27 +08:00
},
onLoad() {
this.info()
},
methods: {
2024-03-05 09:57:45 +08:00
async getimg(id) {
try {
const res = await getImgById(id);
return res.data
} catch (error) {
return null;
}
},
2023-10-16 11:21:27 +08:00
info() {
prizeExchangelist(this.query).then(res => {
2024-03-05 09:57:45 +08:00
res.rows.forEach(e => {
e.src = ''
})
this.list = [
...this.list,
...res.rows
]
this.list.forEach(async (e) => {
if (e.src == '') {
e.src = await this.getimg(e.prizeId);
}
});
2023-10-16 11:21:27 +08:00
this.total = res.total
})
},
},
onReachBottom() { //下滑加载
if (this.list.length >= this.total) {} else {
this.query.pageNum++
2024-03-05 09:57:45 +08:00
this.info();
2023-10-16 11:21:27 +08:00
}
},
onPullDownRefresh() { //下拉刷新
this.query.pageNum = 1;
this.info();
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
2023-09-22 15:29:53 +08:00
}
</script>
<style lang="scss">
2023-09-26 17:59:59 +08:00
.app {
width: 100%;
text-align: justify;
padding: 25rpx 0 30rpx 0;
2024-03-05 09:57:45 +08:00
::v-deep .u-empty {
2023-10-16 11:21:27 +08:00
margin-top: 25vh !important;
}
2024-03-05 09:57:45 +08:00
2023-09-26 17:59:59 +08:00
.content {
width: 90%;
height: 321rpx;
background: #FFFFFF;
box-shadow: 0rpx 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
border-radius: 5rpx;
margin: 20rpx auto;
position: relative;
.servetime {
2023-10-16 11:21:27 +08:00
font-size: 26rpx;
2023-09-26 17:59:59 +08:00
font-weight: 400;
color: #959595;
line-height: 38rpx;
position: absolute;
2023-09-27 13:50:42 +08:00
bottom: 23%;
2023-09-26 17:59:59 +08:00
left: 35%;
2023-10-16 11:21:27 +08:00
text-align: justify;
2023-09-26 17:59:59 +08:00
}
.servename {
font-size: 32rpx;
font-weight: 500;
color: #333333;
line-height: 38rpx;
position: absolute;
top: 38%;
left: 35%;
2023-09-27 13:50:42 +08:00
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
2023-09-26 17:59:59 +08:00
}
2023-09-22 15:29:53 +08:00
2024-03-05 09:57:45 +08:00
::v-deep .u-image {
2023-09-26 17:59:59 +08:00
position: absolute;
left: 3%;
top: 28%;
2023-10-16 11:21:27 +08:00
width: 180rpx;
height: 180rpx;
2023-09-26 17:59:59 +08:00
}
.time {
2023-10-16 11:21:27 +08:00
text-align: justify;
2023-09-26 17:59:59 +08:00
padding: 25rpx 0 0 20rpx;
font-size: 28rpx;
font-weight: 400;
color: #000000;
line-height: 38rpx;
position: relative;
span {
2023-09-27 13:50:42 +08:00
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
2023-09-26 17:59:59 +08:00
font-size: 28rpx;
position: absolute;
font-weight: 500;
color: #26A888;
line-height: 38rpx;
right: 3%;
}
}
}
}
2024-03-05 09:57:45 +08:00
</style>