index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view class="withdrawal-main">
  3. <view class="withdrawal-item">
  4. <label class="withdrawal-label">提现到账</label>
  5. <view class="withdrawal-item-right" @click="openSheet">
  6. <view class="withdrawal-text">微信零钱</view>
  7. <up-icon name="arrow-right"></up-icon>
  8. </view>
  9. </view>
  10. <view class="withdrawal-item" >
  11. <label class="withdrawal-label">提现金额</label>
  12. </view>
  13. <view class="price-box">
  14. <up-icon name="rmb" size="28" color="rgba(0, 0, 0, 1)"></up-icon>
  15. <input class="price-input" placeholder="请输入提现金额" border="none" v-model="priceValue" @change="change" />
  16. </view>
  17. <view class="withdrawal-item">
  18. <label class="withdrawal-label">可提现余额 <up-icon name="rmb"></up-icon>{{ maxPrice }}</label>
  19. <view class="withdrawal-item-right" @click="onMaxChange">
  20. <view class="withdrawal-text">全部提现</view>
  21. </view>
  22. </view>
  23. <view style="margin-top: 45px;">
  24. <up-button type="primary" text="确定提现" @click="onSubmit" ></up-button>
  25. </view>
  26. <up-action-sheet
  27. :show="show"
  28. @close="close"
  29. @select="select"
  30. :actions="actions"
  31. >
  32. </up-action-sheet>
  33. </view>
  34. </template>
  35. <script setup>
  36. import { ref } from 'vue';
  37. const actions = [
  38. {
  39. name: '微信零钱',
  40. }
  41. ]
  42. const show = ref(false);
  43. const maxPrice = ref(1200);
  44. const priceValue = ref('');
  45. const change = (e) => {
  46. console.log('change', e);
  47. const regex = /^\d*\.?\d*$/;
  48. if (!regex.test(e.detail.value)) {
  49. priceValue.value = priceValue.value.replace(/[^\d.]/g, '');
  50. }
  51. };
  52. const openSheet = (index) => {
  53. show.value = true;
  54. }
  55. const close = () => {
  56. show.value = false;
  57. }
  58. const select = (index) => {
  59. console.log('select', index);
  60. }
  61. const onSubmit = () => {
  62. uni.showToast({
  63. title: '提交成功',
  64. icon: 'none'
  65. })
  66. }
  67. const onMaxChange = () => {
  68. priceValue.value = maxPrice.value;
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .withdrawal-main {
  73. position: fixed;
  74. top: 0px;
  75. left: 0px;
  76. right: 0px;
  77. bottom: 0px;
  78. background-color: #fff;
  79. padding: 0 12px;
  80. .withdrawal-item {
  81. display: flex;
  82. align-items: center;
  83. justify-content: space-between;
  84. padding: 12px 0;
  85. .withdrawal-label {
  86. font-size: 14px;
  87. font-weight: 500;
  88. line-height: 20.27px;
  89. color: rgba(153, 153, 153, 1);
  90. display: flex;
  91. align-items: center;
  92. }
  93. .withdrawal-item-right {
  94. display: flex;
  95. align-items: center;
  96. .withdrawal-text {
  97. font-size: 16px;
  98. font-weight: 700;
  99. line-height: 23.17px;
  100. color: rgba(0, 0, 0, 1);
  101. margin-right: 6px;
  102. }
  103. }
  104. }
  105. .price-box {
  106. display: flex;
  107. .price-input {
  108. flex: 1;
  109. height: 58px;
  110. padding: 0 12px;
  111. font-size: 28px;
  112. }
  113. }
  114. }
  115. </style>