幼教产品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.
 
 
 
 

608 lines
17 KiB

<template>
<view class="page">
<view class="status-bar"></view>
<image class="bg" src="http://124.71.79.122/images/miniProgram/person-bg.png" />
<view class="team-wrap" :style="{paddingTop: headerTop}">
<view v-if="platformId !== 7 && teams.length > 1" class="team">
<uni-data-picker class="picker-input" placeholder="切换团队" popup-title="切换团队" preload :clear-icon="false" :localdata="teams" :map="{text: 'organizationName', 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="info.userAvatars" mode=""></image>
</button>
<view>
<view class="person">
<view class="name">{{ info.userName || userName }}</view>
<view class="auth" @click="toAuth">
{{ info.authentication }}
<uni-icons class="icon" type="right" size="16" color="#4876f9"></uni-icons>
</view>
</view>
<view class="phone">{{ curTeam.organizationName }}</view>
</view>
</view>
<view class="block" style="padding-bottom: 0;">
<view class="title">基础功能</view>
<ul class="func">
<li @click="toPage('/other/vouchers/vouchers')">
<image src="http://124.71.79.122/images/miniProgram/icon1.png" />
<view class="text ell">我的电子券</view>
</li>
<li @click="toPage('/other/follow/follow')">
<image src="http://124.71.79.122/images/miniProgram/icon2.png" />
<view class="text ell">我的关注</view>
</li>
<li @click="toPage('/other/registeredActivity/registeredActivity')">
<image src="http://124.71.79.122/images/miniProgram/icon3.png" />
<view class="text ell">已报名活动</view>
</li>
<!-- <li @click="tips">
<image src="http://124.71.79.122/images/miniProgram/icon4.png" />
<view class="text ell">我的发票</view>
</li> -->
<li v-if="!isSupplier" @click="toPage('/other/procure/procure')">
<image src="http://124.71.79.122/images/miniProgram/icon5.png" />
<view class="text ell">我的采购</view>
</li>
<li @click="tips">
<image src="http://124.71.79.122/images/miniProgram/icon6.png" />
<view class="text ell">发布采购</view>
</li>
</ul>
</view>
<template v-if="platformId === 7">
<view class="types" @click="toEnterAuth(6)">
<view class="item">
<view class="left">
<view class="icon">
<image class="img" src="http://124.71.79.122/images/miniProgram/role-icon2.png" mode="widthFix" />
</view>
<view class="text">我是供应商</view>
</view>
<view class="btn">供应商认证</view>
</view>
</view>
<view class="types" @click="toEnterAuth(5)">
<view class="item item2">
<view class="left">
<view class="icon">
<image class="img" src="http://124.71.79.122/images/miniProgram/role-icon1.png" mode="widthFix" />
</view>
<view class="text">我是幼儿园</view>
</view>
<view class="btn">幼儿园认证</view>
</view>
</view>
</template>
<view v-else class="block" style="padding-bottom: 0;">
<view class="identity">
<view class="left">
<view class="title">我是{{ platformName }}</view>
<view v-if="!isMember" class="badge">{{ platformName }}负责人</view>
</view>
<view class="auth" @click="toEnterAuth(platformId)">
{{ curTeam.authentication }}
<uni-icons class="icon" type="right" size="16" color="#fd9413"></uni-icons>
</view>
</view>
<view class="identity-bg">
<image v-if="isPreschool" class="pic" src="http://124.71.79.122/images/miniProgram/preschool1.png" mode="widthFix" />
<image v-else class="pic" src="http://124.71.79.122/images/miniProgram/supplier1.png" mode="widthFix" />
<view class="open">
立即开通
<uni-icons class="icon" type="right" size="12" color="#c5530d"></uni-icons>
</view>
</view>
<ul class="func">
<li @click="toEnterAuth(platformId)">
<image src="http://124.71.79.122/images/miniProgram/icon7.png" />
<view class="text ell">{{ platformName }}认证</view>
</li>
<li v-if="isSupplier" @click="toPage('/other/goods/goods')">
<image src="http://124.71.79.122/images/miniProgram/icon8.png" />
<view class="text ell">商品管理</view>
</li>
<li @click="toPage('/team/teams/teams')">
<image src="http://124.71.79.122/images/miniProgram/icon9.png" />
<view class="text ell">团队管理</view>
</li>
<!-- <li @click="tips">
<image src="http://124.71.79.122/images/miniProgram/icon10.png" />
<view class="text ell">{{ isSupplier ? '订单管理' : '我的订单' }}</view>
</li> -->
<li v-if="isSupplier" @click="tips">
<image src="http://124.71.79.122/images/miniProgram/icon11.png" />
<view class="text ell">活动管理</view>
</li>
<li @click="toPage('/team/info/info')">
<image src="http://124.71.79.122/images/miniProgram/icon12.png" />
<view class="text ell">信息维护</view>
</li>
<li v-if="isPreschool" @click="tips">
<image src="http://124.71.79.122/images/miniProgram/icon15.png" />
<view class="text ell">我要采购</view>
</li>
<template v-if="isSupplier">
<li @click="toPage('/other/clue/clue')">
<image src="http://124.71.79.122/images/miniProgram/icon14.png" />
<view class="text ell">商机线索</view>
</li>
<!-- <li @click="tips">
<image src="http://124.71.79.122/images/miniProgram/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="http://124.71.79.122/images/miniProgram/setting.png" mode=""></image>
<text class="name">设置</text>
</view>
</view>
</view>
</view>
<view v-if="!per" class="per-mask">功能升级中,敬请期待...</view>
</view>
</template>
<script>
import { viewUserDetails, enterpriseCertificationStatus, updateAvatars } from '@/apis/modules/user.js'
import OSS from '@/libs/Oss/upload'
import Common from '@/config/common'
export default {
data() {
return {
per: true, // 是否有权限
teamId: uni.getStorageSync('teamId') || '',
platformId: uni.getStorageSync('platformId'),
openId: uni.getStorageSync('openId'),
userName: uni.getStorageSync('userName'),
curTeam: {
authentication: '',
organizationName: '',
},
teams: [],
info: {
authentication: ''
},
enterInfo: {},
headerTop: 0,
isMember: true, // 成员标识
curAccount: {
account: ''
},
enterDisabled: 0
}
},
computed: {
// 幼儿园
isPreschool() {
return this.platformId === 5
},
// 供应商
isSupplier() {
return this.platformId === 6
},
// 平台名字
platformName() {
return this.platformId === 6 ? '供应商' : this.platformId === 5 ? '幼儿园' : ''
},
},
onShow() {
// #ifdef MP-WEIXIN
this.headerTop = uni.getMenuButtonBoundingClientRect().top + 8 + 'px'
// #endif
this.platformId = uni.getStorageSync('platformId')
this.per = true
this.enterInfo = {}
this.enterDisabled = 0
this.getInfo()
this.getEnterInfo()
},
methods: {
// 个人信息
async getInfo() {
const { result } = await viewUserDetails({
openId: this.openId
})
// status为true,说明用户被删除了,则退出登录
if (result.status === true) {
this.$util.errMsg(result.message)
setTimeout(() => {
uni.clearStorageSync()
this.$util.to('/pages/login/login')
}, 1500)
return false
}
this.enterDisabled = 0
if (result.hrUserInfo) {
if (!result.hrUserInfo.userAvatars) result.hrUserInfo.userAvatars = Common.avatar // 没有头像则显示默认头像
this.info = result.hrUserInfo
}
// 团队信息
const org = result.organizationInfoList.filter(e => !e.isEnable)
if (org && org.length) {
if (org.length) {
/**
* @description 如果是第一次进,则默认选中第一个团队,并把该团队的信息存入缓存
* 或者团队列表里没有该id,则说明超管已经被转让,也需要重新选中团队
*/
if (!uni.getStorageSync('team') || !org.find(e => e.teamId == this.teamId)) {
this.teamId = org[0].teamId
uni.setStorageSync('teamId', org[0].teamId)
uni.setStorageSync('team', org[0])
this.curTeam = org[0]
} else {
this.curTeam = org.find(e => e.teamId == this.teamId)
}
}
this.isMember = uni.getStorageSync('team').isTeam == 0 // 成员
this.teams = org
} else {
this.curTeam = {
organizationName: this.info.phone
}
}
// userAccountList里有两个身份,则显示企业的名字,否则显示个人姓名
const accountList = result.userAccountList
if (accountList && accountList.length) {
const enter = accountList.find(e => e.platformId !== '7' && e.isEnable) // 启用了的企业身份
this.curAccount = enter || accountList[0]
// 当前是个人身份,但是查询到了还有启用了的企业身份,则自动切换到企业身份
if (enter) {
const platformId = +enter.platformId
uni.setStorageSync('platformId', platformId)
this.platformId = platformId
} else {
// 如果没有企业的身份,则重置身份为个人
if (accountList.find(e => e.platformId !== '7' && !e.isEnable)) this.enterDisabled = 1 // 有被禁用的企业身份,点击企业认证的时候不能认证
uni.setStorageSync('platformId', 7)
this.platformId = 7
}
// 如果当前登录的企业身份被禁用了(isEnable=0), 则切换到另一个没被禁用的身份;如果两个身份都被禁用了,则退出登录
const curRole = accountList.find(e => e.platformId == this.platformId)
if (this.platformId !== 7 && curRole && !curRole.isEnable) {
const people = accountList.find(e => e.platformId == '7') // 个人
// 个人的身份如果没被禁用,则切换到个人
if (people && people.isEnable) {
uni.setStorageSync('platformId', 7)
this.platformId = 7
this.curAccount = people
} else {
// 个人的身份也被禁用了,退出登录
this.$util.errMsg(`您已被当前组织移除,请重新登录!`)
setTimeout(() => {
uni.clearStorageSync()
this.$util.to('/pages/login/login')
}, 1500)
return false
}
}
}
// this.platformId !== 7 && this.getTeams()
},
// 企业认证信息
async getEnterInfo() {
const { data } = await enterpriseCertificationStatus(this.openId)
if (data) {
this.enterInfo = data
}
},
// 团队选择回调
teamChange() {
const { teamId } = this
const e = this.teams.find(e => e.teamId == teamId)
this.curTeam = e
this.isMember = e.isTeam == 0
uni.setStorageSync('team', e)
uni.setStorageSync('teamId', teamId)
},
// 上传头像回调
onChooseAvatar(e) {
OSS(e.detail.avatarUrl, ({ url }) => {
updateAvatars({
url,
userName: '',
openId: this.openId,
platformId: this.platformId,
}).then(res => {
this.getInfo()
}).catch(e => {})
})
},
toPage(href) {
this.$util.to(href)
},
// 跳转实名认证
toAuth() {
this.toPage(this.info.authentication === '已认证' ? '/team/rePersonAuth/rePersonAuth' : '/team/personAuth/personAuth')
},
// 跳转企业认证
toEnterAuth(platformId) {
if (this.enterDisabled) return this.$util.errMsg('您已认证为幼儿园,请勿重复认证!')
const { authenticationStatus, platformSource } = this.enterInfo
// 审核状态(0默认未提交 1.待审核,2.已通过,3.已驳回)
if (authenticationStatus === 1) {
if (platformSource != platformId) {
// 如果组织认证已经在审核中的,点击另外一个认证的,弹窗提示“您已提交我是供应商的认证,无法再提交幼儿园认证。
this.$util.errMsg(`您已提交我是${platformId === 5 ? '供应商' : '幼儿园'}的认证,无法再提交${platformId === 5 ? '幼儿园' : '供应商'}认证。`)
} else {
this.$util.errMsg('您已提交认证,请等待审核。')
}
} else {
this.$util.to(authenticationStatus === 2 ? '/team/certified/certified' : '/team/auth/auth?platformId=' + platformId)
}
},
// 提示暂未开放
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;
max-width: 70%;
/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: center;
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%;
&:after {
display: none;
}
}
.avatar {
width: 120rpx;
height: 120rpx;
border: 0;
}
.person {
display: flex;
align-items: center;
margin-bottom: 10rpx;
}
.name {
max-width: 49vw;
font-size: 36rpx;
font-weight: 600;
color: #333;
}
.phone {
font-size: 26rpx;
color: #5d5d5d;
}
.auth {
display: inline-flex;
align-items: center;
padding: 4rpx 16rpx;
margin-left: 20rpx;
font-size: 24rpx;
color: $uni-primary;
white-space: nowrap;
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;
li {
width: 25%;
margin-bottom: 30rpx;
text-align: center;
}
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;
.left {
display: inline-flex;
align-items: center;
}
.title {
margin-bottom: 0;
}
.badge {
padding: 8rpx 16rpx;
margin-left: 20rpx;
font-size: 24rpx;
color: #fff;
background-color: #37cc07;
border-radius: 10px;
}
.auth {
display: inline-flex;
align-items: center;
padding: 4rpx 16rpx;
margin-left: 20rpx;
font-size: 24rpx;
color: #fd9413;
white-space: nowrap;
border: 1px solid #ffb23e;
border-radius: 20px;
.icon {
color: #fd9413;
}
}
}
.company-name {
margin-top: 20rpx;
font-size: 24rpx;
color: #333;
}
.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('http://124.71.79.122/images/miniProgram/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('http://124.71.79.122/images/miniProgram/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>