195 lines
4.8 KiB
Vue
195 lines
4.8 KiB
Vue
<!-- +----------------------------------------------------------------------
|
||
| 麦沃德科技赋能开发者,助力商协会发展
|
||
+----------------------------------------------------------------------
|
||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||
+----------------------------------------------------------------------
|
||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||
+----------------------------------------------------------------------
|
||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||
+----------------------------------------------------------------------
|
||
| 积分明细 开发者: 麦沃德科技-半夏
|
||
+---------------------------------------------------------------------- -->
|
||
|
||
<template>
|
||
<view class="container" v-if="loadEnd">
|
||
<!-- 标题栏 -->
|
||
<title-bar :showBack="true" title="积分明细"></title-bar>
|
||
<!-- 内容区 -->
|
||
<view class="container-main" :style="{'--theme-color': themeColor}">
|
||
<view class="main-screen" :style="{top: titleBarHeight + 'px'}">
|
||
<view class="screen-item" :class="{active: selectScreen == index}" @click="changeScreen(index)" v-for="(item, index) in screenList" :key="index">{{item.text}}</view>
|
||
</view>
|
||
<view class="main-list" v-if="dataList.length">
|
||
<view class="list-item" v-for="item in dataList" :key="item.id">
|
||
<view class="item-top flex align-items-center">
|
||
<view class="top-name flex-item text-ellipsis-more">{{item.memo}}</view>
|
||
<view class="top-amount" :style="{color: item.change == 2 ? '#5A5B6E' : themeColor}">
|
||
{{item.change == 2 ? "-" : "+"}}{{item.points}}
|
||
</view>
|
||
</view>
|
||
<view class="item-bottom">{{item.createtime}}</view>
|
||
</view>
|
||
</view>
|
||
<empty top="30%" title="暂无相关内容~" v-else></empty>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import { mapState } from "vuex"
|
||
export default {
|
||
data() {
|
||
return {
|
||
// 加载完成
|
||
loadEnd: false,
|
||
// 标题栏高度
|
||
titleBarHeight: 0,
|
||
// 分类列表
|
||
screenList: [{
|
||
text: "全部",
|
||
},
|
||
{
|
||
text: "收入",
|
||
type: 1
|
||
},
|
||
{
|
||
text: "支出",
|
||
type: 2
|
||
},
|
||
],
|
||
// 已选分类
|
||
selectScreen: 0,
|
||
// 分类查询参数
|
||
page: 1,
|
||
limit: 20,
|
||
hasMore: false,
|
||
// 明细列表
|
||
dataList: {},
|
||
}
|
||
},
|
||
computed: {
|
||
...mapState({
|
||
themeColor: state => state.app.themeColor,
|
||
})
|
||
},
|
||
mounted() {
|
||
// #ifdef MP-WEIXIN
|
||
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight
|
||
let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
|
||
this.titleBarHeight = statusBarHeight + (menuButtonInfo.top - statusBarHeight) * 2 + menuButtonInfo.height
|
||
// #endif
|
||
},
|
||
onLoad() {
|
||
uni.showLoading({
|
||
title: "加载中"
|
||
})
|
||
this.getDataList(() => {
|
||
uni.hideLoading()
|
||
this.loadEnd = true
|
||
})
|
||
},
|
||
onPullDownRefresh() {
|
||
this.page = 1
|
||
this.getDataList(() => {
|
||
uni.stopPullDownRefresh()
|
||
})
|
||
},
|
||
onReachBottom() {
|
||
if (this.hasMore) {
|
||
this.page++
|
||
this.getDataList()
|
||
}
|
||
},
|
||
methods: {
|
||
// 更改分类
|
||
changeScreen(index) {
|
||
this.selectScreen = index
|
||
this.page = 1
|
||
this.getDataList()
|
||
},
|
||
// 获取积分明细列表
|
||
getDataList(fn) {
|
||
this.$util.request("points.record", {
|
||
page: this.page,
|
||
limit: this.limit,
|
||
...this.selectScreen ? { change: this.selectScreen } : {}
|
||
}).then(res => {
|
||
if (fn) fn()
|
||
if (res.code == 1) {
|
||
let list = res.data.data
|
||
this.hasMore = this.page < res.data.total / this.limit ? true : false
|
||
this.dataList = this.page == 1 ? list : [...this.dataList, ...list];
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none'
|
||
})
|
||
}
|
||
}).catch(error => {
|
||
console.error('获取积分明细列表 ', error)
|
||
})
|
||
},
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
.container {
|
||
.container-main {
|
||
.main-screen {
|
||
position: sticky;
|
||
top: 0;
|
||
z-index: 99;
|
||
background: #FFF;
|
||
display: flex;
|
||
|
||
.screen-item {
|
||
flex: 1;
|
||
padding: 44rpx 32rpx;
|
||
color: #8D929C;
|
||
font-size: 28rpx;
|
||
line-height: 40rpx;
|
||
text-align: center;
|
||
text-align: center;
|
||
|
||
&.active {
|
||
color: var(--theme-color);
|
||
}
|
||
}
|
||
}
|
||
|
||
.main-list {
|
||
padding: 32rpx;
|
||
|
||
.list-item {
|
||
border-radius: 16rpx;
|
||
background: #FFF;
|
||
padding: 32rpx;
|
||
|
||
.item-top {
|
||
.top-name {
|
||
color: #5A5B6E;
|
||
font-size: 28rpx;
|
||
font-weight: 600;
|
||
line-height: 40rpx;
|
||
}
|
||
|
||
.top-amount {
|
||
margin-left: 48rpx;
|
||
font-size: 28rpx;
|
||
font-weight: 600;
|
||
line-height: 40rpx;
|
||
}
|
||
}
|
||
|
||
.item-bottom {
|
||
margin-top: 8rpx;
|
||
color: #979797;
|
||
font-size: 24rpx;
|
||
line-height: 34rpx;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</style> |