幼教产品B2B生态平台小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

525 lines
14 KiB

<template>
<view class="page">
<view class="status-bar"></view>
<image class="bg" src="https://occupationlab.com/images/preschoolEdu/person-bg.png" />
<view v-if="platformId !== 7" class="team-wrap" :style="{paddingTop: headerTop}">
<view class="team">
<uni-data-picker class="picker-input" placeholder="切换团队" popup-title="切换团队" preload :clear-icon="false" :localdata="teams" :map="{text: 'classificationName', value: 'teamId'}" v-model="teamId" @change="teamChange"></uni-data-picker>
</view>
</view>
<view class="wrap">
<view class="info">
<button class="avatar-btn" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image class="avatar" :src="avatar" mode=""></image>
</button>
<view class="text">
<view class="name">{{ info.realName || userName }}</view>
<view class="phone">1369641301</view>
</view>
<view class="auth" @click="toAuth">
{{ isAuth ? '' : '待' }}实名认证
<uni-icons class="icon" type="right" size="16" color="#4876f9"></uni-icons>
</view>
<view v-if="!disabled" class="tag">团队负责人</view>
</view>
<view class="block" style="padding-bottom: 0;">
<view class="title">基础功能</view>
<ul class="func">
<li @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon1.png" />
<view class="text ell">我的电子券</view>
</li>
<li @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon2.png" />
<view class="text ell">我的关注</view>
</li>
<li @click="toPage('/other/registeredActivity/registeredActivity')">
<image src="https://occupationlab.com/images/preschoolEdu/icon3.png" />
<view class="text ell">已报名活动</view>
</li>
<li @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon4.png" />
<view class="text ell">我的发票</view>
</li>
<li @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon5.png" />
<view class="text ell">我的订单</view>
</li>
<li @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon6.png" />
<view class="text ell">发布采购</view>
</li>
</ul>
</view>
<template v-if="platformId === 7">
<view class="types">
<view class="item">
<view class="left">
<view class="icon">
<image class="img" src="https://occupationlab.com/images/preschoolEdu/role-icon1.png" mode="widthFix" />
</view>
<view class="text">我是供应商</view>
</view>
<view class="btn" @click="tips">供应商认证</view>
</view>
</view>
<view class="types">
<view class="item item2">
<view class="left">
<view class="icon">
<image class="img" src="https://occupationlab.com/images/preschoolEdu/role-icon2.png" mode="widthFix" />
</view>
<view class="text">我是幼儿园</view>
</view>
<view class="btn" @click="tips">幼儿园认证</view>
</view>
</view>
</template>
<view v-else class="block" style="padding-bottom: 0;">
<view class="identity">
<view class="title">我是{{ platformName }}</view>
<view class="badge">{{ platformName }}负责人</view>
<view class="auth" @click="toPage('/team/certified/certified')">未认证</view>
</view>
<view class="identity-bg">
<image v-if="isPreschool" class="pic" src="https://occupationlab.com/images/preschoolEdu/preschool1.png" mode="widthFix" />
<image v-else class="pic" src="https://occupationlab.com/images/preschoolEdu/supplier1.png" mode="widthFix" />
<view class="open">
立即开通
<uni-icons class="icon" type="right" size="12" color="#c5530d"></uni-icons>
</view>
</view>
<view class="title">工作台</view>
<ul class="func">
<li @click="toPage('/team/auth/auth')">
<image src="https://occupationlab.com/images/preschoolEdu/icon7.png" />
<view class="text ell">{{ platformName }}认证</view>
</li>
<li v-if="isSupplier" @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon8.png" />
<view class="text ell">商品管理</view>
</li>
<li @click="toPage('/team/teams/teams')">
<image src="https://occupationlab.com/images/preschoolEdu/icon9.png" />
<view class="text ell">团队管理</view>
</li>
<li @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon10.png" />
<view class="text ell">{{ isSupplier ? '订单管理' : '我的订单' }}</view>
</li>
<li v-if="isSupplier" @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon11.png" />
<view class="text ell">活动管理</view>
</li>
<li @click="toPage('/team/info/info')">
<image src="https://occupationlab.com/images/preschoolEdu/icon12.png" />
<view class="text ell">信息维护</view>
</li>
<li v-if="isPreschool" @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon15.png" />
<view class="text ell">我要采购</view>
</li>
<li @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon13.png" />
<view class="text ell">对账管理</view>
</li>
<template v-if="isSupplier">
<li @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon14.png" />
<view class="text ell">商机线索</view>
</li>
<li @click="tips">
<image src="https://occupationlab.com/images/preschoolEdu/icon15.png" />
<view class="text ell">发票管理</view>
</li>
</template>
</ul>
</view>
<view class="list">
<view class="item" @click="toPage(`/team/setting/setting`)">
<view class="left">
<image class="icon" src="https://occupationlab.com/images/preschoolEdu/setting.png" mode=""></image>
<text class="name">设置</text>
</view>
</view>
</view>
</view>
<view v-if="!per" class="per-mask">功能升级中,敬请期待...</view>
</view>
</template>
<script>
import { getTeamsByPlatformId } from '@/apis/modules/parner.js'
import { authenticationOrNot, updateAvatars } from '@/apis/modules/user.js'
import OSS from '@/libs/Oss/upload'
export default {
data() {
return {
per: true, // 是否有权限
teamId: uni.getStorageSync('teamId') || '',
platformId: uni.getStorageSync('platformId'),
teams: [],
info: {},
// avatar: uni.getStorageSync('avatar') || '@/static/image/avatar.png',
avatar: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
userName: uni.getStorageSync('userName'),
hasOwnTeam: 0, // 有自己的团队
disabled: true,
isAuth: false,
headerTop: 0
}
},
computed: {
// 幼儿园
isPreschool() {
return this.platformId === 5
},
// 供应商
isSupplier() {
return this.platformId === 6
},
// 平台名字
platformName() {
return this.platformId === 6 ? '供应商' : this.platformId === 5 ? '幼儿园' : ''
},
},
onShow() {
this.headerTop = uni.getMenuButtonBoundingClientRect().top + 8 + 'px'
this.per = true
this.getAuthOrNot()
this.platformId === 7 || this.getTeams()
},
methods: {
// 初始化权限
initRole() {
if (!uni.getStorageSync('auth').includes('我的')) {
this.per = false
} else {
this.getInfo()
}
},
// 实名认证状态
async getAuthOrNot() {
const res = await authenticationOrNot()
if (res.authenticationInformation) {
this.isAuth = true
this.info = res.authenticationInformation
}
},
// 获取团队信息
async getTeams() {
const { data } = await getTeamsByPlatformId({platformId: this.platformId})
data.map(e => {
const n = e.platformTeamClassificationList
e.id = n.id
// parnerId是商务经理id,teamId则是下面这个,其他地方要用的话直接uni.getStorageSync('team').partnerId去使用
e.teamId = e.isTeam === '1' ? +e.classificationId : n.id
e.classificationName = n.classificationName
delete e.platformTeamClassificationList
})
if (data.length) {
/**
* @description 如果是第一次进,则默认选中第一个团队,并把该团队的信息存入缓存
* 或者团队列表里没有该id,则说明超管已经被转让,也需要重新选中团队
*/
if (!uni.getStorageSync('team') || !data.find(e => e.teamId == this.teamId)) {
this.teamId = data[0].teamId
uni.setStorageSync('teamId', data[0].teamId)
uni.setStorageSync('team', data[0])
}
}
this.teams = data
},
// 团队选择回调
teamChange() {
const { teamId } = this
const e = this.teams.find(e => e.teamId == teamId)
uni.setStorageSync('team', e)
uni.setStorageSync('teamId', teamId)
},
// 获取个人信息
getInfo() {
const { partnerId, teamId } = uni.getStorageSync('team')
my({
partnerId,
teamId
}).then(({ my }) => {
this.my = my
const avatar = my.info.userAvatars || 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png'
this.avatar = avatar
uni.setStorageSync('avatar', avatar)
}).catch(e => {})
},
// 上传头像回调
onChooseAvatar(e) {
OSS(e.detail.avatarUrl, (name) => {
updateAvatars(name).then(res => {
// this.getInfo()
}).catch(e => {})
})
// uni.uploadFile({
// url: 'https://huorantech.cn/nakadai/nakadai/oss/fileUpload',
// filePath: e.detail.avatarUrl,
// name: 'file',
// header: {
// token: uni.getStorageSync('token'),
// },
// formData: {},
// success: ({ data }) => {
// updateAvatars(JSON.parse(data).filesResult.fileUrl).then(res => {
// this.getInfo()
// }).catch(e => {})
// }
// })
},
toPage(href) {
this.$util.to(href)
},
// 跳转实名认证
toAuth() {
this.isAuth || this.toPage('/team/personAuth/personAuth')
},
// 提示暂未开放
tips() {
this.$util.errMsg('功能暂未开放!')
}
}
}
</script>
<style scoped lang="scss">
.bg {
width: 100%;
height: calc(var(--status-bar-height) + 500rpx);
}
.team-wrap {
margin: -560rpx 30rpx 30rpx;
}
.team {
position: relative;
width: 300rpx;
/deep/.selected-item text {
font-size: 30rpx;
font-weight: 600;
color: #5f5f5f;
}
}
.wrap {
position: relative;
padding: 0 24rpx 24rpx;
}
.block {
padding: 24rpx;
margin-left: 0;
margin-right: 0;
.title {
margin-bottom: 20rpx;
font-size: 28rpx;
font-weight: 600;
}
}
.info {
display: flex;
align-items: flex-start;
padding: 26rpx 0;
.avatar-btn {
padding: 0;
margin: 0 28rpx 0 0;
line-height: 0;
border: 0 !important;
background-color: transparent;
outline: none;
border-radius: 50%;
}
.avatar {
width: 100rpx;
height: 100rpx;
border: 0;
}
.text {
margin-right: 20rpx;
}
.name {
margin-bottom: 10rpx;
font-size: 32rpx;
font-weight: 600;
color: #333;
}
.phone {
font-size: 26rpx;
color: #5d5d5d;
}
.auth {
display: inline-flex;
align-items: center;
padding: 4rpx 16rpx;
font-size: 24rpx;
color: $uni-primary;
border: 1px solid #8ca5eb;
border-radius: 20px;
.icon {
color: $uni-primary;
}
}
.tag {
padding: 8rpx 16rpx;
margin-top: -50rpx;
font-size: 24rpx;
color: #fff;
background-color: $uni-primary;
border-radius: 20px;
}
}
.func {
display: flex;
flex-wrap: wrap;
margin-top: 15rpx;
li {
width: 25%;
margin-bottom: 30rpx;
text-align: center;
&:last-child {
image {
width: 50rpx;
height: 50rpx;
}
}
}
image {
width: 60rpx;
height: 60rpx;
}
.text {
width: 165rpx;
margin: 0 auto;
font-size: 24rpx;
color: #333;
}
}
.identity {
display: flex;
justify-content: space-between;
align-items: center;
.title {
margin-bottom: 0;
}
.badge {
padding: 8rpx 16rpx;
font-size: 24rpx;
color: #fff;
background-color: #37cc07;
border-radius: 10px;
}
.auth {
font-size: 24rpx;
color: #9c9c9c;
}
}
.identity-bg {
position: relative;
margin: 20rpx 0 50rpx;
.pic {
width: 100%;
}
.open {
position: absolute;
top: 50rpx;
right: 20rpx;
display: flex;
align-items: center;
padding: 8rpx 14rpx;
font-size: 22rpx;
color: #c5530d;
background-color: #f9cf9d;
border-radius: 20px;
}
}
.list {
margin-top: 16rpx;
.item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 26rpx 28rpx;
margin-bottom: 16rpx;
background-color: #fff;
border-radius: 16rpx;
}
.left {
display: inline-flex;
align-items: center;
}
.icon {
width: 40rpx;
height: 40rpx;
margin-right: 16rpx;
}
text {
font-size: 28rpx;
color: #333;
}
}
.types {
margin: 30rpx 0;
font-size: 24rpx;
color: #fff;
text-align: center;
.item {
display: flex;
justify-content: space-between;
align-items: center;
height: 150rpx;
padding: 0 50rpx;
border-radius: 12px;
background: url('https://occupationlab.com/images/preschoolEdu/role-bg1.png') 0 0/100% 100% no-repeat;
box-sizing: border-box;
}
.left {
display: inline-flex;
align-items: center;
}
.icon {
display: inline-flex;
justify-content: center;
align-items: center;
padding: 10rpx;
margin-right: 20rpx;
background-color: #fff7f1;
border-radius: 50%;
}
.img {
width: 80rpx;
}
.text {
font-size: 24rpx;
color: #fff;
}
.item2 {
background-image: url('https://occupationlab.com/images/preschoolEdu/role-bg2.png');
}
.item3 {
background: #ffb150;
.img {
width: 70rpx;
}
}
.btn {
padding: 8rpx 16rpx;
font-size: 24rpx;
color: #c5530d;
background-color: #f9cf9d;
border-radius: 8px;
}
}
</style>