withdrawTwo.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <view class="container">
  3. <view class="u-plr30">
  4. <view class="u-bg-fff u-p30 u-mt20">
  5. <view class="u-flex-center-sb">
  6. <view>
  7. <text>可转入金额</text>
  8. <text class="u-ml20 u-00BF5A u-bold u-font36">{{
  9. walletInfo.commission_able
  10. }}</text>
  11. </view>
  12. <view @click="goWallet">
  13. <text class="iconfont">&#xe638;</text>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="wdInput u-mt20">
  18. <view class="u-mt20 input u-flex">
  19. <text>¥</text>
  20. <input
  21. class="u-ml10"
  22. maxlength="10"
  23. type="digit"
  24. @input="getMoney"
  25. v-model="dataForm.money"
  26. placeholder="输入金额"
  27. />
  28. </view>
  29. </view>
  30. <view class="apply-btn" @click="requestWithdrawal">
  31. <button class="u-btn-two">确定转入</button>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script setup>
  37. import { ref } from "vue";
  38. import { onLoad } from "@dcloudio/uni-app";
  39. const $http = uni.$http;
  40. const dataForm = ref({
  41. money: "", // 提现金额
  42. });
  43. const walletInfo = ref({
  44. min_extract: 0,
  45. wait_account: 0,
  46. freezing: 0,
  47. }); // 账户信息
  48. // 生命周期
  49. onLoad(() => {
  50. // 获取账户信息
  51. $http.get("/withdraw/getWalletInfo", {}).then(async (res) => {
  52. if (res && res.code == 200) {
  53. if (res.data) {
  54. walletInfo.value = res.data;
  55. }
  56. }
  57. });
  58. });
  59. // 方法
  60. // 跳转到钱包明细
  61. const goWallet = () => {
  62. uni.navigateTo({
  63. url: "./wallet",
  64. });
  65. };
  66. // 获取输入提现金额
  67. const getMoney = (e) => {
  68. e.target.value = e.target.value.match(/^\d*(\.?\d{0,2})/g)[0] || null;
  69. // 重新赋值给 input
  70. setTimeout(() => {
  71. dataForm.value.money = e.target.value;
  72. }, 0);
  73. };
  74. // 申请转入
  75. const requestWithdrawal = () => {
  76. if (!dataForm.value.money) {
  77. uni.$uv.toast("请输入金额");
  78. return false;
  79. }
  80. $http.post("/withdraw/commission-to-balance", dataForm.value).then((res) => {
  81. if (res && res.code == 200) {
  82. uni.$uv.toast("转入成功");
  83. setTimeout(() => {
  84. uni.navigateBack({
  85. success: () => {
  86. let page = getCurrentPages().pop(); // 跳转页面成功之后
  87. if (!page) {
  88. return;
  89. } else {
  90. page.onLoad(page.options); // page 自带 options 对象.
  91. }
  92. },
  93. });
  94. }, 2000);
  95. } else {
  96. uni.$uv.toast(res.msg);
  97. }
  98. });
  99. };
  100. </script>
  101. <style lang="scss" scoped>
  102. page {
  103. background-color: #f5f5f5;
  104. }
  105. .wt112 {
  106. width: 140rpx;
  107. }
  108. .img30 {
  109. width: 30rpx;
  110. height: 30rpx;
  111. }
  112. .wd-bgImg {
  113. position: relative;
  114. padding: 25rpx 0rpx;
  115. image {
  116. width: 100%;
  117. height: 200rpx;
  118. vertical-align: bottom;
  119. }
  120. .moneyInfo {
  121. position: absolute;
  122. top: 25rpx;
  123. width: 92%;
  124. .mt40 {
  125. margin-top: 40rpx;
  126. }
  127. .detail-btn button {
  128. height: 56rpx;
  129. line-height: 30rpx;
  130. border-radius: 28px;
  131. opacity: 0.82;
  132. padding: 10rpx 30rpx;
  133. background-color: #eed9a9;
  134. color: #fa6138;
  135. }
  136. }
  137. }
  138. .wdInput {
  139. background-color: #ffffff;
  140. border-radius: 18rpx 18rpx 0px 0rpx;
  141. padding: 40rpx 22rpx 32rpx;
  142. .input {
  143. height: 80rpx;
  144. line-height: 80rpx;
  145. font-size: 60rpx;
  146. border-bottom: 1rpx solid #d9d9d9;
  147. padding-bottom: 25rpx;
  148. input {
  149. height: 80rpx;
  150. line-height: 80rpx;
  151. font-size: 36rpx;
  152. }
  153. }
  154. }
  155. .bg-fff {
  156. background-color: #ffffff;
  157. padding: 26rpx 22rpx 36rpx;
  158. border-radius: 0rpx 0rpx 18px 18rpx;
  159. }
  160. .ml46 {
  161. margin-left: 46rpx;
  162. }
  163. .apply-btn {
  164. margin-top: 80rpx;
  165. button {
  166. background: #fa6138;
  167. color: #ffffff;
  168. }
  169. }
  170. .zfb-wx {
  171. padding-bottom: 24rpx;
  172. .payIcon {
  173. color: #00aaef;
  174. font-size: 32rpx;
  175. margin-right: 18rpx;
  176. }
  177. .wxIcon {
  178. color: rgb(37, 171, 56);
  179. font-size: 32rpx;
  180. margin-right: 18rpx;
  181. }
  182. }
  183. .zhInput input {
  184. width: 62%;
  185. height: 70rpx;
  186. line-height: 70rpx;
  187. padding: 0rpx 20rpx;
  188. border: 1rpx solid #d9d9d9;
  189. border-radius: 6rpx;
  190. }
  191. .popup {
  192. width: 100%;
  193. .bg-top {
  194. background-color: #f5f5f5;
  195. padding: 20rpx 30rpx;
  196. border-radius: 18rpx 18rpx 0px 0px;
  197. }
  198. .bankCardList {
  199. background-color: #ffffff;
  200. padding: 0rpx 30rpx;
  201. padding-bottom: 185rpx;
  202. .item {
  203. height: 84rpx;
  204. line-height: 84rpx;
  205. image {
  206. width: 48rpx;
  207. height: 42rpx;
  208. margin-top: 20rpx;
  209. vertical-align: bottom;
  210. }
  211. .rh-br {
  212. width: 100%;
  213. border-bottom: 1rpx solid #e6e6e6;
  214. }
  215. .pull-right {
  216. float: right !important;
  217. }
  218. }
  219. }
  220. }
  221. .ml56 {
  222. margin-left: 56rpx;
  223. }
  224. .ml200 {
  225. margin-left: 200rpx;
  226. }
  227. </style>