zhangwei
2024-09-23 208b5a9f559dd2c7298759fdfe37d07c926cbd4d
src/pages/wallet/recharge.vue
@@ -2,25 +2,95 @@
   <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" 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
            money: null,
            balance: null,
            userInfo: {}
         }
      },
      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'
         ]),
         GetTransferMoney() {
            if (!this.money) {
               this.$util.showToast({
                  title: "请输入金额!",
                  icon: 'error'
               });
               return false
            }
            if (this.money > this.balance) {
               this.$util.showToast({
                  title: "输入金额大于可提现金额!"
               });
               return false
            }
            this.$api.GetTransferMoney(this.money).then(res => {
               if (res.code == 1) {
                  this.$util.showToast({
                     title: '提现成功!’',
                  });
                  this.getUserInfo()
               } else {
                  this.$util.showToast({
                     title: res.error ? res.error : '提现失败!’',
                  });
               }
            })
         }
      }
   }
@@ -50,6 +120,7 @@
            border-radius: 15rpx;
            padding: 25rpx;
            background-image: linear-gradient(to bottom, #f4f5fc, #ffffff);
            position: relative;
            .left {
               display: flex;
@@ -61,4 +132,11 @@
         }
      }
   }
   .attention {
      margin: 3rpx;
      color: red;
      position: absolute;
      bottom: 5px;
   }
</style>