index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <page title="提现" ref="pageRef">
  3. <view class="paddingX12 paddingT18">
  4. <view class="cu-form-group" @click="gotoCardInfo">
  5. <view class="">提现至</view>
  6. <view>
  7. {{
  8. bankInfo && bankInfo.bankName
  9. ? bankInfo.bankName + '尾号(' + bankInfo.bankNum.slice(-4) + ')'
  10. : '暂无银行卡信息'
  11. }}
  12. </view>
  13. <text class="cuIcon-right"></text>
  14. </view>
  15. </view>
  16. <view class="paddingX12 paddingT14">
  17. <view class="cu-form-group">
  18. <view class="">可提现金额:{{ balance }}元</view>
  19. <view></view>
  20. <div style="color: #5b5b5b" @click.stop="show('wallet_withdraw_gz')">
  21. <text class="cuIcon-questionfill"></text>
  22. 提现规则
  23. </div>
  24. </view>
  25. <view class="cu-form-group">
  26. <view class="font6 bold left">¥</view>
  27. <input
  28. v-model.trim="money"
  29. type="digit"
  30. placeholder="请输入提现金额"
  31. class="flex1 marginX10 font5"
  32. />
  33. <div style="color: #ff9600" @click="money = balance">全部提现</div>
  34. </view>
  35. <view class="paddingX12 paddingB14" style="background-color: #fff">
  36. <view class="" style="color: #333333; background-color: #f8f8f8">
  37. <view class="cu-form-group" style="color: #333333; background-color: #f8f8f8">
  38. <view class="">税率:</view>
  39. <div>{{ rate * 100 }}%</div>
  40. </view>
  41. <view class="cu-form-group" style="color: #333333; background-color: #f8f8f8">
  42. <view class="">实际到账金额:</view>
  43. <div>{{ realMoney }}</div>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view
  49. class="marginT18 text-center"
  50. style="font-size: 24rpx; color: #999999"
  51. @click="$router.push('withdraw_record')"
  52. >
  53. 提现记录
  54. </view>
  55. <view class="agree" @click="agreeFlag = !agreeFlag">
  56. <radio :checked="agreeFlag" style="transform: scale(0.6)" color="#8b3dff" />
  57. <text>
  58. 我已阅读并同意
  59. <text class="color-theme" @click.stop="show('wallet_withdraw_xy')">
  60. 《提现协议》
  61. </text>
  62. </text>
  63. </view>
  64. <view class="paddingX26 paddingT6 radius2" style="background-color: #f6f6f6">
  65. <cm-button :height="37" @click="apply">确认提现</cm-button>
  66. </view>
  67. <rule ref="ruleRef"></rule>
  68. </page>
  69. </template>
  70. <script>
  71. import resource from '@/utils/resource'
  72. import { throttle } from '@/utils'
  73. import rule from './rule.vue'
  74. export default {
  75. components: {
  76. rule
  77. },
  78. data() {
  79. return {
  80. resource,
  81. pre: null,
  82. balance: null,
  83. desc: '',
  84. type: 'ALIPAY',
  85. money: '',
  86. idName: null,
  87. idNum: null,
  88. accountNo: '',
  89. bankInfo: null,
  90. rate: 0,
  91. agreeFlag: false
  92. }
  93. },
  94. computed: {
  95. realMoney() {
  96. let val = this.money - this.money * this.rate
  97. return val
  98. }
  99. },
  100. onLoad(option) {
  101. this.type = option.type || 'ALIPAY'
  102. },
  103. onShow() {
  104. this.getPre()
  105. this.getWithdraw()
  106. this.getRate()
  107. },
  108. methods: {
  109. async getPre() {
  110. const res = await this.$service.wallet.withdrawPre(this.type, 'MAGIC_PROMOTION')
  111. if (res) {
  112. if (res.account && res.account.idName) {
  113. this.idName = res.account.idName
  114. this.idNum = res.account.idNum
  115. this.accountNo = res.account.accountNo
  116. }
  117. this.balance = res.avaliableWithdraw.amount
  118. this.desc = res.avaliableWithdraw.desc
  119. }
  120. },
  121. async getRate() {
  122. const res = await this.$service.user.getParamConfig('wallet_withdraw_rate')
  123. this.rate = res.data
  124. },
  125. async getWithdraw() {
  126. const res = await this.$service.wallet.getWithdraw()
  127. this.bankInfo = res
  128. },
  129. apply() {
  130. if (!this.agreeFlag) {
  131. this.$message.warn('请您先阅读并同意提现协议')
  132. return
  133. }
  134. if (!this.bankInfo.bankNum) {
  135. this.$message.warn('请新增银行卡信息')
  136. return
  137. }
  138. if (!this.money || this.money > this.balance) {
  139. this.$message.warn('请输入正确的金额')
  140. return
  141. }
  142. throttle.call(() => {
  143. this.realApply()
  144. })
  145. },
  146. async realApply() {
  147. const res = await this.$service.wallet.withdraw({
  148. money: this.money,
  149. ...this.bankInfo,
  150. walletType:'MAGIC_PROMOTION',
  151. accountType:'3'
  152. })
  153. if (res) {
  154. this.$router.push('withdraw_record')
  155. this.money = ''
  156. }
  157. },
  158. gotoCardInfo() {
  159. this.$router.push('cardInfo')
  160. },
  161. show(type) {
  162. console.log(type)
  163. this.$refs.ruleRef.show(type)
  164. }
  165. }
  166. }
  167. </script>
  168. <style>
  169. page {
  170. background: #fff;
  171. }
  172. </style>
  173. <style lang="scss" scoped>
  174. .input-wrapper {
  175. width: 100%;
  176. height: 104rpx;
  177. border-radius: 16rpx;
  178. padding: 0 15rpx;
  179. .left {
  180. width: 160rpx;
  181. }
  182. }
  183. .un-check {
  184. width: 36rpx;
  185. height: 36rpx;
  186. border: 2rpx solid $color-theme;
  187. border-radius: 4rpx;
  188. }
  189. .check {
  190. width: 36rpx;
  191. height: 36rpx;
  192. }
  193. .cu-form-group {
  194. border-top: none;
  195. }
  196. .agree {
  197. text-align: center;
  198. font-size: 24rpx;
  199. margin-top: 50rpx;
  200. display: flex;
  201. align-items: center;
  202. justify-content: center;
  203. }
  204. </style>