From b7ae3f69ae6706a692284d2f12835d213debfb1a Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期二, 07 四月 2026 17:21:41 +0800
Subject: [PATCH] -

---
 src/pages/wallet/recharge.vue |   81 +++++++++++++++++++++++++++-------------
 1 files changed, 54 insertions(+), 27 deletions(-)

diff --git a/src/pages/wallet/recharge.vue b/src/pages/wallet/recharge.vue
index 82926ae..ccfb5cd 100644
--- a/src/pages/wallet/recharge.vue
+++ b/src/pages/wallet/recharge.vue
@@ -11,12 +11,19 @@
 						<up-button type="warning" size="small" shape="circle" text='鎻愮幇'
 							@click='GetTransferMoney'></up-button>
 					</view>
-					<view class="chuany-font28">
-						鍙彁鐜颁綑棰濓細锟�<text class="c-p-l-10">{{balance}} 鍏�</text>
+					<view class="chuany-font28 c-m-b-14">
+						鍙彁鐜颁綑棰濓細锟�<text class="c-p-l-10">{{availableBalance}} 鍏�</text>
+						<view class="" v-if="isLingHuoYongGong">
+							浣欓锛氾骏<text class="c-p-l-10">{{balance}} 鍏�</text>
+							<view class="">
+								鎮ㄤ负鐏垫椿鐢ㄥ伐浜哄憳锛屽鑸嶆娂閲戦渶缂寸撼300鍏冦��
+							</view>
+						</view>
+						<view class="chuany-font20 attention ">
+							*娉細鏈�浣庢彁鐜�0.3鍏冿紝姣忔棩鎻愮幇涓嶅彲瓒呰繃2000鍏�
+						</view>
 					</view>
-					<view class="chuany-font20 attention">
-						*娉細鏈�浣庢彁鐜�0.3鍏冿紝姣忔棩鎻愮幇涓嶅彲瓒呰繃2000鍏�
-					</view>
+					
 				</view>
 
 			</view>
@@ -33,31 +40,35 @@
 	export default {
 		data() {
 			return {
-				money: null,
-				balance: null,
-				userInfo: {}
+				money: null
 			}
 		},
 		computed: {
 			...mapGetters(['userInfo', 'identity']),
+			availableBalance(){
+				return this.userInfo.userWorker.availableBalance
+			},
+			isLingHuoYongGong(){
+				return this.userInfo.userWorker.isLingHuoYongGong
+			},
 			balance() {
-				if (this.identity == 'worker') {
-					if (this.userInfo.userWorker) {
-						return this.$common.moneySub(this.userInfo.userWorker.tiXianZonge, this.userInfo
-							.userWorker
-							.yiTiXianJine)
-					} else {
-						return '0.00'
-					}
-				} else {
-					if (this.userInfo.userCompany) {
-						return this.userInfo.userCompany.chongZhiYue ? this.userInfo.userCompany
-							.chongZhiYue :
-							'0.00'
-					} else {
-						return '0.00'
-					}
-				}
+				// if (this.identity == 'worker') {
+				// if (this.userInfo.userWorker) {
+				// 	return this.$common.moneySub(this.userInfo.userWorker.tiXianZonge, this.userInfo
+				// 		.userWorker
+				// 		.yiTiXianJine)
+				// } else {
+					return this.userInfo.userWorker.balance
+				// }
+				// } else {
+				// 	if (this.userInfo.userCompany) {
+				// 		return this.userInfo.userCompany.chongZhiYue ? this.userInfo.userCompany
+				// 			.chongZhiYue :
+				// 			'0.00'
+				// 	} else {
+				// 		return '0.00'
+				// 	}
+				// }
 			}
 		},
 		onLoad() {},
@@ -65,6 +76,13 @@
 			...mapActions([
 				'getUserInfo'
 			]),
+			stringToNumber(str) {
+				const match = str.match(/[\d.]+/); // 姝e垯琛ㄨ揪寮忓尮閰嶆暟瀛楀拰鐐�
+				if (match) {
+					return parseFloat(match[0]); // 浣跨敤parseFloat杞崲
+				}
+				return 0; // 濡傛灉娌℃湁鍖归厤鍒版暟瀛楋紝杩斿洖NaN
+			},
 			GetTransferMoney() {
 				if (!this.money) {
 					this.$util.showToast({
@@ -73,7 +91,14 @@
 					});
 					return false
 				}
-				if (this.money > this.balance) {
+				if (this.money < 0.3) {
+					this.$util.showToast({
+						title: "鏈�浣庢彁鐜�0.3鍏冿紒",
+						icon: 'error'
+					});
+					return false
+				}
+				if (this.stringToNumber(this.money) > this.availableBalance) {
 					this.$util.showToast({
 						title: "杈撳叆閲戦澶т簬鍙彁鐜伴噾棰濓紒"
 					});
@@ -82,9 +107,11 @@
 				this.$api.GetTransferMoney(this.money).then(res => {
 					if (res.code == 1) {
 						this.$util.showToast({
-							title: '鎻愮幇鎴愬姛锛佲��',
+							title: '鎻愮幇鎴愬姛锛�',
 						});
+						this.money = null
 						this.getUserInfo()
+						uni.navigateBack()
 					} else {
 						this.$util.showToast({
 							title: res.error ? res.error : '鎻愮幇澶辫触锛佲��',

--
Gitblit v1.9.1