zhangwei
2024-09-09 87bad1af0c203865d318befd9bf3af199896931e
src/pages/mine/index.vue
@@ -4,7 +4,7 @@
         <view class="header-img">
            <view class="header-image-left" @click='tologin'>
               <up-avatar :src="userInfo.avatar" shape="circle" size='60'></up-avatar>
               <view class="header-name">{{ userInfo.nickname || (isLogin ? '暂无小主信息' : '登录开启赚钱之旅哦') }}</view>
               <view class="header-name">{{ userInfo.nickname || (isLogin ? '暂无信息' : '点击登录') }}</view>
            </view>
            <view @tap="changRole" class="header-image-right chuany-flex chuany-align-center chuany-justify-center"
               data-ptpid="e758-138d-b914-343f">
@@ -131,22 +131,23 @@
               // },
            ],
            navList1: [{
                  icon: 'icon-dingdan',
                  name: '我的工作',
                  icon: 'icon-wanshanxinxi',
                  name: '完善资料',
                  cb: function() {
                     uni.navigateTo({
                        url: '/pages/order/myorder'
                        url: '/pages/mine/apply'
                     });
                  }
               },
               {
                  icon: 'icon-dingdan',
                  name: '我的工作',
                  cb: this.toMyWork
               },
               {
                  icon: 'icon-fuwutuandui',
                  name: '工作记录',
                  cb: function() {
                     uni.navigateTo({
                        url: '/pages/checkin/index'
                     });
                  }
                  cb: this.toMyRecord
               },
            ],
            isLogin: false,
@@ -183,6 +184,24 @@
         // this.token = this.$db.get('userToken') ? this.$db.get('userToken') : ''
         this.isLogin = this.token ? true : false;
      },
      onPullDownRefresh() {
         this.$api.getUser().then(res => {
            this.$db.set('userInfo', JSON.stringify(res.data))
            this.userInfo = res.data
            if (this.identity == 'worker') {
               if (this.userInfo.userWorker) {
                  this.balance = this.$common.moneySub(this.userInfo.userWorker.tiXianZonge, this.userInfo.userWorker
                     .yiTiXianJine)
               }
            } else {
               if (this.userInfo.userCompany) {
                  this.balance = this.userInfo.userCompany.chongZhiYue ? this.userInfo.userCompany.chongZhiYue :
                     '0.00'
               }
            }
         })
         uni.stopPullDownRefresh();
      },
      methods: {
         tologin() {
            if (this.isLogin) {
@@ -196,11 +215,29 @@
            }
         },
         toOrder() {
            if (!this.userInfo.userCompany) {
               uni.navigateTo({
                  url: '/pages/enterprise/enterprise'
               });
               this.$util.showToast({
                  title: '请先完善企业资料!'
               })
               return
            }
            uni.navigateTo({
               url: '/pages/order/order'
            })
         },
         toRelease() {
            if (!this.userInfo.userCompany) {
               uni.navigateTo({
                  url: '/pages/enterprise/enterprise'
               });
               this.$util.showToast({
                  title: '请先完善企业资料!'
               })
               return
            }
            uni.navigateTo({
               url: '/pages/release/index'
            })
@@ -211,10 +248,47 @@
            })
         },
         toWorkerRecord() {
            if (!this.userInfo.userCompany) {
               uni.navigateTo({
                  url: '/pages/enterprise/enterprise'
               });
               this.$util.showToast({
                  title: '请先完善企业资料!'
               })
               return
            }
            uni.navigateTo({
               url: '/pages/company/index'
            });
         },
         toMyWork() {
            if (!this.userInfo.userWorker) {
               uni.navigateTo({
                  url: '/pages/mine/apply'
               });
               this.$util.showToast({
                  title: '请先完善资料!'
               })
               return
            }
            uni.navigateTo({
               url: '/pages/order/myorder'
            });
         },
         toMyRecord() {
            if (!this.userInfo.userWorker) {
               uni.navigateTo({
                  url: '/pages/mine/apply'
               });
               this.$util.showToast({
                  title: '请先完善资料!'
               })
               return
            }
            uni.navigateTo({
               url: '/pages/checkin/index'
            });
         },
         changRole() {
            this.identity = this.identity === 'enterprise' ? 'worker' : 'enterprise'
            console.log(this.identity, 'this.identity');