withdraw.uvue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <view class="page-container">
  3. <!-- 顶部标题栏 -->
  4. <view class="header">
  5. <view class="header-left" @click="goBack">
  6. <u-icon name="arrow-left" :size="24" />
  7. </view>
  8. <view class="header-title">提现</view>
  9. <view class="header-right"></view>
  10. </view>
  11. <!-- 可提现金额 -->
  12. <view class="available-balance">
  13. <text class="balance-label">可提现金额(元)</text>
  14. <text class="balance-amount">¥{{ availableBalance }}</text>
  15. </view>
  16. <!-- 提现金额输入 -->
  17. <view class="withdraw-section">
  18. <view class="input-container">
  19. <text class="input-prefix">¥</text>
  20. <input class="withdraw-input" v-model="withdrawAmount" type="number" placeholder="请输入提现金额" />
  21. <button class="all-withdraw-btn" @click="withdrawAll">全部提现</button>
  22. </view>
  23. </view>
  24. <!-- 提现说明 -->
  25. <view class="withdraw-info">
  26. <text class="info-title">提现说明</text>
  27. <view class="info-item">
  28. <text>1、每笔提现最低金额10元,最高金额200元</text>
  29. </view>
  30. <view class="info-item">
  31. <text>2、每日累计最多可提现200元</text>
  32. </view>
  33. <view class="info-item">
  34. <text>3、请输入正整数</text>
  35. </view>
  36. <view class="info-item">
  37. <text>4、提现手续费为7%,例如:提现100元扣除7元实际到账93元</text>
  38. </view>
  39. </view>
  40. <!-- 提现方式 -->
  41. <view class="withdraw-method">
  42. <text class="method-title">提现方式</text>
  43. <view class="method-item" @click="selectMethod">
  44. <view class="method-left">
  45. <u-icon name="wechat" :size="24" color="#07C160" />
  46. <text class="method-name">提现至微信钱包</text>
  47. </view>
  48. <view class="method-right">
  49. <u-icon name="checkmark-circle-fill" :size="20" color="#ffc107" />
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 申请提现按钮 -->
  54. <view class="submit-section">
  55. <button class="submit-btn" @click="submitWithdraw">申请提现</button>
  56. </view>
  57. </view>
  58. </template>
  59. <script setup lang="uts">
  60. import { ref } from 'vue';
  61. // 数据定义
  62. const availableBalance = ref('1000');
  63. const withdrawAmount = ref('');
  64. // 方法定义
  65. const goBack = () => {
  66. uni.navigateBack();
  67. };
  68. const withdrawAll = () => {
  69. withdrawAmount.value = availableBalance.value;
  70. };
  71. const selectMethod = () => {
  72. // 这里可以添加选择其他提现方式的逻辑
  73. };
  74. const submitWithdraw = () => {
  75. // 验证提现金额
  76. if (!withdrawAmount.value || parseFloat(withdrawAmount.value) <= 0) {
  77. uni.showToast({
  78. title: '请输入提现金额',
  79. icon: 'none'
  80. });
  81. return;
  82. }
  83. const amount = parseFloat(withdrawAmount.value);
  84. const maxAmount = parseFloat(availableBalance.value);
  85. if (amount < 10) {
  86. uni.showToast({
  87. title: '提现金额不能低于10元',
  88. icon: 'none'
  89. });
  90. return;
  91. }
  92. if (amount > 200) {
  93. uni.showToast({
  94. title: '提现金额不能超过200元',
  95. icon: 'none'
  96. });
  97. return;
  98. }
  99. if (amount > maxAmount) {
  100. uni.showToast({
  101. title: '提现金额不能超过可提现金额',
  102. icon: 'none'
  103. });
  104. return;
  105. }
  106. // 提交提现申请
  107. uni.showModal({
  108. title: '提现确认',
  109. content: `确定要提现 ${withdrawAmount.value} 元吗?手续费为 ${(amount * 0.07).toFixed(2)} 元,实际到账 ${(amount * 0.93).toFixed(2)} 元`,
  110. success: (res) => {
  111. if (res.confirm) {
  112. uni.showLoading({ title: '处理中...' });
  113. setTimeout(() => {
  114. uni.hideLoading();
  115. uni.showToast({
  116. title: '提现申请已提交',
  117. icon: 'success'
  118. });
  119. // 可以在这里添加跳转回账户页面的逻辑
  120. setTimeout(() => {
  121. uni.navigateBack();
  122. }, 1500);
  123. }, 1000);
  124. }
  125. }
  126. });
  127. };
  128. </script>
  129. <style>
  130. /* 页面容器 */
  131. .page-container {
  132. background-color: #f5f6f8;
  133. min-height: 100vh;
  134. flex-direction: column;
  135. }
  136. /* 标题栏 */
  137. .header {
  138. flex-direction: row;
  139. align-items: center;
  140. justify-content: space-between;
  141. padding: 20rpx;
  142. background-color: #ffffff;
  143. }
  144. .header-left {
  145. width: 60rpx;
  146. height: 60rpx;
  147. align-items: center;
  148. justify-content: center;
  149. }
  150. .header-title {
  151. font-size: 32rpx;
  152. font-weight: bold;
  153. color: #333333;
  154. }
  155. .header-right {
  156. width: 60rpx;
  157. }
  158. /* 可提现金额 */
  159. .available-balance {
  160. background-color: #ffc107;
  161. padding: 40rpx 30rpx;
  162. align-items: center;
  163. }
  164. .balance-label {
  165. font-size: 28rpx;
  166. color: #333333;
  167. margin-bottom: 20rpx;
  168. }
  169. .balance-amount {
  170. font-size: 56rpx;
  171. font-weight: bold;
  172. color: #ffffff;
  173. }
  174. /* 提现金额输入 */
  175. .withdraw-section {
  176. background-color: #ffffff;
  177. margin-top: 20rpx;
  178. padding: 30rpx;
  179. }
  180. .input-container {
  181. flex-direction: row;
  182. align-items: center;
  183. border: 1rpx solid #e5e5e5;
  184. border-radius: 12rpx;
  185. padding: 20rpx;
  186. }
  187. .input-prefix {
  188. font-size: 32rpx;
  189. color: #333333;
  190. margin-right: 10rpx;
  191. }
  192. .withdraw-input {
  193. flex: 1;
  194. font-size: 32rpx;
  195. color: #333333;
  196. }
  197. .all-withdraw-btn {
  198. background-color: #f5f6f8;
  199. color: #666666;
  200. font-size: 26rpx;
  201. padding: 10rpx 20rpx;
  202. border-radius: 20rpx;
  203. border: 1rpx solid #e5e5e5;
  204. }
  205. /* 提现说明 */
  206. .withdraw-info {
  207. background-color: #ffffff;
  208. margin-top: 20rpx;
  209. padding: 30rpx;
  210. }
  211. .info-title {
  212. font-size: 30rpx;
  213. font-weight: bold;
  214. color: #333333;
  215. margin-bottom: 20rpx;
  216. }
  217. .info-item {
  218. font-size: 26rpx;
  219. color: #666666;
  220. line-height: 1.5;
  221. margin-bottom: 10rpx;
  222. }
  223. /* 提现方式 */
  224. .withdraw-method {
  225. background-color: #ffffff;
  226. margin-top: 20rpx;
  227. padding: 30rpx;
  228. }
  229. .method-title {
  230. font-size: 30rpx;
  231. font-weight: bold;
  232. color: #333333;
  233. margin-bottom: 20rpx;
  234. }
  235. .method-item {
  236. flex-direction: row;
  237. align-items: center;
  238. justify-content: space-between;
  239. }
  240. .method-left {
  241. flex-direction: row;
  242. align-items: center;
  243. }
  244. .method-name {
  245. font-size: 28rpx;
  246. color: #333333;
  247. margin-left: 10rpx;
  248. }
  249. /* 提交按钮 */
  250. .submit-section {
  251. padding: 30rpx;
  252. margin-top: 40rpx;
  253. }
  254. .submit-btn {
  255. background-color: #ffc107;
  256. color: #333333;
  257. font-size: 32rpx;
  258. font-weight: bold;
  259. border-radius: 40rpx;
  260. height: 80rpx;
  261. width: 100%;
  262. }
  263. </style>