withdrawal.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view class="page-container">
  3. <u-navbar title="提现" :autoBack="true" :placeholder="true" :border-bottom="false"></u-navbar>
  4. <view class="form-card">
  5. <view class="section-item" @click="selectBankCard">
  6. <view class="label">提现至</view>
  7. <view class="content">
  8. <view class="bank-info">
  9. <u-image class="bank-icon" :src="bankCard.icon" width="48rpx" height="48rpx" mode="aspectFit"></u-image>
  10. <text class="bank-name">{{ bankCard.name }} ({{ bankCard.tailNumber }})</text>
  11. </view>
  12. <u-icon name="arrow-right" color="#c0c4cc" size="32rpx"></u-icon>
  13. </view>
  14. </view>
  15. <view class="section-input">
  16. <view class="label">提现金额</view>
  17. <view class="input-row">
  18. <text class="currency-symbol">¥</text>
  19. <u-input
  20. type="digit"
  21. height="80"
  22. placeholder="请输入提现金额"
  23. :customStyle="{
  24. fontSize: '52rpx',
  25. padding: '0 10rpx'
  26. }"
  27. v-model="withdrawalAmount"
  28. ></u-input>
  29. </view>
  30. <view class="balance-info">
  31. <text>当前可提现余额{{ availableBalance }}元,</text>
  32. <text class="all-withdraw-btn" @click="allWithdraw">全部提现</text>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="footer-bar">
  37. <u-button
  38. type="primary"
  39. :disabled="!withdrawalAmount || parseFloat(withdrawalAmount) <= 0"
  40. @click="applyWithdrawal"
  41. >申请提现</u-button>
  42. </view>
  43. <!-- 调用选择器组件 -->
  44. <BankCardSelector
  45. ref="bcSelector"
  46. :data-list="bankCards"
  47. v-model="selectedCardId"
  48. @select="handleCardSelect"
  49. />
  50. </view>
  51. </template>
  52. <script>
  53. import BankCardSelector from './bankCard-select.vue';
  54. export default {
  55. components: {
  56. BankCardSelector
  57. },
  58. data() {
  59. return {
  60. // 模拟数据
  61. bankCard: {
  62. name: '中国工商银行',
  63. tailNumber: '0882',
  64. icon: '/static/groupMeal/iconback/yinhang-gongshang.png'
  65. },
  66. availableBalance: '821.33', // 当前可提现余额
  67. withdrawalAmount: '', // 提现金额输入框的值
  68. // 模拟的银行卡数据
  69. bankCards: [
  70. { id: 101, name: '中国工商银行储蓄卡', last4: '0882', icon: '/static/groupMeal/iconback/yinhang-gongshang.png' },
  71. { id: 102, name: '中国建设银行储蓄卡', last4: '0882', icon: '/static/groupMeal/iconback/yinhang-jianshe.png' },
  72. { id: 103, name: '中国光大银行储蓄卡', last4: '0882', icon: '/static/groupMeal/iconback/yinhang-guangda.png' },
  73. // 模拟更多数据以测试滚动
  74. { id: 104, name: '中国农业银行储蓄卡', last4: '1234', icon: '/static/groupMeal/iconback/yinhang-nonghang.png' },
  75. { id: 105, name: '招商银行储蓄卡', last4: '5678', icon: '/static/groupMeal/iconback/yinhang-zhaoshang.png' },
  76. { id: 106, name: '交通银行储蓄卡', last4: '9012', icon: '/static/groupMeal/iconback/yinhang-jiaotong.png' },
  77. ],
  78. selectedCardId: 101, // 默认选中的卡ID
  79. };
  80. },
  81. methods: {
  82. // 选择/修改银行卡
  83. selectBankCard() {
  84. this.$refs.bcSelector.open();
  85. return;
  86. uni.navigateTo({
  87. url: '/pages/groupMeal/users/bankCard-list'
  88. });
  89. },
  90. // 选择事件回调
  91. handleCardSelect(card) {
  92. console.log('您选择了:', card);
  93. uni.showToast({
  94. title: `已选择: ${card.name}`,
  95. icon: 'none'
  96. });
  97. },
  98. // 全部提现操作
  99. allWithdraw() {
  100. this.withdrawalAmount = this.availableBalance;
  101. console.log('已设置全部提现:', this.withdrawalAmount);
  102. },
  103. // 申请提现
  104. applyWithdrawal() {
  105. if (parseFloat(this.withdrawalAmount) > parseFloat(this.availableBalance)) {
  106. uni.showToast({
  107. title: '提现金额不能超过可提现余额',
  108. icon: 'none'
  109. });
  110. return;
  111. }
  112. console.log('提交提现申请:', {
  113. amount: this.withdrawalAmount,
  114. bankCard: this.bankCard
  115. });
  116. // 实际项目中应在此处调用API进行提现
  117. uni.showLoading({ title: '提交中' });
  118. setTimeout(() => {
  119. uni.hideLoading();
  120. uni.showToast({ title: '提现申请成功', icon: 'success' });
  121. // 成功后可跳转到提现记录页
  122. }, 1500);
  123. }
  124. }
  125. };
  126. </script>
  127. <style lang="scss" scoped>
  128. $uni-text-color: #303133;
  129. $uni-color-primary: #2979ff;
  130. $uni-text-color-placeholder: #909399;
  131. .page-container {
  132. min-height: 100vh;
  133. background-color: #F7F8FC;
  134. .form-card {
  135. background-color: #fff;
  136. padding: 0 30rpx;
  137. }
  138. }
  139. // 提现至:银行卡选择区域
  140. .section-item {
  141. display: flex;
  142. align-items: center;
  143. justify-content: space-between;
  144. padding: 30rpx 0;
  145. border-bottom: 1rpx solid #eee;
  146. .label {
  147. font-weight: 500;
  148. font-size: 32rpx;
  149. color: #333333;
  150. }
  151. .content {
  152. display: flex;
  153. align-items: center;
  154. }
  155. .bank-info {
  156. display: flex;
  157. align-items: center;
  158. margin-right: 15rpx;
  159. .bank-icon {
  160. margin-right: 10rpx;
  161. // 确保u-image可以正确显示
  162. display: block;
  163. }
  164. .bank-name {
  165. font-size: 30rpx;
  166. color: $uni-text-color;
  167. }
  168. }
  169. }
  170. // 提现金额输入区域
  171. .section-input {
  172. padding: 30rpx 0 20rpx;
  173. .label {
  174. font-weight: 400;
  175. font-size: 30rpx;
  176. color: #333333;
  177. margin-bottom: 20rpx;
  178. }
  179. .input-row {
  180. display: flex;
  181. align-items: center;
  182. padding: 20rpx 0;
  183. border-bottom: 1rpx solid #eee;
  184. .currency-symbol {
  185. font-size: 52rpx;
  186. font-weight: bold;
  187. color: #333;
  188. padding-right: 10rpx;
  189. }
  190. }
  191. .balance-info {
  192. font-weight: 400;
  193. font-size: 26rpx;
  194. color: rgba(51,51,51,0.6);
  195. margin-top: 16rpx;
  196. .all-withdraw-btn {
  197. font-weight: 400;
  198. font-size: 26rpx;
  199. color: #2D4D89;
  200. margin-left: 10rpx;
  201. &:active {
  202. opacity: 0.8;
  203. }
  204. }
  205. }
  206. }
  207. // 底部按钮
  208. .footer-bar {
  209. ::v-deep .u-btn {
  210. width: 100%;
  211. height: 76rpx;
  212. border-radius: 54rpx;
  213. background: linear-gradient(90deg, #77B6FF 0%, #449AFF 100%);
  214. &.u-btn--primary--disabled {
  215. background: #a0cfff;
  216. }
  217. }
  218. }
  219. </style>