190 lines
5.8 KiB
Vue
190 lines
5.8 KiB
Vue
<template>
|
||
<view>
|
||
<!-- 状态栏 -->
|
||
<status-nav :titleVal="'积分管理'" :statusTitle="true"></status-nav>
|
||
<view :style="{paddingTop: statusHNH+'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>
|
||
<!-- 弹框授权 -->
|
||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||
<!-- 弹框 -->
|
||
<auth-phone v-if="isShowP"></auth-phone>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
statusHNH:uni.getStorageSync('statusHNH'),
|
||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||
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,
|
||
vision:false,
|
||
isShowP:false,
|
||
}
|
||
},
|
||
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
|
||
}
|
||
},
|
||
onShareAppMessage() {
|
||
var shareObj = {
|
||
path: `/pagesA/integralManage/integralManage?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||
};
|
||
return shareObj;
|
||
},
|
||
onLoad(options) {
|
||
if(uni.getStorageSync('is_active')!=1){this.vision = true;}
|
||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||
this.loginEv(options.invite_code);
|
||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||
this.loginEv('',options.source_code,options.channel);
|
||
}
|
||
this.$toolAll.tools.isLogin();
|
||
this.checkInfo();
|
||
this.checkList();
|
||
},
|
||
methods: {
|
||
loginEv(invite_code='',source='',channel=''){
|
||
uni.login({
|
||
provider: 'weixin',
|
||
success: (res)=> {
|
||
if (res.code) {
|
||
var params = {
|
||
code:res.code,
|
||
invite_code:invite_code,//用户邀请码
|
||
source_code:source,
|
||
channel:channel
|
||
}
|
||
this.$requst.post('user/login',params).then(res => {
|
||
if(res.data.token!=''){
|
||
if(res.data.is_active==0) {
|
||
this.haveImg = false;
|
||
this.vision = true;
|
||
}
|
||
}
|
||
},error => {})
|
||
}
|
||
},
|
||
});
|
||
},
|
||
buttonH(e){//授权成功
|
||
this.haveImg = e
|
||
if(e) {
|
||
this.vision = false
|
||
this.isShowP = true
|
||
}
|
||
},
|
||
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>
|