123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- <template>
- <view class="container">
- <view class="topBox">
- <view class="userBox flex">
- <view class="userInfo flex_item" @click="navTo('/pageExpert/users/user_info/index')">
- <view class="avatarBox">
- <image class="avatar" :src="userInfo.avatar || '/static/error/missing-face.png'"></image>
- <view class="level">{{userInfo.Staff && userInfo.Staff.is_expert == 1?'合作专家':'普通用户'}}</view>
- </view>
- <view class="nameBox">
- <view class="name">{{userInfo.Staff && userInfo.Staff.staff_name || userInfo.real_name || userInfo.nickname}}</view>
- <view class="phone">{{userInfo.Staff && userInfo.Staff.phone || userInfo.phone}}</view>
- <!-- <view class="phone">所属门店:360健康旗舰店</view> -->
- </view>
- </view>
- <image v-if="hasSwitch == true" class="set" src="/static/image/set.png" @click="switchUser"></image>
- </view>
- <view class="flex statistic">
- <view class="statTpl bg1" @click="navTo('/pageExpert/wallet/wallet')">
- <view class="statName">我的健康米</view>
- <view class="statNum">{{userInfo.now_money | formatNumber }}</view>
- </view>
- <view class="statTpl bg2" @click="navTo('/pageExpert/users/promoter-list/index')">
- <view class="statName">我的推广</view>
- <view class="statNum">{{userInfo.spread_count }}</view>
- </view>
- </view>
- </view>
- <view class="list-box">
- <view class="user-list flex" @click="navTo('/pageExpert/users/user_spread_code/index')">
- <image src="/static/image/img24.png" mode="widthFix" class="left-img"></image>
- <view class="">邀请好友</view>
- <image src="/static/image/img28.png" mode="" class="right-img"></image>
- </view>
- <view class="user-list flex" @click="navTo('/pageExpert/user/statistics')">
- <image src="/static/work/img07.png" mode="widthFix" class="left-img"></image>
- <view class="">咨询统计</view>
- <image src="/static/image/img28.png" mode="" class="right-img"></image>
- </view>
- <!-- <view class="user-list flex" @click="callService">
- <image src="/static/image/img27.png" mode="widthFix" class="left-img"></image>
- <view class="">客服</view>
- <image src="/static/image/img28.png" mode="" class="right-img"></image>
- </view> -->
- </view>
- <!-- 切换账号身份 -->
- <u-action-sheet :show="showSwitch" :actions="actions" title="请选择切换身份" :description="description" @close="showSwitch = false" @select="switchSelect"></u-action-sheet>
- <pageFooter @newDataStatus="newDataStatus"></pageFooter>
- </view>
- </template>
- <script>
- import pageFooter from "../components/pageFooter/index.vue";
- import { getUserInfo } from '@/api/user.js';
- import { toLogin } from '@/libs/login.js';
- import { getList } from '@/api/new_store.js'
- import { mapState, mapGetters} from "vuex";
- // #ifdef H5
- import Auth from '@/libs/wechat';
- // #endif
- // #ifdef MP
- import editUserModal from '@/components/eidtUserModal/index.vue';
- // #endif
- import { HTTP_REQUEST_URL } from '@/config/app';
- export default {
- components: {
- pageFooter,
- // #ifdef MP
- editUserModal
- // #endif
- // service
- },
- computed: {
- ...mapGetters({
- isLogin: 'isLogin'
- })
- },
- data() {
- return {
- userInfo:'',
- isFooter: false,
- //切换账号身份
- showSwitch:false,
- actions:[],
- description:'',
- hasSwitch:false,//账号是否有多个身份 true有多个身份
- };
- },
- created() {
- let that = this;
- // #ifdef MP
- // 小程序静默授权
- console.log(this.$store.getters.isLogin,'this.$store.getters.isLogin')
- if (!this.$store.getters.isLogin) {
- // Routine.getCode()
- // .then(code => {
- // Routine.silenceAuth(code).then(res => {
- // this.onLoadFun();
- // })
- // })
- // .catch(res => {
- // uni.hideLoading();
- // });
- }
- // #endif
- if (that.isLogin == false) {
- // #ifdef H5 || APP-PLUS
- toLogin()
- // #endif
- // #ifdef MP
- //this.isShowAuth = true;
- // #endif
- }
- // #ifdef APP-PLUS
- that.$set(that, 'pageHeight', app.globalData.windowHeight);
- // #endif
- },
- filters: {
- formatNumber(num) {
- num = Number(num);
- if (num == 0 || (num > 0 && num < 10000)) {
- return num + '';
- } else {
- return (num / 10000).toFixed(2) + '万';
- }
- }
- },
- onShow() {
- let that = this;
- if (that.isLogin) {
- this.loadData()
- };
- },
- methods: {
- // #ifdef MP
- editSuccess() {
- this.editModal = false;
- this.getUserInfo();
- },
- closeEdit() {
- this.editModal = false;
- },
- // #endif
- loadData(){
- let obj = this;
- getUserInfo().then(res => {
- obj.userInfo = res.data
- if(obj.userInfo.Staff && obj.userInfo.Staff.uid){
- //有多个身份
- obj.hasSwitch = true
- if(obj.userInfo.Staff.is_expert == 1){
- obj.actions = [{name:'用户端',url:'/pages/index/index'},{name:'专家端',url:'/pageExpert/index/index'}]
- }
- }else{
- obj.hasSwitch = false
- }
- obj.$store.commit("SETUID", res.data.uid);
- obj.$store.commit("UPDATE_USERINFO", res.data);
- });
- },
- //切换用户身份
- switchUser(){
- let obj = this;
- let switchInfo = uni.getStorageSync("switchInfo")
- console.log(switchInfo,'switchInfo')
- if(switchInfo){
- obj.description = '您当前在'+switchInfo.name
- }else{
- obj.description = '您当前在用户端'
- }
- this.showSwitch = true
- },
- //显示切换用户下拉框
- switchSelect(e){
- let switchInfo = uni.getStorageSync("switchInfo")
- if(switchInfo){
- if(switchInfo.name == e.name){
- uni.showToast({
- title: '您当前在'+ e.name,
- icon: 'none',
- })
- return
- }else{
- uni.setStorageSync('switchInfo', e);
- uni.reLaunch({
- url:e.url
- })
- }
- }else{
- if(e.name == '用户端'){
- uni.showToast({
- title: '您当前在用户端',
- icon: 'none'
- })
- }else{
- uni.setStorageSync('switchInfo', e);
- uni.reLaunch({
- url:e.url
- })
- }
- }
- },
- //联系客服
- callService(){
- this.$util.getCustomer(this.userInfo)
- },
- //跳转
- navTo(url) {
- if (this.isLogin == false) {
- toLogin()
- }else{
- uni.navigateTo({
- url:url
- })
- }
- },
- newDataStatus(val) {
- this.isFooter = val;
- },
- },
- };
- </script>
- <style scoped lang="scss">
- .container{
- width: 100%;
- height: 100%;
- background-color: #f1f7f4;
- }
- .topBox{
- width: 100%;
- padding: 15rpx 25rpx;
- background: url('/static/image/userBg.png') no-repeat;
- background-size: 100% 100%;
- padding-top: calc(88px + env(safe-area-inset-top));
-
- }
- .userBox{
- .userInfo{
- .avatarBox{
- position: relative;
- .avatar{
- width: 166rpx;
- height: 166rpx;
- border-radius: 100%;
- border: 4px solid #2AD5DD;
- }
- .level{
- position: absolute;
- background-color: #FFFFFF;
- border: 1px solid #2AD5DD;
- border-radius: 25rpx;
- font-size: 24rpx;
- color: #41B8C7;
- bottom: 0rpx;
- padding: 2rpx 0rpx;
- width: 150rpx;
- left: 8rpx;
- text-align: center;
-
- }
- }
- .nameBox{
- padding-left: 25rpx;
- .name{
- font-size: 40rpx;
- font-weight: bold;
- color: #262626;
- }
- .phone{
- font-size: 26rpx;
- color: #999999;
- padding-top: 15rpx;
- }
- }
- }
- .set{
- width: 90rpx;
- height: 90rpx;
- }
- }
- .statistic{
- margin-top: 50rpx;
- .statTpl{
- width: 50%;
- height: 210rpx;
- border-radius: 20rpx;
- }
- .bg1{
- background: url('/static/image/img16.png') no-repeat;
- background-size: 100% 100%;
- }
- .bg2{
- background: url('/static/image/img17.png') no-repeat;
- background-size: 100% 100%;
- }
- .bg3{
- background: url('/static/image/img18.png') no-repeat;
- background-size: 100% 100%;
- }
- .statName{
- font-size: 30rpx;
- padding-bottom: 14rpx;
- font-weight: bold;
- padding: 40rpx 0rpx 15rpx 37rpx;
- color: #FFFFFF;
- }
- .statNum{
- font-size: 60rpx;
- font-weight: bold;
- color:#FFFFFF;;
- padding: 0rpx 0rpx 0rpx 37rpx;
- }
- }
- .list-box {
- margin: 0rpx 25rpx;
- .user-list {
- border-radius: 28rpx;
- background: #ffffff;
- width: 100%;
- background: #ffffff;
- padding: 30rpx 30rpx;
- margin-bottom: 25rpx;
- .left-img {
- width: 40rpx;
- height: 40rpx;
- }
-
- view {
- padding-left: 20rpx;
- flex-grow: 1;
- font-size: 29rpx;
- font-weight: bold;
- color: #5d5d5d;
- }
-
- .right-img {
- width: 13rpx;
- height: 23rpx;
- }
- }
- }
- </style>
|