2024-12-18 15:46:27 +08:00
|
|
|
<script setup>
|
|
|
|
/**
|
|
|
|
* 我的团队
|
|
|
|
*/
|
|
|
|
import {
|
|
|
|
onMounted,
|
|
|
|
ref,
|
|
|
|
reactive,
|
|
|
|
computed,
|
|
|
|
getCurrentInstance,
|
|
|
|
watch,
|
|
|
|
defineExpose,
|
|
|
|
} from 'vue';
|
|
|
|
import {
|
|
|
|
useStore,
|
|
|
|
} from 'vuex'
|
|
|
|
import {
|
|
|
|
onLoad,
|
|
|
|
onReady,
|
|
|
|
onHide,
|
|
|
|
onShow,
|
|
|
|
onUnload,
|
|
|
|
} from '@dcloudio/uni-app'
|
|
|
|
//
|
|
|
|
import util from '@/common/js/util.js'
|
|
|
|
//
|
|
|
|
import api from '@/api/index.js';
|
|
|
|
|
|
|
|
const store = useStore()
|
|
|
|
const userinfo = computed(() => {
|
|
|
|
let result = store.state.userinfo
|
|
|
|
return result
|
|
|
|
})
|
|
|
|
// 二维码数据
|
|
|
|
const qrData = ref("")
|
|
|
|
// 我的团队数据
|
|
|
|
const team = ref({})
|
2024-12-31 14:46:56 +08:00
|
|
|
// 展示我的团队
|
|
|
|
const showTeam = ref(false)
|
2025-02-11 09:34:58 +08:00
|
|
|
// 是否显示修改
|
|
|
|
const editTigger = ref(false)
|
|
|
|
// 修改值
|
|
|
|
const edit = ref('')
|
2024-12-18 15:46:27 +08:00
|
|
|
|
|
|
|
onLoad(() => {
|
|
|
|
myQrcode()
|
|
|
|
myTeam()
|
|
|
|
})
|
|
|
|
|
|
|
|
// 我的团队
|
|
|
|
function myTeam() {
|
2024-12-31 14:46:56 +08:00
|
|
|
api.team.myTeam({}).then(rs => {
|
2024-12-18 15:46:27 +08:00
|
|
|
if (rs.code == 200) {
|
|
|
|
team.value = rs.data
|
|
|
|
return
|
|
|
|
}
|
|
|
|
util.alert({
|
|
|
|
content: rs.msg,
|
|
|
|
showCancel: false,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 我的团队
|
|
|
|
function lowTeam(item) {
|
|
|
|
item.showSecond = !item.showSecond
|
|
|
|
}
|
|
|
|
|
|
|
|
// 查看二维码
|
|
|
|
function myQrcode() {
|
|
|
|
api.intergral.myQrcode({}).then(rs => {
|
|
|
|
qrData.value = `data:image/png;base64, ${uni.arrayBufferToBase64(rs)}`
|
|
|
|
})
|
|
|
|
}
|
2025-02-11 09:34:58 +08:00
|
|
|
|
|
|
|
// 修改上级推荐人
|
|
|
|
function updateReferrer() {
|
|
|
|
api.team.updateReferrer({
|
|
|
|
query: {
|
|
|
|
invitationCode: edit.value,
|
|
|
|
},
|
|
|
|
}).then(rs => {
|
|
|
|
if (rs.code == 200) {
|
|
|
|
//
|
|
|
|
edit.value = ''
|
|
|
|
editTigger.value = false
|
|
|
|
//
|
|
|
|
myTeam()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
util.alert({
|
|
|
|
content: rs.msg,
|
|
|
|
showCancel: false,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
2024-12-18 15:46:27 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<view class="appbw plr50 c333 f36">
|
|
|
|
<view class="qrBox ver">
|
|
|
|
<image class="qr" :src="qrData" mode="aspectFill" />
|
|
|
|
</view>
|
|
|
|
|
2025-02-17 19:26:33 +08:00
|
|
|
<view class="log mtb60 f28" v-if="team.referrerReferrerUser">
|
2024-12-18 15:46:27 +08:00
|
|
|
<view class="title tac f32">上级推荐人</view>
|
|
|
|
<view class="list">
|
|
|
|
<view class="item rows mtb20">
|
|
|
|
<view class="f1">
|
|
|
|
<view>账户昵称</view>
|
|
|
|
</view>
|
2025-02-17 19:26:33 +08:00
|
|
|
<view class="">{{team.referrerReferrerUser.userNickname}}</view>
|
2024-12-18 15:46:27 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
2025-02-17 19:26:33 +08:00
|
|
|
<view class="log mtb60 f28" v-if="team.referrerUser">
|
2025-02-11 09:34:58 +08:00
|
|
|
<view class="title rows">
|
|
|
|
<view class="f1"></view>
|
|
|
|
<view class="tac f32 mlr20">我的推荐人</view>
|
|
|
|
<view class="f1 df aic">
|
|
|
|
<uni-icons type="compose" @click="editTigger = !editTigger" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="editBox rows mtb10 ptb20 plr20" v-if="editTigger">
|
|
|
|
<view class="f1">
|
|
|
|
<input type="text" v-model="edit" placeholder="请输入需要修改的上级邀请码" />
|
|
|
|
</view>
|
|
|
|
<view class="btn sm colourful plr20" @click="updateReferrer">修改</view>
|
|
|
|
</view>
|
|
|
|
|
2024-12-18 15:46:27 +08:00
|
|
|
<view class="list">
|
|
|
|
<view class="item rows mtb20">
|
|
|
|
<view class="f1">
|
|
|
|
<view>账户昵称</view>
|
|
|
|
</view>
|
2025-02-17 19:26:33 +08:00
|
|
|
<view class="">{{team.referrerUser.userNickname}}</view>
|
2024-12-18 15:46:27 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="myTeam mtb60">
|
|
|
|
<view class="title tac">我的团队</view>
|
|
|
|
|
2024-12-31 14:46:56 +08:00
|
|
|
<view class="secTitle rows mt30">
|
|
|
|
<view class="f1">
|
|
|
|
<text>当前团队基数</text>
|
|
|
|
<text v-if="team.count">{{team.count}}人</text>
|
|
|
|
</view>
|
|
|
|
<view class="arrow" :class="{'active': showTeam}" @click="showTeam = !showTeam">
|
2024-12-18 15:46:27 +08:00
|
|
|
<uni-icons type="right" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
2024-12-31 14:46:56 +08:00
|
|
|
<view class="team oh mt20 plr30" v-if="showTeam">
|
2024-12-18 15:46:27 +08:00
|
|
|
<!-- 一级 -->
|
|
|
|
<view class="li mtb30" v-for="(item,index) in team.sonUser" :key="item.id">
|
|
|
|
<view class="menber df aic">
|
|
|
|
<view class="c333 f32">{{item.userNickname}}</view>
|
|
|
|
<template v-if="item.sonList[0]">
|
|
|
|
<uni-icons @click="lowTeam(item)" type="up" color="#A45EFF" size="28rpx"
|
|
|
|
v-if="item.showSecond" />
|
|
|
|
<uni-icons @click="lowTeam(item)" type="plusempty" color="#A45EFF" size="28rpx" v-else />
|
|
|
|
</template>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 二级人数 -->
|
|
|
|
<view class="list" v-if="item.showSecond">
|
|
|
|
<view class="secLi df" v-for="(secItem,secIndex) in item.sonList" :key="secItem.id">
|
2024-12-31 14:46:56 +08:00
|
|
|
|
2024-12-18 15:46:27 +08:00
|
|
|
<view class="vertical df fdc">
|
|
|
|
<view class="top"></view>
|
|
|
|
<view class="bottom"></view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 内容 -->
|
|
|
|
<view class="content df aic f1 ptb10">
|
|
|
|
<view class="line"></view>
|
2025-02-17 19:26:33 +08:00
|
|
|
<view class="ml10 df aic c999 f28">
|
|
|
|
<view class="count mr20 plr10 cfff br10" v-if="secItem.isShop">商</view>
|
2024-12-31 14:46:56 +08:00
|
|
|
<view class="name">{{secItem.userNickname}}</view>
|
|
|
|
<view class="label ml10">{{secItem.count}}</view>
|
2024-12-18 15:46:27 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
2024-12-31 14:46:56 +08:00
|
|
|
|
|
|
|
<view class="fill"></view>
|
2024-12-18 15:46:27 +08:00
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
// 二维码
|
|
|
|
.qrBox {
|
|
|
|
margin-top: 5vh;
|
|
|
|
|
|
|
|
.qr {
|
|
|
|
width: 374rpx;
|
|
|
|
height: 374rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 箭头
|
|
|
|
.arrow {
|
|
|
|
&.active {
|
|
|
|
transform: rotate(90deg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-02-11 09:34:58 +08:00
|
|
|
// 编辑盒子
|
|
|
|
.editBox {
|
|
|
|
background-color: #eee;
|
|
|
|
border-radius: 20rpx;
|
|
|
|
}
|
|
|
|
|
2024-12-18 15:46:27 +08:00
|
|
|
// 团队
|
|
|
|
.team {
|
|
|
|
background-color: #FFFBF3;
|
|
|
|
|
|
|
|
// 二级列表
|
|
|
|
.list {
|
|
|
|
padding-left: .5em;
|
|
|
|
|
|
|
|
// 二级项
|
|
|
|
.secLi:nth-last-child(1) {
|
|
|
|
.bottom {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 竖线
|
|
|
|
.vertical {
|
|
|
|
|
|
|
|
.top,
|
|
|
|
.bottom {
|
|
|
|
flex: 1;
|
|
|
|
border-left: 2rpx solid #8A8A8A;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 横线
|
|
|
|
.line {
|
|
|
|
width: 50rpx;
|
|
|
|
border-top: 2rpx solid #8A8A8A;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 内容
|
|
|
|
.content {
|
|
|
|
|
|
|
|
// 计数
|
2025-02-17 19:26:33 +08:00
|
|
|
// .label {
|
|
|
|
// background-image: linear-gradient(144deg, #27EFE2 0%, #A45EFF 43%, #FF004F 100%);
|
|
|
|
// -webkit-background-clip: text;
|
|
|
|
// -webkit-text-fill-color: transparent;
|
|
|
|
// background-clip: text;
|
|
|
|
// text-fill-color: transparent;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// 商家标签
|
2024-12-18 15:46:27 +08:00
|
|
|
.count {
|
|
|
|
background-image: linear-gradient(114deg, #27EFE2 0%, #A45EFF 43%, #FF004F 100%);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|