withdraw.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <route lang="json5" type="page">
  2. {
  3. layout: 'default',
  4. style: {
  5. navigationStyle: 'custom',
  6. navigationBarTitleText: '%wallet.withdraw.title%',
  7. },
  8. }
  9. </route>
  10. <script lang="ts" setup>
  11. import { withdrawAdd } from '@/api/wallet'
  12. import { t } from '@/locale'
  13. import { formatNumber } from '@/utils'
  14. import { getPageParams, goBack, toPage } from '@/utils/page'
  15. import { toast } from '@/utils/toast'
  16. defineOptions({
  17. name: 'Withdraw', // 提现
  18. })
  19. const userInfo = computed(() => {
  20. return getUserInfoHook()
  21. })
  22. const queryParams = ref<any>({})
  23. // 表单数据
  24. const formData = ref({
  25. amount: '',
  26. bank: userInfo.value.bank,
  27. bankAccountName: userInfo.value.bankAccountName,
  28. bankAccount: userInfo.value.bankAccount,
  29. channel: 1,
  30. currency: 1,
  31. })
  32. async function submit() {
  33. if (!formData.value.bank) {
  34. toast.info(t('wallet.withdraw.error.bankName'))
  35. return
  36. }
  37. if (!formData.value.bankAccountName) {
  38. toast.info(t('wallet.withdraw.error.bankAccountName'))
  39. return
  40. }
  41. if (!formData.value.bankAccount) {
  42. toast.info(t('wallet.withdraw.error.bankAccountNo'))
  43. return
  44. }
  45. if (!formData.value.amount) {
  46. toast.info(t('wallet.withdraw.error.amount'))
  47. return
  48. }
  49. const res = await withdrawAdd({ ...formData.value, accountType: queryParams.value.type })
  50. console.log(res)
  51. }
  52. onLoad((options) => {
  53. queryParams.value = getPageParams(options)
  54. })
  55. </script>
  56. <template>
  57. <view class="min-h-100vh flex flex-col bg-#FEE750">
  58. <wd-navbar
  59. custom-class="bg-#FEE750!"
  60. :bordered="false"
  61. safe-area-inset-top placeholder fixed
  62. :title="t('wallet.withdraw.title')"
  63. >
  64. <template #left>
  65. <wd-icon name="thin-arrow-left" size="32rpx" @click="goBack" />
  66. </template>
  67. <template #right>
  68. <text class="text-28rpx" @click="toPage('/pages/wallet/withdrawRecord', { type: queryParams.type })">
  69. {{ $t('wallet.withdraw.record') }}
  70. </text>
  71. </template>
  72. </wd-navbar>
  73. <view class="px-28rpx pb-28rpx pt-40rpx">
  74. <view class="text-28rpx">
  75. {{ $t('wallet.withdraw.balance') }}
  76. </view>
  77. <view>
  78. <text class="text-28rpx">
  79. </text>
  80. <text class="text-48rpx font-bold">
  81. {{ formatNumber(queryParams.balance) }}
  82. </text>
  83. </view>
  84. </view>
  85. <view class="flex-1 rounded-t-24rpx bg-white p-24rpx">
  86. <view class="mb-28rpx text-32rpx">
  87. {{ $t('wallet.withdraw.info') }}
  88. </view>
  89. <wd-form ref="form" :model="formData" custom-class="mb-28rpx">
  90. <view class="mb-40rpx space-y-32rpx">
  91. <wd-input
  92. v-model="formData.bank"
  93. :placeholder="t('wallet.withdraw.form.bankName')"
  94. no-border
  95. custom-class="bandhu-auth-input-field"
  96. :readonly="userInfo.bank"
  97. />
  98. <wd-input
  99. v-model="formData.bankAccountName"
  100. :placeholder="t('wallet.withdraw.form.bankAccountName')"
  101. no-border
  102. custom-class="bandhu-auth-input-field"
  103. :readonly="userInfo.bankAccountName"
  104. />
  105. <wd-input
  106. v-model="formData.bankAccount"
  107. :placeholder="t('wallet.withdraw.form.bankAccountNo')"
  108. no-border
  109. custom-class="bandhu-auth-input-field"
  110. :readonly="userInfo.bankAccountName"
  111. />
  112. <view class="flex items-center gap-20rpx">
  113. <wd-input
  114. v-model="formData.amount"
  115. :placeholder="t('wallet.withdraw.form.amount')"
  116. no-border
  117. custom-class="flex-1 bandhu-auth-input-field"
  118. />
  119. <wd-button
  120. type="error"
  121. plain
  122. custom-class="bandhu-auth-secondary-btn"
  123. @click="formData.amount = queryParams.balance"
  124. >
  125. {{ $t('wallet.withdraw.form.allAmount') }}
  126. </wd-button>
  127. </view>
  128. </view>
  129. <wd-button plain block custom-class="h-80rpx!" @click="submit">
  130. {{ $t('wallet.withdraw.form.submit') }}
  131. </wd-button>
  132. </wd-form>
  133. <view class="text-24rpx text-#5A5A5A line-height-48rpx">
  134. {{ $t('wallet.withdraw.notes.title') }}
  135. <br>
  136. {{ $t('wallet.withdraw.notes.1') }}
  137. <br>
  138. {{ $t('wallet.withdraw.notes.2') }}
  139. <br>
  140. {{ $t('wallet.withdraw.notes.3') }}
  141. <br>
  142. {{ $t('wallet.withdraw.notes.4') }}
  143. <br>
  144. {{ $t('wallet.withdraw.notes.5') }}
  145. </view>
  146. </view>
  147. </view>
  148. </template>
  149. <style lang="scss" scoped>
  150. //
  151. </style>