<template>
  <view class='withdraw'>
    <view class='header'>
      <view class='bank-info'>
        <view class='bank-logo'></view>
        <view class='bank-name'>中国银行(尾号1234)</view>
      </view>
      <view class='switch-card'>切换银行卡</view>
    </view>
    <view class='withdraw-amount'>
      <view class='amount-title'>提现金额(元)</view>
      <view class='amount-input'>
        <view class='amount-prefix'>¥</view>
        <input type='number' v-model='amount' placeholder='0.00' />
        <view class='all-withdraw' @click='allWithdraw()'>全部提现</view>
      </view>
      <view class='balance'>当前余额:¥{{balance}}</view>
    </view>
    <view class='keyboard'>
      <view class='key-row'>
        <view class='key' @click='inputNumber(1)'>1</view>
        <view class='key' @click='inputNumber(2)'>2</view>
        <view class='key' @click='inputNumber(3)'>3</view>
      </view>
      <view class='key-row'>
        <view class='key' @click='inputNumber(4)'>4</view>
        <view class='key' @click='inputNumber(5)'>5</view>
        <view class='key' @click='inputNumber(6)'>6</view>
      </view>
      <view class='key-row'>
        <view class='key' @click='inputNumber(7)'>7</view>
        <view class='key' @click='inputNumber(8)'>8</view>
        <view class='key' @click='inputNumber(9)'>9</view>
      </view>
      <view class='key-row'>
        <view class='key key-empty'></view>
        <view class='key' @click='inputNumber(0)'>0</view>
        <view class='key key-delete' @click='deleteNumber()'></view>
      </view>
    </view>
  </view>
</template>
<script>
export default {
  data() {
    return {
      amount: '', // 提现金额
      balance: 1000 // 当前余额
    }
  },
  methods: {
    inputNumber(num) {
      if (this.amount.length < 10) {
        // 限制输入金额长度不超过10位
        this.amount += num
      }
    },
    deleteNumber() {
      if (this.amount) {
        this.amount = this.amount.substring(0, this.amount.length - 1)
      }
    },
    allWithdraw() {
      this.amount = this.balance
    }
  }
}
</script>
<style scoped>
.withdraw {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding-top: 20px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 15px;
}

.bank-info {
  display: flex;
  align-items: center;
}

.bank-logo {
  width: 30px;
  height: 30px;
  background-color: #ccc;
  border-radius: 50%;
  margin-right: 10px;
}

.bank-name {
  font-size: 16px;
  font-weight: bold;
}

.switch-card {
  font-size: 14px;
  color: #4d7fff;
}

.withdraw-amount {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.amount-title {
  font-size: 16px;
}

.amount-input {
  display: flex;
  align-items: center;
  margin: 20px 0;
}

.amount-prefix {
  font-size: 20px;
  font-weight: bold;
  margin-right: 5px;
}

input {
  font-size: 28px;
  font-weight: bold;
  text-align: center;
  border: none;
  outline: none;
  width: 100%;
}

.all-withdraw {
  font-size: 14px;
  color: #4d7fff;
  margin-left: 10px;
}

.balance {
  font-size: 14px;
  color: #999;
}

.keyboard {
  display: flex;
  flex-wrap: wrap;
  padding: 10px;
  background-color: #eee;
}

.key-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 10px;
}

.key {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 30%;
  height: 50px;
  background-color: #fff;
  border-radius: 5px;
  font-size: 24px;
  color: #333;
}

.key-empty {
  visibility: hidden;
}

.key-delete::before {
  content: '';
  display: block;
  width: 20px;
  height: 20px;
  background-image: url('https://img.icons8.com/material-outlined/24/000000/delete-sign.png');
  background-repeat: no-repeat;
  background-size: cover;
}
</styl
微信零钱提现页面开发:UniApp实现美观提现界面

原文地址: http://www.cveoy.top/t/topic/onec 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录