-
zhangwei
2026-04-07 b7ae3f69ae6706a692284d2f12835d213debfb1a
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.]+/); // 正则表达式匹配数字和点
            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 : '提现失败!’',