123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <template>
- <view class="page">
- <view class="content">
- <mescroll-body ref="mescrollRef" @init="mescrollInit" :up="upOption" :down="downOption" @down="downCallback" @up="upCallback">
- <view class="item" v-for="(item) in dataList">
- <view class="left">
- <text class="title" >
- {{$getDictLabelName(typeOptions,item.logType)}}
- </text>
- <view class="time">{{item.createTime}}</view>
- </view>
- <view class="right">
- <text :class="item.integral>0?'money green':'money red'">{{item.integral}}</text>
- <text class="remark">剩余积分:{{item.balance}}</text>
- </view>
- </view>
- </mescroll-body>
- </view>
- </view>
- </template>
- <script>
- import {getDictByKey} from '@/api/common.js'
- import {getUserIntegralLogsList} from '@/api/integral.js'
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- export default {
- mixins: [MescrollMixin], // 使用mixin
- data() {
- return {
- typeOptions:[],
- mescroll:null,
- downOption: {
- auto:false//不要自动加载
- },
- upOption: {
- onScroll:false,
- use: true, // 是否启用上拉加载; 默认true
- page: {
- num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
- size: 10 // 每页数据的数量,默认10
- },
- noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
- textNoMore:"已经到底了",
- empty: {
- icon:'https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
- tip: '暂无数据'
- }
- },
- dataList: []
-
- }
- },
- onLoad() {
- this.getDictByKey("sys_integral_log_type");
- },
- methods: {
- getDictByKey(key){
- var data={key:key}
- getDictByKey(data).then(
- res => {
- if(res.code==200){
- this.typeOptions=res.data;
- }
- },
- err => {
- }
- );
-
- },
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
- /*下拉刷新的回调 */
- downCallback(mescroll) {
- mescroll.resetUpScroll()
- },
- upCallback(page) {
- //联网加载数据
- var that = this;
- var data = {
- pageNum: page.num,
- pageSize: page.size
- };
- // uni.showLoading({
- // title:"加载中..."
- // })
- getUserIntegralLogsList(data).then(res => {
- uni.hideLoading()
- if(res.code==200){
- //设置列表数据
- if (page.num == 1) {
- that.dataList = res.data.list;
-
- } else {
- that.dataList = that.dataList.concat(res.data.list);
-
- }
- that.mescroll.endBySize(res.data.list.length, res.data.total);
-
- }else{
- uni.showToast({
- icon:'none',
- title: "请求失败",
- });
- that.dataList = null;
- that.mescroll.endErr();
- }
- });
- },
-
- }
- }
- </script>
- <style lang="scss" scoped>
- .page{
- }
- .content{
- display: flex;
- flex-direction: column;
- .item{
- background-color: #fff;
- padding: 20rpx 10rpx;
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- border-top: 1rpx solid #efefef;
- .left{
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: flex-start;
- .title{
- font-size: 26rpx;
- color: #111;
- }
- .time{
- margin-top: 20rpx;
- font-size: 24rpx;
- color: #a5a5a5;
- }
- }
- .right{
- display: flex;
- flex-direction: column;
- align-items: flex-end;
- justify-content: flex-end;
- .money{
- font-size: 28rpx;
- font-weight: bold;
- color: #111;
- }
- .green{
- color: green;
- }
- .red{
- color:#ff0000;
- }
- .remark{
- margin-top: 20rpx;
- font-size: 24rpx;
- color: #a5a5a5;
- .green{
- color: green;
- }
- .red{
- color: red;
- }
- }
- }
- }
-
- }
-
- </style>
|