You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

222 lines
5.2 KiB

<template>
<view class="container">
<mescroll-body ref="mescrollRef" :sticky="true" @init="mescrollInit" :down="{ use: false }" :up="upOption"
@up="upCallback">
<view class="totalPoint">
<image src="../../static/pointbg.png" mode="widthFix"></image>
<view class="pointInfo">
<view>{{point}}</view>
<text>当前积分</text>
</view>
</view>
<view class="log-list">
<view class="logText">
积分记录
</view>
<view v-for="(item, index) in list.data" :key="index" class="log-item">
<view class="item-left flex-box">
<view class="rec-status">
<text>{{ item.describe }}</text>
</view>
<view class="rec-time">
<text>{{ item.create_time }}</text>
</view>
</view>
<view class="item-right" :class="[item.value > 0 ? 'add' : 'col-green']">
<text>{{ item.value > 0 ? '+' : '' }}{{ item.value }}</text>
</view>
</view>
</view>
</mescroll-body>
</view>
</template>
<script>
import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins'
import * as LogApi from '@/api/points/log'
import { getEmptyPaginateObj, getMoreListData } from '@/core/app'
import { checkLogin, filterModule } from '@/core/app'
import * as UserApi from '@/api/user'
const pageSize = 15
export default {
mixins: [MescrollMixin],
data() {
return {
// 当前用户信息
userInfo: {},
isLogin: false,
point:0,
// 充值记录
list: getEmptyPaginateObj(),
// 上拉加载配置
upOption: {
// 首次自动执行
auto: true,
// 每页数据的数量; 默认10
page: { size: pageSize },
// 数量要大于12条才显示无更多数据
noMoreSize: 12,
// 空布局
empty: {
tip: '亲,暂无相关数据'
}
}
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {},
onShow() {
this.getUserInfo()
this.upCallback(1)
// this.isLogin = checkLogin()
},
methods: {
getUserInfo() {
const app = this;
UserApi.info({}, { load: app.isFirstload }).then(result => {
console.log(result,"99")
this.point = result.data.userInfo.points
})
.catch(err => {
if (err.result && err.result.status == 401) {
app.isLogin = false
}
})
// return new Promise((resolve, reject) => {
// !app.isLogin ? resolve(null) : UserApi.info({}, { load: app.isFirstload })
// .then(result => {
// app.userInfo = result.data.userInfo
// resolve(app.userInfo)
// })
// .catch(err => {
// if (err.result && err.result.status == 401) {
// app.isLogin = false
// resolve(null)
// } else {
// reject(err)
// }
// })
// })
},
/**
* 上拉加载的回调 (页面初始化时也会执行一次)
* 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10
* @param {Object} page
*/
upCallback(page) {
const app = this
// 设置列表数据
app.getLogList(page.num)
.then(list => {
const curPageLen = list.data.length
const totalSize = list.data.total
app.mescroll.endBySize(curPageLen, totalSize)
})
.catch(() => app.mescroll.endErr())
},
// 获取积分明细列表
getLogList(pageNo = 1) {
const app = this
return new Promise((resolve, reject) => {
LogApi.list({ page: pageNo })
.then(result => {
// 合并新数据
const newList = result.data.list
app.list.data = getMoreListData(newList, app.list, pageNo)
resolve(newList)
})
})
}
}
}
</script>
<style lang="scss" scoped>
page,
.container {
// background: #fff;
padding: 24rpx;
background: #F5F5F7;
}
.logText{
margin:42rpx 0 24rpx 0;
font-family: Source Han Sans SC;
font-weight: 400;
font-size: 30rpx;
color: #222222;
}
.log-list {
// padding: 0 30rpx;
}
.log-item {
font-size: 28rpx;
padding: 20rpx 20rpx;
line-height: 1.8;
border-bottom: 1rpx solid rgb(238, 238, 238);
display: flex;
justify-content: center;
align-items: center;
background: #FFFFFF;
border-radius: 20rpx;
margin-bottom: 20rpx;
}
.add{
color:#F92404;
}
.rec-status {
color: #333;
.rec-time {
color: rgb(160, 160, 160);
font-size: 26rpx;
}
}
.totalPoint{
position: relative;
&>image{
width: 100%;
height:auto;
}
.pointInfo{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: absolute;
width:100%;
left:0;
top:0;
z-index:2;
height: 100%;
&>view{
font-family: Source Han Sans SC;
font-weight: 400;
font-size: 60rpx;
color: #FFFFFF;
}
&>text{
margin-top:11rpx;
font-family: Source Han Sans SC;
font-weight: 400;
font-size: 30rpx;
color: #FFFFFF;
}
}
}
</style>