hengmei-two/pagesA/integralManage/integralManage.vue

148 lines
4.4 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-nav :titleVal="'积分管理'" :statusTitle="true"></status-nav>
<view :style="{paddingTop: statusHeight+'px'}" class="pad-zy30 fon28 col3">
<view class="mar-s20 bacf pad20 radius20 bold">
<view class="mar-x30">当前积分</view>
<view style="font-size: 56rpx;">{{dangScore}}</view>
</view>
<view class="mar-s20 disjbac">
<view class="disjbac pad20 bacf radius20 width48" style="box-sizing: border-box;">
<image src="../../static/public/integral-01-108.png" class="score-img" mode=""></image>
<view class="width100 score-people-box">
<view class="font4">我的分享人</view>
<view class="fon36 bold">{{sharePeople}}<span class="fon26 font4"></span></view>
</view>
</view>
<view class="disjbac pad20 bacf radius20" style="box-sizing: border-box;">
<image src="../../static/public/integral-02-108.png" class="score-img" mode=""></image>
<view class="width100 score-people-box">
<view class="font4">签到记录</view>
<view @tap="goSigin" class="score-sigin-btn">立即签到</view>
</view>
</view>
</view>
<!-- 积分列表消费列表 -->
<view class="mar-s20 bacf pad20 radius20">
<view class="mar-x50 fon28 disja">
<view @tap="switchState(true)" :class="activeJF?'col3 bold':'col9'">积分列表</view>
<view @tap="switchState(false)" :class="!activeJF?'col3 bold':'col9'">消费列表</view>
</view>
<!-- 积分列表 -->
<block v-if="dataList.length!=0">
<view v-for="(item,index) in dataList" :key="index" class="disjbac bbot pad-sx10">
<view>
<view class="fon26 col3">{{item.title}}</view>
<view class="mar-s10 fon20 col9">{{item.time}}</view>
</view>
<view v-show="activeJF" class="fon36 bold pcol">+{{item.num}}</view>
<view v-show="!activeJF" class="fon36 bold">{{item.num}}</view>
</view>
</block>
<view v-if="isHave" class="disjcac fon24 col9 bold">暂无更多列表信息</view>
</view>
<!-- 分享按钮 -->
<view class="disjcac score-share-box">
<image src="/static/public/bottom-shear.png" mode=""></image>
<view class="fon40 colf bold mar-z10">分享给好友</view>
<button class="posia-op" open-type="share"></button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
activeJF:true,
dataList:[
// {title:'签到兑换',time:'2021.09.06 10:30:10',num:'1'},
// {title:'分享注册',time:'2021.09.06 10:30:10',num:'1'},
// {title:'二级分销',time:'2021.09.06 10:30:10',num:'1'},
// {title:'任务完成',time:'2021.09.06 10:30:10',num:'1'},
],
dangScore:0,//当前积分
sharePeople:0,//我的分享人
page:1,
size:10,
total:0,
isZanw:true,
ntype:'in',
isHave:false,
}
},
computed:{
statusHeight() {
return this.$store.state.statusHeight
}
},
onReachBottom() {
if(this.total!=this.dataList.length){
this.page++
this.checkList(this.ntype)//调用自主预约列表事件
} else {
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多记录','none',1000)
this.isZanw = false
}
},
onShow() {
// 禁用小程序分享
this.$toolAll.tools.disableShareEv();
},
onLoad(options) {
this.checkInfo();
this.checkList();
},
methods: {
checkList(){//查询积分列表
this.$requst.post('user/score-log',{page:this.page,size:this.size,type:this.ntype}).then(res=>{
if(res.code==0){
if(this.page==1) this.dataList = [];
this.total = res.data.total;
if(res.data.list.length!=0){
res.data.list.forEach(item=>{
let obj = {
title:item.name,
time:item.created_at,
num:item.num
}
this.dataList.push(obj);
})
}
if(this.dataList.length==0)this.isHave = true;
}
})
},
checkInfo(){//查询个人积分信息
this.$requst.post('user/score-load').then(res=>{
if(res.code==0){
this.dangScore = res.data.score;
this.sharePeople = res.data.share.total;
}
})
},
switchState(flag){//切换事件
this.dataList = [];
this.activeJF = flag;
this.page =1;
this.isZanw = true;
if(flag) {
this.ntype ='in';
this.checkList(this.ntype);
} else {
this.ntype ='out';
this.checkList(this.ntype);
}
},
goSigin(){
uni.navigateTo({url:'/pagesA/signIn/signIn'})
}
}
}
</script>
<style>
</style>