withdrawal.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="withdrawal">
  3. <!-- 提现头部 -->
  4. <view class="withdrawal-top">
  5. <view class="title"> 到账方式 </view>
  6. <view class="wx">
  7. <image src="../../static/mine/323.png" class="wx-logo" mode=""></image>
  8. <text>微信余额</text>
  9. </view>
  10. </view>
  11. <!-- 提现头部 -->
  12. <view class="content">
  13. <view class="money"> 提现金额 </view>
  14. <view class="inp">
  15. <text>¥</text>
  16. <input type="number" v-model="money" />
  17. <text style="color: #f83224" @click="whole">全部提现</text>
  18. </view>
  19. <text class="all-money" v-if="type == 'balance'"
  20. >可提现金额¥{{ userInformation.balance }}</text
  21. >
  22. <text class="all-money" v-else
  23. >可提现金额¥{{ userInformation.deposit }}</text
  24. >
  25. <button class="immediately" @click="immediatelyWithdrawal">
  26. 立即提现
  27. </button>
  28. <view class="detail" @click="toWithdrawalDetail"> 提现明细 </view>
  29. </view>
  30. <u-toast ref="uToast"></u-toast>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. data() {
  36. return {
  37. money: "",
  38. userInformation: {},
  39. type: "",
  40. };
  41. },
  42. onLoad(options) {
  43. this.type = options.type;
  44. if (options.type == "deposit") {
  45. uni.setNavigationBarTitle({ title: "保证金提现" });
  46. } else {
  47. uni.setNavigationBarTitle({ title: "余额提现" });
  48. }
  49. },
  50. methods: {
  51. toWithdrawalDetail() {
  52. uni.navigateTo({
  53. url: "/pageC/withdrawalDetail/withdrawalDetail?type=" + this.type,
  54. });
  55. },
  56. //立即提现
  57. immediatelyWithdrawal() {
  58. uni.$u.http
  59. .post(`/api/withdraw`, { amount: this.money, account_type: this.type })
  60. .then((res) => {
  61. this.money = "";
  62. this.getUserInfo();
  63. this.$refs.uToast.show({
  64. type: "default",
  65. title: "默认主题",
  66. message: "已提交提现申请",
  67. });
  68. });
  69. },
  70. whole() {
  71. this.money = this.userInformation.balance;
  72. },
  73. //获取余额
  74. getUserInfo() {
  75. uni.$u.http.get(`/api/member/info`).then((res) => {
  76. this.userInformation = res;
  77. });
  78. },
  79. },
  80. mounted() {
  81. this.getUserInfo();
  82. },
  83. };
  84. </script>
  85. <style scoped lang="scss">
  86. .withdrawal {
  87. padding: 20rpx 24rpx 0;
  88. .withdrawal-top {
  89. display: flex;
  90. justify-content: space-between;
  91. align-items: center;
  92. height: 104rpx;
  93. background-color: #fff;
  94. border-radius: 16rpx;
  95. padding: 0 24rpx;
  96. .title {
  97. font-size: 30rpx;
  98. }
  99. .wx {
  100. display: flex;
  101. align-items: center;
  102. height: 50rpx;
  103. .wx-logo {
  104. width: 40rpx;
  105. height: 40rpx;
  106. margin-right: 10rpx;
  107. }
  108. }
  109. }
  110. .content {
  111. background-color: #fff;
  112. border-radius: 16rpx;
  113. margin-top: 16rpx;
  114. padding: 32rpx 24rpx 46rpx;
  115. .money {
  116. font-size: 30rpx;
  117. }
  118. .inp {
  119. display: flex;
  120. height: 110rpx;
  121. align-items: center;
  122. justify-content: space-between;
  123. border-bottom: 2rpx solid rgba(151, 151, 151, 0.3);
  124. margin-bottom: 18rpx;
  125. }
  126. .all-money {
  127. font-size: 24rpx;
  128. color: #555;
  129. }
  130. .immediately {
  131. box-shadow: 0rpx 12rpx 28rpx -12rpx #f83224;
  132. border-radius: 44rpx;
  133. background-color: #f83224;
  134. color: #fff;
  135. margin-top: 60rpx;
  136. margin-bottom: 60rpx;
  137. }
  138. .detail {
  139. text-align: center;
  140. font-size: 26rpx;
  141. opacity: 0.6;
  142. color: #131415;
  143. }
  144. }
  145. }
  146. </style>