video_app/me/jifen/jifen.vue

235 lines
4.6 KiB
Vue

<template>
<view>
<view class="jf flex align-center justify-between">
<view class="jf-l">
<view class="jf-l-t">
当前积分
</view>
<view class="jf-l-b">
{{num}}
</view>
</view>
<view class="jf-r" @click="goNav('/me/jifen/duihuan')">
积分兑换
</view>
</view>
<view class="listTitle flex align-center">
<u-icon name="order" color="#2e2f33" size="50"></u-icon>
<text>
积分明细
</text>
</view>
<view class="list">
<scroll-view @scrolltolower="scrolltolower" :refresher-enabled="refresherTriggered"
@scrolltoupper="scrolltoupper" scroll-y="true"
style="width: 100%;height: 100%;background-color: #ffffff;padding-bottom: 30rpx;">
<view class="list-item flex align-center justify-center" v-for="(item,index) in list" :key="index">
<view class="list-item-box flex align-center justify-between">
<view class="list-item-box-l">
<view class="list-item-box-l-t">
{{item.content}}
</view>
<view class="list-item-box-l-b">
{{item.createTime}}
</view>
</view>
<view class="list-item-box-r" v-if="item.type == 1">
+{{item.num}}
</view>
<view class="list-item-box-r" v-else>
-{{item.num}}
</view>
</view>
</view>
<view class="" style="width: 100%;height: 30rpx;" v-if="list.length>0"></view>
<u-loadmore v-if="list.length>0" :status="status" />
<empty :isShow="true" title="暂无明细" v-if="list.length == 0" />
</scroll-view>
</view>
</view>
</template>
<script>
import empty from '../../components/empty.vue'
export default {
components: {
empty
},
data() {
return {
boxStyle: {
margin: 0,
padding: '200rpx 0 0 0',
},
num: 0,
list: [],
status: 'loadmore',
page: 1,
limit: 10,
pages: 1,
refresherTriggered: true
};
},
onShow() {
this.getNum()
this.getList()
},
onPullDownRefresh() {
this.getNum()
},
methods: {
goNav(url) {
uni.navigateTo({
url: url
})
},
//上拉刷新
scrolltoupper() {
this.page = 1
this.refresherTriggered = true
this.getList()
},
//加载更多
scrolltolower() {
if (this.page < this.pages) {
this.status = 'loading'
this.page += 1
this.getList()
} else {
this.status = 'nomore'
}
},
//获取积分明细
getList() {
let data = {
page: this.page,
limit: this.limit
}
this.$Request.getT('/app/integral/details', data).then(res => {
setTimeout(() => {
this.refresherTriggered = false
}, 1500)
if (res.code == 0) {
this.pages = res.data.pages
if (this.page < this.pages) {
this.status = 'loadmore'
} else {
this.status = 'nomore'
}
if (this.page == 1) {
this.list = res.data.records
} else {
this.list = [...this.list, ...res.data.records]
}
}
})
},
//获取当前积分
getNum() {
this.$Request.getT('/app/integral/selectByUserId').then(res => {
uni.stopPullDownRefresh()
if (res.code == 0) {
this.num = res.data.integralNum
} else {
this.num = 0
}
})
},
}
}
</script>
<style lang="scss">
page {
background-color: #ffffff;
}
.jf {
width: 100%;
height: 252rpx;
background: linear-gradient(90deg, rgba(255, 117, 129, 0.6) 0%, #ff7581 100%);
padding: 0 40rpx;
.jf-l-t {
color: #ffffff;
font-size: 28rpx;
}
.jf-l-b {
font-size: 40rpx;
color: #ffffff;
font-weight: 600;
margin-top: 30rpx;
}
.jf-r {
padding: 20rpx 40rpx;
border-radius: 40rpx;
color: #ff7581;
background-color: #ffffff;
font-size: 28rpx;
font-weight: 500;
}
}
.listTitle {
width: 100%;
height: 110rpx;
margin-top: -40rpx;
background-color: #ffffff;
border-radius: 30rpx 30rpx 0 0;
border-bottom: 1px solid hsla(0, 0%, 90.2%, .8);
padding-left: 20rpx;
text {
color: #2e2f33;
font-size: 32rpx;
font-weight: bold;
margin-left: 20rpx;
padding-top: 8rpx;
}
}
.list {
width: 100%;
/* #ifdef H5 */
height: calc(100vh - 252rpx - 70rpx - 88rpx);
/* #endif */
/* #ifndef H5 */
height: calc(100vh - 252rpx - 70rpx);
/* #endif */
background-color: #ffffff;
.list-item {
width: 100%;
}
.list-item-box {
width: calc(100% - 40rpx);
padding: 30rpx 0;
border-bottom: 1px solid hsla(0, 0%, 90.2%, .8);
.list-item-box-l-t {
color: #2e2f33;
font-size: 28rpx;
}
.list-item-box-l-b {
font-size: 24rpx;
color: #aeb2c1;
margin-top: 30rpx;
}
.list-item-box-r {
color: #2e2f33;
font-weight: 600;
font-size: 36rpx;
}
}
}
</style>