From 2d43a1df3f5ba42710e6d21c27d1e13bdb8dfd56 Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期一, 24 三月 2025 09:23:08 +0800
Subject: [PATCH] -
---
src/pages/wallet/recharge.vue | 98 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 95 insertions(+), 3 deletions(-)
diff --git a/src/pages/wallet/recharge.vue b/src/pages/wallet/recharge.vue
index b15b488..4dbd8bf 100644
--- a/src/pages/wallet/recharge.vue
+++ b/src/pages/wallet/recharge.vue
@@ -2,25 +2,109 @@
<view class="full-page">
<view class="content">
<view class="balance">
- <view class="header chuany-flex chuany-justify-between chuany-align-center">
+ <view class="header chuany-flex chuany-justify-between chuany-align-center chuany-flex-wrap">
<view class="left chuany-align-center">
<text class="chuany-font40 c-p-r-10">锟�</text>
- <up-input border="surround" v-model="money"></up-input>
+ <up-input border="surround" v-model="money" type="digit"></up-input>
</view>
<view class="right">
- <up-button type="warning" size="small" shape="circle" text='鎻愮幇'></up-button>
+ <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>
+ <view class="chuany-font20 attention">
+ *娉細鏈�浣庢彁鐜�0.3鍏冿紝姣忔棩鎻愮幇涓嶅彲瓒呰繃2000鍏�
</view>
</view>
+
</view>
</view>
</view>
</template>
<script>
+ import {
+ mapActions,
+ mapGetters,
+ mapMutations
+ } from 'vuex'
export default {
data() {
return {
money: null
+ }
+ },
+ 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 {
+ return '0.00'
+ }
+ // } else {
+ // if (this.userInfo.userCompany) {
+ // return this.userInfo.userCompany.chongZhiYue ? this.userInfo.userCompany
+ // .chongZhiYue :
+ // '0.00'
+ // } else {
+ // return '0.00'
+ // }
+ // }
+ }
+ },
+ onLoad() {},
+ methods: {
+ ...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({
+ title: "璇疯緭鍏ラ噾棰濓紒",
+ icon: 'error'
+ });
+ return false
+ }
+ if (this.money < 0.3) {
+ this.$util.showToast({
+ title: "鏈�浣庢彁鐜�0.3鍏冿紒",
+ icon: 'error'
+ });
+ return false
+ }
+ if (this.stringToNumber(this.money) > this.stringToNumber(this.balance)) {
+ this.$util.showToast({
+ title: "杈撳叆閲戦澶т簬鍙彁鐜伴噾棰濓紒"
+ });
+ return false
+ }
+ this.$api.GetTransferMoney(this.money).then(res => {
+ if (res.code == 1) {
+ this.$util.showToast({
+ title: '鎻愮幇鎴愬姛锛�',
+ });
+ this.money = null
+ this.getUserInfo()
+ uni.navigateBack()
+ } else {
+ this.$util.showToast({
+ title: res.error ? res.error : '鎻愮幇澶辫触锛佲��',
+ });
+ }
+ })
}
}
}
@@ -50,6 +134,7 @@
border-radius: 15rpx;
padding: 25rpx;
background-image: linear-gradient(to bottom, #f4f5fc, #ffffff);
+ position: relative;
.left {
display: flex;
@@ -61,4 +146,11 @@
}
}
}
+
+ .attention {
+ margin: 3rpx;
+ color: red;
+ position: absolute;
+ bottom: 5px;
+ }
</style>
\ No newline at end of file
--
Gitblit v1.9.1