transfer.uvue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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="transfer-to">
  13. <text class="transfer-label">转出至:</text>
  14. <text class="transfer-target">我的收益</text>
  15. </view>
  16. <!-- 可转出金额 -->
  17. <view class="transfer-info">
  18. <view class="amount-section">
  19. <text class="amount-label">可转出金额</text>
  20. <text class="amount-value">¥{{ availableAmount }}</text>
  21. </view>
  22. <view class="fee-section">
  23. <view class="fee-item">
  24. <text class="fee-label">实际转出金额</text>
  25. <text class="fee-value">¥{{ actualAmount }}</text>
  26. </view>
  27. <view class="fee-item">
  28. <text class="fee-label">服务费(10%)</text>
  29. <text class="fee-value">¥{{ serviceFee }}</text>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 确认转出按钮 -->
  34. <view class="submit-section">
  35. <button class="submit-btn" @click="confirmTransfer">确认转出</button>
  36. </view>
  37. </view>
  38. </template>
  39. <script setup lang="uts">
  40. import { ref, computed } from 'vue';
  41. // 数据定义
  42. const availableAmount = ref('49.2');
  43. // 计算属性
  44. const serviceFee = computed(() => {
  45. const amount = parseFloat(availableAmount.value);
  46. return (amount * 0.1).toFixed(2);
  47. });
  48. const actualAmount = computed(() => {
  49. const amount = parseFloat(availableAmount.value);
  50. return (amount * 0.9).toFixed(2);
  51. });
  52. // 方法定义
  53. const goBack = () => {
  54. uni.navigateBack();
  55. };
  56. const confirmTransfer = () => {
  57. uni.showModal({
  58. title: '转出确认',
  59. content: `确定要转出 ${availableAmount.value} 元到我的收益吗?服务费为 ${serviceFee.value} 元,实际转出 ${actualAmount.value} 元`,
  60. success: (res) => {
  61. if (res.confirm) {
  62. uni.showLoading({ title: '处理中...' });
  63. setTimeout(() => {
  64. uni.hideLoading();
  65. uni.showToast({
  66. title: '转出成功',
  67. icon: 'success'
  68. });
  69. // 可以在这里添加跳转回账户页面的逻辑
  70. setTimeout(() => {
  71. uni.navigateBack();
  72. }, 1500);
  73. }, 1000);
  74. }
  75. }
  76. });
  77. };
  78. </script>
  79. <style>
  80. /* 页面容器 */
  81. .page-container {
  82. background-color: #f5f6f8;
  83. min-height: 100vh;
  84. flex-direction: column;
  85. }
  86. /* 标题栏 */
  87. .header {
  88. flex-direction: row;
  89. align-items: center;
  90. justify-content: space-between;
  91. padding: 20rpx;
  92. background-color: #ffffff;
  93. }
  94. .header-left {
  95. width: 60rpx;
  96. height: 60rpx;
  97. align-items: center;
  98. justify-content: center;
  99. }
  100. .header-title {
  101. font-size: 32rpx;
  102. font-weight: bold;
  103. color: #333333;
  104. }
  105. .header-right {
  106. width: 60rpx;
  107. }
  108. /* 转出至 */
  109. .transfer-to {
  110. background-color: #ffffff;
  111. margin-top: 20rpx;
  112. padding: 30rpx;
  113. flex-direction: row;
  114. align-items: center;
  115. }
  116. .transfer-label {
  117. font-size: 28rpx;
  118. color: #666666;
  119. }
  120. .transfer-target {
  121. font-size: 28rpx;
  122. color: #333333;
  123. font-weight: bold;
  124. margin-left: 10rpx;
  125. }
  126. /* 可转出金额 */
  127. .transfer-info {
  128. background-color: #ffffff;
  129. margin-top: 20rpx;
  130. padding: 30rpx;
  131. }
  132. .amount-section {
  133. margin-bottom: 30rpx;
  134. }
  135. .amount-label {
  136. font-size: 28rpx;
  137. color: #666666;
  138. display: block;
  139. margin-bottom: 10rpx;
  140. }
  141. .amount-value {
  142. font-size: 48rpx;
  143. font-weight: bold;
  144. color: #333333;
  145. }
  146. .fee-section {
  147. border-top: 1rpx solid #f0f0f0;
  148. padding-top: 20rpx;
  149. }
  150. .fee-item {
  151. flex-direction: row;
  152. justify-content: space-between;
  153. margin-bottom: 10rpx;
  154. }
  155. .fee-label {
  156. font-size: 26rpx;
  157. color: #666666;
  158. }
  159. .fee-value {
  160. font-size: 26rpx;
  161. color: #333333;
  162. }
  163. /* 确认转出按钮 */
  164. .submit-section {
  165. padding: 30rpx;
  166. margin-top: 40rpx;
  167. }
  168. .submit-btn {
  169. background-color: #ffc107;
  170. color: #333333;
  171. font-size: 32rpx;
  172. font-weight: bold;
  173. border-radius: 40rpx;
  174. height: 80rpx;
  175. width: 100%;
  176. }
  177. </style>