From 94384dcf5066aa1a7b2e37874fe331e148bc9249 Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期日, 29 九月 2024 17:27:03 +0800
Subject: [PATCH] 工人工资查询

---
 src/pages/wallet/index.vue |   65 ++++++++++++++++++++++----------
 1 files changed, 45 insertions(+), 20 deletions(-)

diff --git a/src/pages/wallet/index.vue b/src/pages/wallet/index.vue
index bc927a9..a0d0a51 100644
--- a/src/pages/wallet/index.vue
+++ b/src/pages/wallet/index.vue
@@ -43,39 +43,64 @@
 </template>
 
 <script>
+	import {
+		mapActions,
+		mapGetters,
+		mapMutations
+	} from 'vuex'
 	export default {
-		onLoad() {
-			let that = this
-			that.identity = this.$db.get('identity')
-		},
 		data() {
 			return {
-				identity: '',
+				// identity: '',
 				imcomeInfo: null,
 				pageIndex: 1,
 				pageSize: 20,
-				balance: '0.00'
+				// balance: '0.00'
 			}
 		},
 		onLoad() {
 			let that = this
-			this.userInfo = this.$db.get('userInfo') || {}
-			uni.getStorage({
-				key: 'identity',
-				success: function(res) {
-					that.identity = res.data
-					if (res.data == 'worker') {
-						if (that.userInfo.userWorker) {
-							that.balance = that.$common.moneySub(that.userInfo.userWorker.tiXianZonge, that.userInfo.userWorker.yiTiXianJine)
-						}
+			// that.identity = this.$db.get('identity')
+			// this.userInfo = this.$db.get('userInfo') || {}
+			// uni.getStorage({
+			// 	key: 'identity',
+			// 	success: function(res) {
+			// 		that.identity = res.data
+			// 		if (res.data == 'worker') {
+			// 			if (that.userInfo.userWorker) {
+			// 				that.balance = that.$common.moneySub(that.userInfo.userWorker.tiXianZonge, that.userInfo.userWorker.yiTiXianJine)
+			// 			}
+			// 		} else {
+			// 			if (that.userInfo.userCompany) {
+			// 				that.balance = that.userInfo.userCompany.chongZhiYue ? that.userInfo.userCompany.chongZhiYue : '0.00'
+			// 			}
+			// 		}
+			// 	}
+			// });
+			this.PostMyTiXianDetailListPage()
+		},
+		computed:{
+			...mapGetters(['userInfo', 'identity']),
+			
+			balance() {
+				if (this.identity == 'worker') {
+					if (this.userInfo.userWorker) {
+						return this.$common.moneySub(this.userInfo.userWorker.tiXianZonge, this.userInfo
+							.userWorker
+							.yiTiXianJine)
 					} else {
-						if (that.userInfo.userCompany) {
-							that.balance = that.userInfo.userCompany.chongZhiYue ? that.userInfo.userCompany.chongZhiYue : '0.00'
-						}
+						return '0.00'
+					}
+				} else {
+					if (this.userInfo.userCompany) {
+						return this.userInfo.userCompany.chongZhiYue ? this.userInfo.userCompany
+							.chongZhiYue :
+							'0.00'
+					} else {
+						return '0.00'
 					}
 				}
-			});
-			this.PostMyTiXianDetailListPage()
+			}
 		},
 		methods: {
 			PostMyTiXianDetailListPage() {

--
Gitblit v1.9.1