mall-app-t/pages/user/point/loglist.vue

127 lines
3.0 KiB
Vue
Raw Normal View History

2024-06-03 01:09:01 +08:00
<template>
2024-06-17 18:16:46 +08:00
<pb-layout
navbar="inner"
iconColor="#fff"
class="loglist-point-wrap"
leftIcon="leftIcon"
color="#fff"
title="历史积分"
:bgStyle="bgStyle"
>
<view>
<p-empty
v-if="state.pagination.total === 0"
icon="/static/order-empty.png"
text="暂无记录"
bgColor="transparent"
/>
2024-06-03 01:09:01 +08:00
2024-06-17 18:16:46 +08:00
<view v-if="state.pagination.total > 0">
<view v-for="item in state.pagination.list" class="log-point-item ss-font-26">
<view class="top ss-flex ss-row-between ss-m-b-20">
<view class="label">积分</view>
<view class="date">{{ item.date }}</view>
</view>
<view class="bottom ss-flex ss-row-between">
<view class="last">{{ item.last }}</view>
<view class="change">{{ item.income }}</view>
</view>
</view>
</view>
2024-06-03 01:09:01 +08:00
</view>
2024-06-17 18:16:46 +08:00
<uni-load-more
v-if="state.pagination.total > 0"
:status="state.loadStatus"
:content-text="{ contentdown: '上拉加载更多' }"
/>
</pb-layout>
2024-06-03 01:09:01 +08:00
</template>
<script setup>
import { ref } from 'vue'
import { resetPagination } from '@/peach/utils'
import { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
2024-06-17 18:16:46 +08:00
import PointApi from '@/peach/api/pay/point'
2024-06-03 01:09:01 +08:00
const bgStyle = {
2024-06-17 18:16:46 +08:00
backgroundImage: '/static/point.png',
imageType: 'local',
backgroundColor: '#fff',
height: '100%',
2024-06-03 01:09:01 +08:00
}
const state = ref({
2024-06-17 18:16:46 +08:00
currentTab: 0,
pagination: {
list: [
{
last: 50000,
date: '2022-05-30',
income: '+1000',
},
{
last: 50000,
date: '2022-05-30',
income: '-1000',
},
],
total: 2,
pageNo: 1,
pageSize: 6,
},
loadStatus: '',
2024-06-03 01:09:01 +08:00
})
2024-06-17 18:16:46 +08:00
async function getLogList() {
let { data } = await PointApi.getPointList({
pageNo: state.value.pagination.pageNo,
pageSize: state.value.pagination.pageSize,
})
state.value.total = data.total
state.value.list = data.list
}
2024-06-03 01:09:01 +08:00
// 加载更多
function loadMore() {
2024-06-17 18:16:46 +08:00
if (state.value.loadStatus === 'noMore') {
return
}
state.value.pagination.pageNo++
getLogList()
2024-06-03 01:09:01 +08:00
}
// 上拉加载更多
onReachBottom(() => {
2024-06-17 18:16:46 +08:00
loadMore()
2024-06-03 01:09:01 +08:00
})
// 下拉刷新
onPullDownRefresh(() => {
2024-06-17 18:16:46 +08:00
resetPagination(state.value.pagination)
getLogList()
setTimeout(function () {
uni.stopPullDownRefresh()
}, 800)
2024-06-03 01:09:01 +08:00
})
</script>
<style lang="scss" scoped>
.loglist-point-wrap {
2024-06-17 18:16:46 +08:00
.log-point-item {
border-bottom: 1px solid rgba(231, 180, 147, 0.2);
margin: 30rpx 40rpx;
padding-bottom: 30rpx;
2024-06-03 01:09:01 +08:00
2024-06-17 18:16:46 +08:00
.top,
.bottom {
color: #e7b493;
}
2024-06-03 01:09:01 +08:00
}
2024-06-17 18:16:46 +08:00
.log-point-item:last-child {
border-bottom: none;
}
2024-06-03 01:09:01 +08:00
}
2024-06-17 18:16:46 +08:00
</style>