withdraw.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <view>
  3. <u-navbar title="提现"></u-navbar>
  4. <view class="withdraw">
  5. <view class="withdraw-head">
  6. <p>提现至</p><span>{{code}}</span>
  7. </view>
  8. <view class="withdraw-main">
  9. <p>申请提现金额(元)</p>
  10. <view class="withdraw-input">
  11. <span>¥</span>
  12. <u-input v-model="value" :type="type" placeholder-style="font-size:28px;height:40px;line-height:40px;color:#ccc;" />
  13. </view>
  14. </view>
  15. <view class="withdraw-foot">
  16. <p>可提现余额 ¥{{home.accountBalance}}</p>
  17. <span @click="value=home.accountBalance">全部提现</span>
  18. </view>
  19. </view>
  20. <view class="applyBtn">
  21. <u-button :class="{
  22. 'applyBtn-btn':!value
  23. }" @click="submit()" type="primary">申请提现,7日内到账</u-button>
  24. </view>
  25. <view class="withdraw-tips">
  26. <h4>提现说明:</h4>
  27. <p>由于银行清算,提现申请将于次日内到账。如遇高峰期,可能延时到账,请耐心等待。</p>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import * as API from '@/apis/finance.js'
  33. import {
  34. substrMb
  35. } from '@/utils'
  36. export default {
  37. data() {
  38. return {
  39. code:"",
  40. value: '',
  41. type: 'number',
  42. home:{
  43. accountBalance:0
  44. },
  45. }
  46. },
  47. onReady() {
  48. this.getHomePage()
  49. },
  50. onShow(){
  51. this.getHomePage()
  52. },
  53. methods: {
  54. submit(){
  55. if(this.value>0&&this.value<=this.home.accountBalance){
  56. }else{
  57. uni.showToast({
  58. title: "请输入正确的金额"
  59. })
  60. return
  61. }
  62. uni.showLoading({
  63. title: "加载中",
  64. mask: true,
  65. })
  66. API.applyWithdraw({
  67. amount:this.value
  68. }).then((res) => {
  69. uni.redirectTo({
  70. url:"/pagesFinance/user/applyResult?value="+this.value
  71. })
  72. }).catch(error => {
  73. uni.showToast({
  74. title: error
  75. })
  76. })
  77. },
  78. getHomePage(){
  79. uni.showLoading({
  80. title: "加载中",
  81. mask: true,
  82. })
  83. API.homePage().then((res) => {
  84. this.home = res.data
  85. var bankCard="";
  86. if(this.home.bankCard){
  87. bankCard=substrMb(this.home.bankCard,0,4)+"****"+substrMb(this.home.bankCard,8,4)
  88. }
  89. this.code=this.home.bank+":"+bankCard;
  90. if(this.home.bank==null&&this.home.bankCard==null){
  91. this.code="未绑定"
  92. }
  93. uni.hideLoading()
  94. }).catch(error => {
  95. uni.showToast({
  96. title: error
  97. })
  98. })
  99. }
  100. }
  101. }
  102. </script>
  103. <style>
  104. page{
  105. background-color: #F7F7F7;
  106. }
  107. </style>
  108. <style lang="scss" scoped>
  109. .withdraw-tips{
  110. margin:24px 16px;
  111. p{
  112. color:#999;
  113. margin-top: 4px;
  114. }
  115. }
  116. .withdraw{
  117. margin: 16px;
  118. background-color: #fff;
  119. padding: 16px;
  120. .withdraw-head{
  121. display: flex;
  122. align-items: center;
  123. p{
  124. color:#999;
  125. }
  126. span{
  127. margin-left: 12px;
  128. }
  129. }
  130. .withdraw-main{
  131. border-top: 1px solid #f7f7f7;
  132. border-bottom: 1px solid #f7f7f7;
  133. margin: 16px 0;
  134. padding: 16px 0;
  135. .withdraw-input{
  136. margin-top: 32px;
  137. display: flex;
  138. align-items: center;
  139. font-size: 28px;
  140. /deep/.uni-input-input{
  141. font-size: 28px;
  142. }
  143. }
  144. }
  145. .withdraw-foot{
  146. display: flex;
  147. align-items: center;
  148. p{
  149. color:#999
  150. }
  151. span{
  152. color:#2979FF;
  153. margin-left: 16px;
  154. }
  155. }
  156. }
  157. .applyBtn{
  158. margin: 16px;
  159. }
  160. .applyBtn-btn{
  161. background-color: #185AC6;
  162. opacity: 0.5;
  163. border-color:#185AC6 ;
  164. border-radius: 8px;
  165. }
  166. </style>