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

108 lines
3.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<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">
<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;">
<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>
</view>
</view>
<swiper-tab id="tab" :ifBetween="false" :ifPadding="true" :list="tabList" v-model="current" @changeEv="clickTab" :itemColor="'#e42417'" :lineColor="'#e42417'"></swiper-tab>
</view>
<view class="mar-s30 bacf pad-zy40 pad-sx20 boxshow2" v-if="total">
<view class="pad-sx20 col26 bbot" v-for="(item,index) in dataList" :key="index">
<view class="fon26 disjbac">
<view class="">{{item.name}}</view>
<view class="col-e42417"><span v-if="item.num>0">+</span>{{item.num}}</view>
</view>
<view class="fon20" style="color: #8b8b8b;">{{item.created_at}}</view>
</view>
</view>
<view class="pad-zy20" v-if="noMore">
<pitera textStr="上滑加载更多/到底了~~" textColor="#b0aaa9" paddingStr="40rpx 0 20rpx 0"></pitera>
</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,
allScore:uni.getStorageSync('userInfo').score,
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'},
],
page:1,
size:20,
type:'',
total:0,
noMore:false
}
},
onLoad() {
this.getIntegral();
},
onReachBottom() {
if(this.total!=this.dataList.length){
this.page++;
this.getIntegral();
}
},
methods: {
// tab点击事件
clickTab(index){
this.current = index;
this.type = ['','in','out'][this.current];
this.page = 1;
this.getIntegral();
},
// 获取积分列表
getIntegral(){
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;
}
}
})
}
}
}
</script>
<style>
</style>