mall-laonong/pagesA/integral/integral.vue

110 lines
2.7 KiB
Vue

<template>
<view v-if="isLoading">
<status-nav :ifReturn="true" navBarTitle="我的积分" :marginBottom="0"></status-nav>
<!-- 余额概况 -->
<view class="recharge border-box">
<view class="recharge-msg radius30 border-box">
<view class="txt flex">
<text class="font30">我的积分</text>
<text class="font24" @tap="goIntegralRule">积分规则</text>
</view>
<view class="price font60">{{score}}</view>
</view>
</view>
<!-- 明细 -->
<view class="recharge-detailed border-box pad-all20 mar-s20">
<view class="recharge-title font30 flex">
<view class="line background-orange"></view>
<text>积分明细</text>
</view>
<view class="detailed-list">
<view class="detailed-item font30 border-box pad-sx20 flex" v-for="(item,index) in detailedList" :key="index">
<view class="txt">
<view class="name mar-x10">{{item.name}}</view>
<view class="time font24 color-99">{{item.created_at}}</view>
</view>
<view class="price" style="margin-right: 10rpx;" :class="item.num<0?'color-red':''"><text v-if="item.num>0">+</text>{{parseInt(item.num)}}</view>
</view>
</view>
</view>
<!-- -->
<view class="no-more pad-sx25 font24" style="margin: 0;" v-if="noMore"><text> 到底啦 </text></view>
</view>
</template>
<script>
export default {
data() {
return {
detailedList:[],//明细列表
score:0, //积分
page:1,
size:10,
total:0,
noMore:false,
isLoading:false,
}
},
onShow() {
// 获取个人信息
this.getUserInfo();
},
onReachBottom() {
if(!this.noMore){
this.page++;
// 查询积分明细
this.getScoreEV();
}
},
methods: {
// 获取个人信息
getUserInfo(){
this.$requst.post('/api/user/info').then(res=>{
if(res.code == 0){
console.log(res,'用户信息');
this.score = res.data.score;
this.detailedList = [];
// 查询积分明细
this.getScoreEV();
}
})
},
// 查询积分明细
getScoreEV(){
uni.showLoading({
title:'加载中'
})
let params = {
page:this.page,
size:this.size,
type:'score'
}
this.$requst.post('/api/user/data-log-list',params).then(res=>{
if(res.code == 0){
console.log(res,'积分明细');
if(res.data==0){
this.noMore = true;
}
this.detailedList = this.detailedList.concat(res.data);
}
uni.hideLoading();
this.isLoading = true;
})
},
// 查看积分规则
goIntegralRule(){
uni.navigateTo({
url:`/pagesB/integral-rule/integral-rule`
})
}
}
}
</script>
<style>
</style>