From 87bad1af0c203865d318befd9bf3af199896931e Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期一, 09 九月 2024 13:58:05 +0800
Subject: [PATCH] 一些改动

---
 src/pages/mine/index.vue |   92 +++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 83 insertions(+), 9 deletions(-)

diff --git a/src/pages/mine/index.vue b/src/pages/mine/index.vue
index b580709..6e7e3ed 100644
--- a/src/pages/mine/index.vue
+++ b/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');

--
Gitblit v1.9.1