martial-arts/pagesA/my-integral/my-integral.vue

111 lines
3.4 KiB
Vue
Raw Normal View History

2022-08-03 13:28:45 +00:00
<template>
<view>
<status-container titlet="积分收支明细" returnc="#FFFFFF">
<view slot="content" style="padding-bottom: 0;">
<view class="posi-sticky boxshow2" :style="{top:newtop+'px'}" style="margin-top: -20rpx;">
<view class="bbot disjbac pad-zy40 pad-sx30">
2022-08-11 10:27:47 +00:00
<view class="fon26">积分{{allScore}}</view>
<view class="disac pad-zy12 pad-sx8 radius6" @tap="$toolAll.tools.goPage('/pagesA/my-sign/my-sign')" style="border: 2rpx solid #adadad;">
2022-08-03 13:28:45 +00:00
<image src="/static/tabbar/icon-score-rili.png" mode="" style="width: 24rpx;height: 24rpx;" lazy-load></image>
<view class="fon24 mar-z10" style="color: #adadad;">签到</view>
2022-08-03 13:28:45 +00:00
</view>
</view>
<swiper-tab id="tab" :ifBetween="false" :ifPadding="true" :list="tabList" v-model="current" @changeEv="clickTab" :itemColor="'#e42417'" :lineColor="'#e42417'"></swiper-tab>
</view>
2022-08-10 10:18:06 +00:00
<view class="mar-s30 bacf pad-zy40 pad-sx20 boxshow2" v-if="total">
2022-08-03 13:28:45 +00:00
<view class="pad-sx20 col26 bbot" v-for="(item,index) in dataList" :key="index">
<view class="fon26 disjbac">
2022-08-11 10:27:47 +00:00
<view class="">{{item.name}}</view>
<view class="col-e42417"><span v-if="item.num>0">+</span>{{item.num}}</view>
2022-08-03 13:28:45 +00:00
</view>
2022-08-11 10:27:47 +00:00
<view class="fon20" style="color: #8b8b8b;">{{item.created_at}}</view>
2022-08-03 13:28:45 +00:00
</view>
</view>
2022-08-16 10:06:46 +00:00
<view class="" v-if="loading">
<pitera :textStr="`${noMore && total > dataList.length?'上滑加载更多':'到底了'}~~`" textColor="#b0aaa9" paddingStr="40rpx 0 20rpx 0"></pitera>
2022-08-03 13:28:45 +00:00
</view>
</view>
</status-container>
</view>
</template>
<script>
import swiperTab from '@/components/swiper-tab/swiper-tab.vue';
import pitera from '@/components/nothing/pitera.vue';
export default {
components:{
swiperTab,
pitera
},
data() {
return {
newtop:uni.getSystemInfoSync().statusBarHeight + 42,
2022-08-11 10:27:47 +00:00
allScore:uni.getStorageSync('userInfo').score,
2022-08-03 13:28:45 +00:00
current:0,
tabList:[
{title:'全部'},
{title:'已获取'},
{title:'已消耗'}
],
dataList:[
{price:10,title:'签到',time:'2022.07.11-2022.07.30'},
{price:10,title:'分享',time:'2022.07.11-2022.07.30'},
{price:10,title:'推荐消费',time:'2022.07.11-2022.07.30'},
{price:10,title:'课程抵扣',time:'2022.07.11-2022.07.30'},
{price:10,title:'商品抵扣',time:'2022.07.11-2022.07.30'},
{price:10,title:'签到',time:'2022.07.11-2022.07.30'},
{price:10,title:'分享',time:'2022.07.11-2022.07.30'},
{price:10,title:'推荐消费',time:'2022.07.11-2022.07.30'},
2022-08-10 10:18:06 +00:00
],
page:1,
size:20,
type:'',
total:0,
2022-08-16 10:06:46 +00:00
noMore:false,
loading:false
2022-08-10 10:18:06 +00:00
}
},
onLoad() {
this.getIntegral();
},
onReachBottom() {
if(this.total!=this.dataList.length){
this.page++;
this.getIntegral();
2022-08-03 13:28:45 +00:00
}
},
methods: {
// tab点击事件
clickTab(index){
this.current = index;
2022-08-10 10:18:06 +00:00
this.type = ['','in','out'][this.current];
this.page = 1;
this.getIntegral();
},
// 获取积分列表
getIntegral(){
2022-08-16 10:06:46 +00:00
this.loading = false;
2022-08-10 10:18:06 +00:00
let params = {
type:this.type,
page:this.page,
size:this.size
}
this.$requst.get('/api/user/score-log',params).then(res=>{
if(res.code==0){
this.total = res.data.total;
if(this.page==1){this.dataList=[];}
this.dataList = [...this.dataList,...res.data.list];
if(this.total==this.dataList.length && this.page!=1){
this.noMore = true;
}
2022-08-16 10:06:46 +00:00
this.loading = true;
2022-08-10 10:18:06 +00:00
}
})
2022-08-03 13:28:45 +00:00
}
}
}
</script>
<style>
</style>