<template>
  <view class="withdrawal-container">
    <u-form :model="form" ref="uForm" label-width="160rpx">
      <u-form-item label="提现金额" prop="amount">
        <u-input v-model="form.amount" type="number" placeholder="请输入提现金额" />
      </u-form-item>
      <u-form-item label="提现账户" prop="account">
        <u-input v-model="form.account" placeholder="请输入提现账户" />
      </u-form-item>
    </u-form>
    <view class="submit-btn">
      <u-button type="primary" @click="handleSubmit">确认提现</u-button>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      form: {
        amount: '',
        account: ''
      },
      rules: {
        amount: [{
          required: true,
          message: '请输入提现金额',
          trigger: ['blur', 'change']
        }],
        account: [{
          required: true,
          message: '请输入提现账户',
          trigger: ['blur', 'change']
        }]
      }
    }
  },
  methods: {
    handleSubmit() {
      this.$refs.uForm.validate().then(valid => {
        if (valid) {
          // TODO: 实现提现逻辑
          uni.showToast({
            title: '提交成功',
            icon: 'success'
          })
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.withdrawal-container {
  padding: 20px;
  .submit-btn {
    margin-top: 50px;
  }
}
</style>
