2025-06-06 03:08:19 +08:00

220 lines
7.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="minebg">
<nav-bar title="Promotion" bgColor="rgba(255, 0, 0, 0.9);"></nav-bar>
<view class="v2">
<view style="width: 200upx; float: left;" @click="onTokenJump('/pages/mine/info')">
<image style="width: 80px; height: 80px" :src="url" fit="cover"></image>
</view>
<view class="login" @click="onPageJump('/pages/mine/login')" v-if="!islogin">
Login/Register
</view>
<view class="login1" v-else>
<view><span @click="onTokenJump('/pages/mine/info')" class="s">{{user.username}}</span></view>
<span style="font-size: 14px; font-weight: 400; float: left;">ID{{user.id}}</span>
<button @click="onTokenJump('/pages/promotion/invite')" style="background-color: #1677FF; color: #fff; font-size: 30rpx; height: 70rpx; line-height: 70rpx; width: 200rpx; float: right;">
<uni-icons size="20" type="gift" style="color: #fff;"></uni-icons>Invite</button>
<image class="i" src="/static/images/copy.png" @click="copy(user.id)" mode="cover"></image>
</view>
<view style="clear: both;"></view>
</view>
<view class="v3">
<view style="padding: 0rpx 20rpx;">
<view style="font-size: 16px; font-weight: 500; color: #3d3d3d;">My community</view>
<view style="font-weight: 500; padding: 10px 0px; font-size: 14px; color: #999; margin-top: 10px; text-align: center; background-color: #EDF1F3;">
<view class="cell_list" style="background-color: #EDF1F3; padding: 10px;">
<view class="cell_left txt">Total team Size</view>
<view class="cell_right" style="font-size: 18px; font-weight: 500;">{{team.total_count}}</view>
</view>
<view class="cell_list" style="background-color: #EDF1F3; padding: 10px;">
<view class="cell_left txt">Direct referral headcount</view>
<view class="cell_right" style="font-size: 18px; font-weight: 500;">{{team.direct_total}}</view>
</view>
<view class="cell_list" style="background-color: #EDF1F3; padding: 10px;">
<view class="cell_left txt">KPI Results-Region</view>
<view class="cell_right" style="font-size: 18px; font-weight: 500;">{{parseFloat(team.resultsRegion).toFixed(4)}}</view>
</view>
<view class="cell_list" style="background-color: #EDF1F3; padding: 10px;">
<view class="cell_left txt">KPI Results-Cell</view>
<view class="cell_right" style="font-size: 18px; font-weight: 500;">{{parseFloat(team.resultsCell).toFixed(4)}}</view>
</view>
</view>
</view>
</view>
<view style="width: 94%; margin: 0px auto;">
<view class="cell_list" style="padding: 15px 10px;">
<view style="color: #3d3d3d; font-size: 16px; font-weight: 500;">Direct referral list</view>
<view class="cell_right arrow" style="color: #999;" @click="onPageJump('/pages/promotion/list')">View all</view>
</view>
<uni-row :gutter="10" v-for="(item, index) in list" :key="index" :style="index==0 ? '' : 'margin-top: 30px;'">
<uni-col :span="6" style="text-align: center;">
<image style="width: 60px; height: 60px; margin: auto;" :src="url" fit="cover"></image>
</uni-col>
<uni-col :span="18">
<view style="font-weight: 500; font-size: 16px; color: #3d3d3d;">{{item.username}}</view>
<view style="font-size: 12px; font-weight: 400; color: #999; line-height: 40rpx;">
ID{{item.id}}<br>
Join date: {{item.created_at}}<br>
KPI results: <span style="color: #333; font-weight: 500; margin-left: 6rpx;"> {{parseFloat(item.performance_large).toFixed(4)}}</span><br>
Total Team Size: <span style="color: #333; font-weight: 500; margin-left: 6rpx;"> {{item.total_count}}</span>
</view>
</uni-col>
</uni-row>
<view style="text-align: center; padding-bottom: 80px;" v-if="list.length <= 0">
<image style="width: 360rpx; height: 180px; margin: 50rpx auto 0rpx auto;" src="/static/images/w5.png" fit="cover"></image>
<view style="color: #999; font-size: 14px; font-weight: 400;">No data available</view>
</view>
</view>
</view>
</template>
<script>
import zNavigation from '@/components/module/navigation.vue';
import {
mapState,
mapMutations
} from 'vuex';
export default {
components: {
zNavigation
},
data() {
return {
url:"/static/images/tx.png",
islogin: false,
user:{
avatar: '/static/images/tx.png',
username: '',
id: '',
role_id: 1,
},
team:{
total_count: 0,
direct_total: 0,
resultsRegion: 0.00,
resultsCell: 0.00
},
par:{
page: 1,
limit: 10
},
list: []
}
},
computed: {
...mapState(['userInfo'])
},
//第一次加载
onShow(e) {
uni.showLoading({
title:'Array loading...'
})
if(this.userInfo.token === typeof(undefined) || this.userInfo.token === undefined){
this.islogin = false;
uni.hideLoading();
}else{
this.islogin = true;
this.user.money = parseFloat(this.userInfo.money);
this.user.score = parseFloat(this.userInfo.score);
this.user.username = this.userInfo.username;
this.user.id = this.userInfo.id;
if(this.userInfo.avatar !== '' && this.userInfo.avatar != null){
this.user.avatar = this.userInfo.avatar;
}
this.$http.get('/api/team/index?lang='+this.$i18n.locale).then(res => {
if(res.code == 0){
this.team.total_count = res.data.total_count;
this.team.direct_total = res.data.direct_total;
this.team.resultsRegion = res.data.performance_large;
this.team.resultsCell = res.data.performance_small;
}
});
let data = {
page: this.par.page,
limit: this.par.limit,
lang: this.$i18n.locale
};
this.$http.post('/api/team/list', data).then(res => {
if(res.code == 0){
this.list = res.data.data;
uni.hideLoading();
}
}).catch(err => {
uni.hideLoading();
});
}
},
methods: {
onPageJump(url) {
uni.navigateTo({
url: url
});
},
onTokenJump(url) {
this.judgeLogin(() => {
uni.navigateTo({
url: url
});
});
},
getTeamList(){
this.$http.get('/api/team/list?lang='+this.$i18n.locale).then(res => {
if(res.code == 0){
console.log(res.data);
}
});
},
copy(val = ''){
const textArea = document.createElement('textarea');
textArea.value = val;
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
uni.showToast({
title: this.$t('copySuccess')
});
} catch (err) {
console.error('Could not copy text: ', err);
}
document.body.removeChild(textArea);
},
}
}
</script>
<style scoped>
.page{min-height: 100vh;position: relative; background-color: #fff;}
.minebg{
width: 100vw;
min-height: 100vh;
background: url('/static/images/minebg.png') #fff;;
background-size: 100%;
background-repeat: repeat-x;
font-family: Poppins, Poppins;
}
.minebg .v2 .login1{
width: 70%; float: left; font-size: 16pt; font-weight: 700; height:200upx; line-height: 60upx; padding-top: 20px;
}
.minebg .v2 .login1 .i{
width: 24rpx; height: 24rpx; float:left; margin-top: 16rpx; margin-left: 10rpx;
}
.minebg .v1{
float: right; margin-top: 10upx; padding-right: 20upx;
}
.minebg .v2{
clear: both; width: 90vw; margin: auto; padding-top: 20px;
}
.minebg .v2 .login{
width: 260upx; float: left; font-size: 16pt; font-weight: 700; height:160upx; line-height: 160upx;
}
.minebg .v3{
width: 94vw; margin: auto; border-radius: 30upx;
}
.item{
margin: 30upx 20upx;
}
</style>