withdraw.vue 3.3 KB

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