k94314517
2025-07-18 f93f455134ff234be9d257c0f432c8052f1c32cd
small-program/pages/withdrawal/withdrawal.vue
@@ -3,7 +3,7 @@
      <view class="tx-content">
         <view class="tx-content-title">可提现余额(元)</view>
         <view class="tx-content-price">
            <text>1000.00</text>
            <text>{{((userInfo.amount|| 0)/100).toFixed(2)}}</text>
            <view class="tx-content-price-btn" @click="jump">余额明细</view>
         </view>
         <view class="content">
@@ -16,10 +16,10 @@
               <view class="content-input-icon">
                  <image src="/static/icon/ic_money@2x.png" mode="widthFix"></image>
               </view>
               <input type="number" placeholder="请输入提现金额" />
               <view class="content-input-btn">全部提现</view>
               <input type="number" v-model="amount" @input="changeAmount" placeholder="请输入提现金额" />
               <view class="content-input-btn" @click="inputAll">全部提现</view>
            </view>
            <view class="content-tips">输入的金额已经超过可提现金额</view>
            <view class="content-tips">{{tips}}</view>
            <view class="content-button" @click="submit">2小时到账,确认提现</view>
         </view>
      </view>
@@ -27,10 +27,16 @@
</template>
<script>
   import { mapState } from 'vuex'
   export default {
      computed: {
         ...mapState(['userInfo' ])
      },
      data() {
         return {
            tips:'',//
            changing1:false,
            amount: null
         };
      },
      methods: {
@@ -39,11 +45,44 @@
               url: '/pages/balance-details/balance-details'
            })
         },
         inputAll(){
            this.amount = ((this.userInfo.amount|| 0)/100).toFixed(2)
         },
         changeAmount(){
            this.tips=''
         },
         submit() {
            uni.navigateTo({
               url: '/pages/withdrawal-successful/withdrawal-successful'
            })
         }
              if(this.changing1){
                  return
              }
              this.changing1 = true
              if(this.amount == null || this.amount<=0){
                 this.tips = '提交金额必须大于0,至少提现0.1元'
                 this.changing1 = false
                 return
              }
              if(this.amount *100 > this.userInfo.amount){
                 this.tips = '输入的金额已经超过可提现金额'
                 this.changing1 = false
                 return
              }
              this.changing1 = true
              var that = this
              var param ={amount:this.amount }
              that.$u.api.applyWithdrawal(param)
              .then(res =>{
                  if(res.code ===200){
                     uni.navigateTo({
                        url: '/pages/withdrawal-successful/withdrawal-successful'
                     })
                  }
               }).finally(() => {
                  that.changing1 = false
                  that.tips=''
                  that.amount =null
               })
         },
      }
   }
</script>