user_withdraw.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <!-- 提现 -->
  2. <template>
  3. <view class="user-withdraw">
  4. <!-- Tabs -->
  5. <view class="withdraw-tabs">
  6. <u-tabs :list="tabsList" :is-scroll="true" :current="currentTab" :bold="true" height="100"
  7. font-size="30rpx" active-color="#333333" inactive-color="#666666" :bar-style="styleTabsBarStyle"
  8. @change="changeTab" />
  9. </view>
  10. <!-- 微信钱包 -->
  11. <view v-if="currentValue == 3" class="withdraw-wechat m-t-20 bg-white">
  12. <!-- Account -->
  13. <u-field label-width="160" label="微信账号" v-model="form.account" placeholder="请输入微信账号" />
  14. <!-- Name -->
  15. <u-field label-width="160" label="真实姓名" v-model="form.real_name" placeholder="请输入真实姓名" />
  16. <!-- Remark -->
  17. <u-field label-width="160" label="备注" v-model="form.remark" placeholder="(选填)" />
  18. <!-- 上传图片 -->
  19. <view class="flex-col m-t-20">
  20. <u-upload ref="uUpload" :header="{token: $store.getters.token}" :auto-upload="true" :show-progress="false" max-count="1" width="142" height="142" :custom-btn="true" :action="action" @on-success="onSuccess" @on-remove="onRemove" >
  21. <view slot="addBtn" class="flex-col col-center row-center">
  22. <view class="upload-image flex-col col-center row-center" >
  23. <u-icon name="/bundle/static/icon_camera_line.png" width="54" />
  24. </view>
  25. <view class="xs m-t-10">微信收款码</view>
  26. </view>
  27. </u-upload>
  28. </view>
  29. </view>
  30. <!-- 支付宝 -->
  31. <view v-else-if="currentValue == 4" class="withdraw-alipay m-t-20 bg-white">
  32. <!-- Account -->
  33. <u-field label-width="160" label="支付宝账号" v-model="form.account" placeholder="请输入支付宝账号" />
  34. <!-- Name -->
  35. <u-field label-width="160" label="真实姓名" v-model="form.real_name" placeholder="请输入真实姓名" />
  36. <!-- Remark -->
  37. <u-field label-width="160" label="备注" v-model="form.remark" placeholder="(选填)" />
  38. <!-- 上传图片 -->
  39. <view class="flex-col m-t-20">
  40. <u-upload ref="uUpload" :header="{token: $store.getters.token}" :auto-upload="true" :show-progress="false" max-count="1" width="142" height="142" :custom-btn="true" :action="action" @on-success="onSuccess" @on-remove="onRemove" >
  41. <view slot="addBtn" class="flex-col col-center row-center">
  42. <view class="upload-image flex-col col-center row-center" >
  43. <u-icon name="/bundle/static/icon_camera_line.png" width="54" />
  44. </view>
  45. <view class="xs m-t-10">支付宝收款码</view>
  46. </view>
  47. </u-upload>
  48. </view>
  49. </view>
  50. <!-- 银行卡 -->
  51. <view v-else-if="currentValue == 5" class="withdraw-alipay m-t-20 bg-white">
  52. <!-- Account -->
  53. <u-field label-width="160" label="银行卡账号" v-model="form.account" placeholder="请输入银行卡账号" />
  54. <!-- Name -->
  55. <u-field label-width="160" label="持卡人姓名" v-model="form.real_name" placeholder="请输入持卡人姓名" />
  56. <!-- Name -->
  57. <u-field label-width="160" label="提现银行" v-model="form.bank" placeholder="请输入银行名称" />
  58. <!-- Remark -->
  59. <u-field label-width="160" label="银行支行" v-model="form.subbank" placeholder="如:金湾支行" />
  60. <!-- Remark -->
  61. <u-field label-width="160" label="备注" v-model="form.remark" placeholder="(选填)" />
  62. </view>
  63. <!-- 提现金额 -->
  64. <view class="withdraw-money-wrap m-t-20 bg-white">
  65. <view class="flex withdraw-money p-b-20">
  66. <view class="flex flex-1">
  67. <text class="font-size-46 m-r-10 normal">¥</text>
  68. <u-input v-model="form.money" placeholder="0.00" :custom-style="{
  69. 'font-size': '66rpx'
  70. }" />
  71. </view>
  72. <view class="flex-col flex-1 text-right">
  73. <text class="xs primary" @tap="form.money=widthDrawConfig.able_withdraw">全部提现</text>
  74. <text class="xs muted m-t-10">可提现金额 ¥ {{widthDrawConfig.able_withdraw}}</text>
  75. </view>
  76. </view>
  77. <view class="muted xs m-t-30" v-if="widthDrawConfig.poundage_percent && currentValue != 1">提示:提现需扣除服务费{{widthDrawConfig.poundage_percent}}%</view>
  78. </view>
  79. <!-- 确认提交 -->
  80. <button class="withdraw-submit m-t-30 white br60" @tap="onSubmit" size="lg">确认提交</button>
  81. <!-- 提现记录 -->
  82. <router-link to="/bundle/pages/user_withdraw_code/user_withdraw_code">
  83. <view class="withdraw-log m-t-40 text-center muted">提现记录</view>
  84. </router-link>
  85. </view>
  86. </template>
  87. <script>
  88. import {
  89. applyWithdraw,
  90. getWithdrawConfig
  91. } from "@/api/user";
  92. import {
  93. trottle
  94. } from "@/utils/tools";
  95. import {
  96. baseURL
  97. } from '@/config/app';
  98. export default {
  99. data() {
  100. return {
  101. action: baseURL + '/api/file/formimage',
  102. currentTab: 0, // Tabs当前位置
  103. // Tabs 列表
  104. tabsList: [],
  105. // Tabs滑块样式
  106. styleTabsBarStyle: {
  107. bottom: '12rpx',
  108. width: '50rpx',
  109. height: '6rpx',
  110. background: 'green',
  111. borderRadius: '50px',
  112. backgroundImage: 'linear-gradient(to right, \#F79C0C, \#FF2C3C)'
  113. },
  114. // 表单数据
  115. form: {
  116. money: '', // 提现金额
  117. account: '', // 账户名称
  118. real_name: '', // 真实姓名
  119. money_qr_code: '', // 收款二维码
  120. bank: '', // 银行
  121. subbank: '', // 支行
  122. remark: '', // 备注
  123. },
  124. widthDrawConfig: {}
  125. }
  126. },
  127. onLoad() {
  128. this.getWithdrawConfigFun();
  129. this.onSubmit = trottle(this.onSubmit, 1000, this)
  130. },
  131. methods: {
  132. // 改变当前的Tabs位置
  133. changeTab(index) {
  134. this.currentTab = index;
  135. this.form = {
  136. money: '',
  137. account: '',
  138. real_name: '',
  139. money_qr_code: '',
  140. remark: '',
  141. bank: '',
  142. subbank: ''
  143. };
  144. },
  145. async getWithdrawConfigFun() {
  146. const {
  147. code,
  148. data
  149. } = await getWithdrawConfig()
  150. if (code == 1) {
  151. this.widthDrawConfig = data
  152. this.tabsList = data.type
  153. }
  154. },
  155. // 提交表单
  156. onSubmit() {
  157. const data = {
  158. ...this.form
  159. }
  160. data.type = this.currentValue
  161. if (!data.money) {
  162. this.$toast({
  163. title: '请输入提现金额'
  164. });
  165. return;
  166. }
  167. applyWithdraw(data).then(res => {
  168. if (res.code == 1) {
  169. this.$toast({
  170. title: '提交成功'
  171. }, {
  172. tab: 2,
  173. url: '/bundle/pages/widthdraw_result/widthdraw_result?id=' + res.data.id
  174. });
  175. }
  176. });
  177. },
  178. onSuccess(e) {
  179. console.log(e)
  180. this.form.money_qr_code = e.data.base_uri
  181. },
  182. onRemove(index) {
  183. this.form.money_qr_code = ""
  184. },
  185. },
  186. computed: {
  187. currentValue(val) {
  188. const {currentTab, tabsList} = this
  189. return tabsList[currentTab] ? tabsList[currentTab].value : ''
  190. }
  191. }
  192. }
  193. </script>
  194. <style lang="scss" scoped>
  195. .user-withdraw {
  196. padding: 20rpx 30rpx;
  197. .withdraw-tabs {
  198. border-radius: 10px;
  199. overflow: hidden;
  200. }
  201. .withdraw-money-wrap {
  202. padding: 50rpx 66rpx;
  203. border-radius: 10px;
  204. .withdraw-money {
  205. border-bottom: $-solid-border;
  206. }
  207. }
  208. .withdraw-wechat,
  209. .withdraw-alipay {
  210. padding: 0 36rpx 20rpx;
  211. border-radius: 10px;
  212. }
  213. .upload-image {
  214. width: 142rpx;
  215. height: 142rpx;
  216. border: 2rpx dashed #CCCCCC;
  217. border-radius: 5px;
  218. }
  219. .withdraw-submit {
  220. background: linear-gradient(11deg, #F95F2F, #FF2C3C);
  221. }
  222. ::v-deep .u-field {
  223. padding: 26rpx 0;
  224. }
  225. }
  226. </style>