|
|
|
<template>
|
|
|
|
<view class="page">
|
|
|
|
<view class="status-bar"></view>
|
|
|
|
<image class="bg" src="@/static/image/person-bg.png"></image>
|
|
|
|
<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">{{ my.info.userName }}</view>
|
|
|
|
<view class="phone">{{ my.info.phone }}</view>
|
|
|
|
</view>
|
|
|
|
<view v-if="!disabled" class="tag">团队负责人</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="block">
|
|
|
|
<view class="title">基础功能</view>
|
|
|
|
|
|
|
|
<ul class="func">
|
|
|
|
<li @click="toPage('')">
|
|
|
|
<view class="icon">
|
|
|
|
<image src="@/static/image/info-bg.jpg"></image>
|
|
|
|
</view>
|
|
|
|
<view class="text ell">我的电子券</view>
|
|
|
|
</li>
|
|
|
|
<li @click="tips">
|
|
|
|
<view class="icon">
|
|
|
|
<image src="@/static/image/info-bg.jpg"></image>
|
|
|
|
</view>
|
|
|
|
<view class="text ell">我的关注</view>
|
|
|
|
</li>
|
|
|
|
<li @click="toPage('')">
|
|
|
|
<view class="icon">
|
|
|
|
<image src="@/static/image/info-bg.jpg"></image>
|
|
|
|
</view>
|
|
|
|
<view class="text ell">已报名活动</view>
|
|
|
|
</li>
|
|
|
|
<li @click="tips">
|
|
|
|
<view class="icon">
|
|
|
|
<image src="@/static/image/info-bg.jpg"></image>
|
|
|
|
</view>
|
|
|
|
<view class="text ell">我的发票</view>
|
|
|
|
</li>
|
|
|
|
<li @click="tips">
|
|
|
|
<view class="icon">
|
|
|
|
<image src="@/static/image/info-bg.jpg"></image>
|
|
|
|
</view>
|
|
|
|
<view class="text ell">我的订单</view>
|
|
|
|
</li>
|
|
|
|
<li @click="tips">
|
|
|
|
<view class="icon">
|
|
|
|
<image src="@/static/image/info-bg.jpg"></image>
|
|
|
|
</view>
|
|
|
|
<view class="text ell">发布采购</view>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="block">
|
|
|
|
<view class="supplier">
|
|
|
|
<view class="title">我是供应商</view>
|
|
|
|
<view class="badge">供应商负责人</view>
|
|
|
|
<view class="auth">未认证</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<view class="block">
|
|
|
|
<view class="title">工作台</view>
|
|
|
|
|
|
|
|
<ul class="func">
|
|
|
|
<li @click="toPage('')">
|
|
|
|
<view class="icon">
|
|
|
|
<image src="@/static/image/info-bg.jpg"></image>
|
|
|
|
</view>
|
|
|
|
<view class="text ell">供应商认证</view>
|
|
|
|
</li>
|
|
|
|
<li @click="tips">
|
|
|
|
<view class="icon">
|
|
|
|
<image src="@/static/image/info-bg.jpg"></image>
|
|
|
|
</view>
|
|
|
|
<view class="text ell">商品管理</view>
|
|
|
|
</li>
|
|
|
|
<li @click="toPage('/team/teams/teams')">
|
|
|
|
<view class="icon">
|
|
|
|
<image src="@/static/image/info-bg.jpg"></image>
|
|
|
|
</view>
|
|
|
|
<view class="text ell">团队管理</view>
|
|
|
|
</li>
|
|
|
|
<li @click="tips">
|
|
|
|
<view class="icon">
|
|
|
|
<image src="@/static/image/info-bg.jpg"></image>
|
|
|
|
</view>
|
|
|
|
<view class="text ell">订单管理</view>
|
|
|
|
</li>
|
|
|
|
<li @click="tips">
|
|
|
|
<view class="icon">
|
|
|
|
<image src="@/static/image/info-bg.jpg"></image>
|
|
|
|
</view>
|
|
|
|
<view class="text ell">活动管理</view>
|
|
|
|
</li>
|
|
|
|
<li @click="toPage('/team/info/info')">
|
|
|
|
<view class="icon">
|
|
|
|
<image src="@/static/image/info-bg.jpg"></image>
|
|
|
|
</view>
|
|
|
|
<view class="text ell">信息维护</view>
|
|
|
|
</li>
|
|
|
|
<li @click="tips">
|
|
|
|
<view class="icon">
|
|
|
|
<image src="@/static/image/info-bg.jpg"></image>
|
|
|
|
</view>
|
|
|
|
<view class="text ell">对账管理</view>
|
|
|
|
</li>
|
|
|
|
<li @click="tips">
|
|
|
|
<view class="icon">
|
|
|
|
<image src="@/static/image/info-bg.jpg"></image>
|
|
|
|
</view>
|
|
|
|
<view class="text ell">商机线索</view>
|
|
|
|
</li>
|
|
|
|
<li @click="tips">
|
|
|
|
<view class="icon">
|
|
|
|
<image src="@/static/image/info-bg.jpg"></image>
|
|
|
|
</view>
|
|
|
|
<view class="text ell">发票管理</view>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="list">
|
|
|
|
<view class="item" @click="toPage(`/team/setting/setting`)">
|
|
|
|
<view class="left">
|
|
|
|
<image class="icon" src="@/static/image/person3.png" mode=""></image>
|
|
|
|
<text class="name">设置</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view v-if="!per" class="per-mask">功能升级中,敬请期待...</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { my, editProvinceCity } from '@/apis/modules/parner.js'
|
|
|
|
import { queryProvince, queryCity, updateAvatars, getUserRolesPermissionMenu } from '@/apis/modules/user.js'
|
|
|
|
import { getTeamsByAccountId } from '@/apis/modules/client.js'
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
per: true, // 是否有权限
|
|
|
|
teamId: uni.getStorageSync('teamId') || '',
|
|
|
|
teams: [],
|
|
|
|
my: {
|
|
|
|
info: {
|
|
|
|
phone: ''
|
|
|
|
},
|
|
|
|
teamInfo: {
|
|
|
|
annualMarketingFee: '',
|
|
|
|
annualTeamFee: '',
|
|
|
|
},
|
|
|
|
myIncome: 0,
|
|
|
|
teamIncome: 0
|
|
|
|
},
|
|
|
|
avatar: uni.getStorageSync('avatar') || '@/static/image/avatar.png',
|
|
|
|
userName: uni.getStorageSync('userName'),
|
|
|
|
hasOwnTeam: 0, // 有自己的团队
|
|
|
|
disabled: true,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
this.per = true
|
|
|
|
this.getTeam()
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
// 初始化权限
|
|
|
|
initRole() {
|
|
|
|
if (!uni.getStorageSync('auth').includes('我的')) {
|
|
|
|
this.per = false
|
|
|
|
} else {
|
|
|
|
this.getInfo()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 查询当前角色权限
|
|
|
|
getAuth() {
|
|
|
|
uni.showLoading({
|
|
|
|
title: '加载中'
|
|
|
|
})
|
|
|
|
getUserRolesPermissionMenu({
|
|
|
|
teamId: this.teams.find(e => e.teamId == this.teamId).partnerClassificationId,
|
|
|
|
platformId: 4
|
|
|
|
}).then(({ permissionMenu }) => {
|
|
|
|
uni.hideLoading()
|
|
|
|
const auth = []
|
|
|
|
// 生成权限数组
|
|
|
|
const generateAuth = (list, parent) => {
|
|
|
|
list.map(e => {
|
|
|
|
const name = `${parent ? parent + ':' : ''}${e.name}`
|
|
|
|
auth.push(name)
|
|
|
|
generateAuth(e.children, name)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
generateAuth(permissionMenu[0].children, '')
|
|
|
|
uni.setStorageSync('auth', auth)
|
|
|
|
this.initRole()
|
|
|
|
}).catch(e => {
|
|
|
|
uni.hideLoading()
|
|
|
|
uni.setStorageSync('auth', [])
|
|
|
|
this.initRole()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 获取团队
|
|
|
|
getTeam() {
|
|
|
|
uni.showLoading({
|
|
|
|
title: '加载中'
|
|
|
|
})
|
|
|
|
getTeamsByAccountId().then(({ data }) => {
|
|
|
|
let hasOwnTeam = 0 // 是否有自己的团队
|
|
|
|
data.map(e => {
|
|
|
|
const n = e.partnerClassificationList
|
|
|
|
e.id = n.id
|
|
|
|
// parnerId是商务经理id,teamId则是下面这个,其他地方要用的话直接uni.getStorageSync('team').partnerId去使用
|
|
|
|
e.teamId = e.isTeam == 1 ? +e.partnerClassificationId : n.id
|
|
|
|
e.partnerClassificationName = n.partnerClassificationName
|
|
|
|
delete e.partnerClassificationList
|
|
|
|
if (e.isTeam == 1) hasOwnTeam = 1
|
|
|
|
})
|
|
|
|
this.hasOwnTeam = hasOwnTeam
|
|
|
|
const teamId = uni.getStorageSync('teamId')
|
|
|
|
if (data.length) {
|
|
|
|
/**
|
|
|
|
* @description 如果是第一次进,则默认选中第一个团队,并把该团队的信息存入缓存
|
|
|
|
* 或者团队列表里没有该id,则说明超管已经被转让,也需要重新选中团队
|
|
|
|
*/
|
|
|
|
const curTeam = data.find(e => e.teamId == teamId)
|
|
|
|
if (teamId && curTeam) {
|
|
|
|
uni.setStorageSync('team', curTeam)
|
|
|
|
} else if (!uni.getStorageSync('team') || !curTeam) {
|
|
|
|
this.teamId = data[0].teamId
|
|
|
|
uni.setStorageSync('teamId', data[0].teamId)
|
|
|
|
uni.setStorageSync('team', data[0])
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// 如果没有团队,则退出登录
|
|
|
|
uni.hideLoading()
|
|
|
|
uni.clearStorageSync()
|
|
|
|
uni.navigateTo({
|
|
|
|
url: '../login/login'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
this.disabled = uni.getStorageSync('team').isTeam == 0 // 成员不能改省份城市
|
|
|
|
this.teams = data
|
|
|
|
this.getAuth()
|
|
|
|
}).catch(e => {
|
|
|
|
uni.hideLoading()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 获取个人信息
|
|
|
|
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)
|
|
|
|
this.provinceId = my.teamInfo.provinceId
|
|
|
|
this.cityId = my.teamInfo.cityId
|
|
|
|
uni.setStorageSync('provinceId', this.provinceId)
|
|
|
|
uni.setStorageSync('cityId', this.cityId)
|
|
|
|
this.getProvince()
|
|
|
|
this.provinceId && this.getCity()
|
|
|
|
}).catch(e => {})
|
|
|
|
},
|
|
|
|
// 上传头像回调
|
|
|
|
onChooseAvatar(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 => {})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 创建自己的团队
|
|
|
|
createTeam() {
|
|
|
|
this.$util.to(`../reg/reg?openid=${uni.getStorageSync('openid')}&phone=${this.my.info.phone}&my=1`)
|
|
|
|
},
|
|
|
|
toPage(href) {
|
|
|
|
this.$util.to(href)
|
|
|
|
},
|
|
|
|
// 提示暂未开放
|
|
|
|
tips() {
|
|
|
|
this.$util.errMsg('功能暂未开放!')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.bg {
|
|
|
|
width: 100%;
|
|
|
|
height: calc(var(--status-bar-height) + 317rpx);
|
|
|
|
}
|
|
|
|
.wrap {
|
|
|
|
position: relative;
|
|
|
|
padding: 0 24rpx 24rpx;
|
|
|
|
margin-top: -150rpx;
|
|
|
|
}
|
|
|
|
.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 34rpx;
|
|
|
|
background-color: #fff;
|
|
|
|
border-radius: 16rpx;
|
|
|
|
.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: 120rpx;
|
|
|
|
height: 120rpx;
|
|
|
|
border: 0;
|
|
|
|
}
|
|
|
|
.text {
|
|
|
|
margin-right: 20rpx;
|
|
|
|
}
|
|
|
|
.name {
|
|
|
|
margin-bottom: 10rpx;
|
|
|
|
font-size: 40rpx;
|
|
|
|
color: #333;
|
|
|
|
}
|
|
|
|
.phone {
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #333;
|
|
|
|
}
|
|
|
|
.tag {
|
|
|
|
padding: 8rpx 16rpx;
|
|
|
|
margin-top: -50rpx;
|
|
|
|
font-size: 24rpx;
|
|
|
|
color: #fff;
|
|
|
|
background-color: #2979ff;
|
|
|
|
border-radius: 20px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.func {
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
li {
|
|
|
|
width: 25%;
|
|
|
|
margin-bottom: 24rpx;
|
|
|
|
text-align: center;
|
|
|
|
&:last-child {
|
|
|
|
image {
|
|
|
|
width: 50rpx;
|
|
|
|
height: 50rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.icon {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
width: 90rpx;
|
|
|
|
height: 90rpx;
|
|
|
|
margin: 0 auto 18rpx;
|
|
|
|
background-color: rgb(228,239,255);
|
|
|
|
border-radius: 50%;
|
|
|
|
}
|
|
|
|
image {
|
|
|
|
width: 60rpx;
|
|
|
|
height: 60rpx;
|
|
|
|
}
|
|
|
|
.text {
|
|
|
|
width: 165rpx;
|
|
|
|
margin: 0 auto;
|
|
|
|
font-size: 24rpx;
|
|
|
|
color: #333;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.supplier {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.location {
|
|
|
|
margin-top: 30rpx;
|
|
|
|
}
|
|
|
|
.picker-wrap {
|
|
|
|
margin-top: 4px;
|
|
|
|
}
|
|
|
|
.name {
|
|
|
|
font-size: 24rpx;
|
|
|
|
}
|
|
|
|
</style>
|