<template> <view class="page"> <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> <view class="list"> <view v-if="auth('我的:我的团队')" class="item" @click="$util.to('/team/teams/teams')"> <view class="left"> <image class="icon" src="@/static/image/person4.png" mode=""></image> <text class="name">我的团队</text> </view> <uni-icons type="right" size="15" color="#ccc"></uni-icons> </view> <view v-if="auth('我的:团队收益')" class="item"> <view class="left"> <image class="icon" src="@/static/image/person2.png" mode=""></image> <text class="name">团队收益</text> </view> <text class="val">{{ my.teamIncome }}元</text> </view> <view v-if="auth('我的:我的项目收益')" class="item"> <view class="left"> <image class="icon" src="@/static/image/person1.png" mode=""></image> <text class="name">我的项目收益</text> </view> <text class="val">{{ my.myIncome }}元</text> </view> <!-- <view class="item"> <view class="left"> <image class="icon" src="@/static/image/person5.png" mode=""></image> <text class="name">我的收藏</text> </view> </view> --> <view v-if="auth('我的:市场服务费')" class="item"> <view class="left"> <image class="icon" src="@/static/image/person26.png" mode=""></image> <text class="name">市场服务费:</text> </view> <text class="val">{{ my.teamInfo.annualMarketingFee ? '项目抽成' + my.teamInfo.annualMarketingFee + '%' :'-' }}</text> </view> <view v-if="auth('我的:团队年费')" class="item"> <view class="left"> <image class="icon" src="@/static/image/person27.png" mode=""></image> <text class="name">团队年费:</text> </view> <text class="val">{{ my.teamInfo.annualTeamFee ? '固定年费' + my.teamInfo.annualTeamFee + 'w' : '-' }}</text> </view> <view v-if="auth('我的:业务省份')" class="item"> <view class="left"> <image class="icon" src="@/static/image/person8.png" mode=""></image> <text class="name">业务省份</text> </view> <view class="val"> <text v-if="disabled" class="name">{{ provinceName }}</text> <uni-data-picker v-else class="picker-input" :clear-icon="false" :readonly="disabled" placeholder="请选择省份" popup-title="请选择省份" preload :localdata="provinces" :map="{text: 'provinceName', value: 'provinceId'}" v-model="provinceId" @change="getCity"></uni-data-picker> </view> </view> <view v-if="auth('我的:业务城市')" class="item"> <view class="left"> <image class="icon" src="@/static/image/person9.png" mode=""></image> <text class="name">业务城市</text> </view> <view class="val"> <text v-if="disabled" class="name">{{ cityName }}</text> <uni-data-picker v-else class="picker-input" :clear-icon="false" :readonly="disabled" placeholder="请选择城市" popup-title="请选择城市" preload :localdata="cities" :map="{text: 'cityName', value: 'cityId'}" v-model="cityId" @change="submit"></uni-data-picker> </view> </view> <view v-if="auth('我的:设置')" class="item" @click="toSet"> <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 } from '@/apis/modules/user.js' export default { data() { return { per: true, // 是否有权限 my: { info: { phone: '' }, teamInfo: { annualMarketingFee: '', annualTeamFee: '', }, myIncome: 0, teamIncome: 0 }, avatar: uni.getStorageSync('avatar') || '@/static/image/avatar.png', userName: uni.getStorageSync('userName'), disabled: true, provinces: [], cities: [], provinceIcon: { color: '#007eff', size: '22', type: 'location' }, cityIcon: { color: '#007eff', size: '22', type: 'map-pin-ellipse' }, provinceId: '', cityId: '', provinceName: '', cityName: '' } }, onShow() { console.log(11, uni.getStorageSync('avatar')) this.per = true this.initRole() this.disabled = uni.getStorageSync('team').isTeam == 0 // 成员不能改省份城市 }, methods: { // 初始化权限 initRole() { if (!uni.getStorageSync('auth').includes('我的')) { this.per = false } else { this.getInfo() } }, // 获取个人信息 getInfo() { const { partnerId, teamId } = uni.getStorageSync('team') my({ partnerId, teamId }).then(({ my }) => { this.my = my this.avatar = my.info.userAvatars uni.setStorageSync('avatar', my.info.userAvatars) 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 => {}) } }) }, // 进入设置 toSet() { this.$util.to(`/team/setting/setting`) }, // 获取省份 getProvince() { queryProvince().then(({ list }) => { if (this.disabled) { const { provinceId } = this this.provinceName = list.find(e => e.provinceId == provinceId).provinceName } else { this.provinces = list } }).catch(res => {}) }, // 获取城市 getCity(val) { if (this.provinceId) { queryCity({ provinceId: this.provinceId }).then(({ list }) => { if (this.disabled) { const { cityId } = this this.cityName = list.find(e => e.cityId == cityId).cityName } else { this.cities = list } }).catch(res => {}) } else { this.cities = [] } if (val) this.cityId = '' }, // 更改意向城市 submit() { const { partnerId, teamId } = uni.getStorageSync('team') editProvinceCity({ provinceId: this.provinceId, cityId: this.cityId, classificationId: teamId, partnerId }).then(({ my }) => { this.$util.sucMsg('修改成功') }).catch(e => {}) }, } } </script> <style scoped lang="scss"> .bg { width: 100%; height: 300rpx; } .wrap { position: relative; padding: 0 24rpx; margin-top: -150rpx; } .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; } .name { margin-bottom: 10rpx; font-size: 40rpx; color: #333; } .phone { font-size: 28rpx; color: #333; } } .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: 48rpx; height: 48rpx; margin-right: 16rpx; } text { font-size: 28rpx; color: #333; } } .location { margin-top: 30rpx; } .picker-wrap { margin-top: 4px; } .name { font-size: 24rpx; } </style>