withdrawal.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <view>
  3. <view class="-list">
  4. <view class="title">提现金额</view>
  5. <view class="content">
  6. <view class="price">
  7. <span> ¥</span>
  8. <u-input v-model="price" placeholder="" type="number" />
  9. </view>
  10. <view class="all">
  11. <view @click="handleAll" :style="{ color: $mainColor }">全部</view>
  12. <view style="font-size: 24rpx; color: #999">可提现金额<span>{{ walletNum | unitPrice }}</span>元</view>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="submit" @click="cashd">提现</view>
  17. </view>
  18. </template>
  19. <script>
  20. import { getUserWallet,withdrawalApply } from "@/api/members";
  21. export default {
  22. data() {
  23. return {
  24. price: 0,
  25. walletNum: 0,
  26. };
  27. },
  28. async mounted() {
  29. let result = await getUserWallet(); //预存款
  30. this.walletNum = result.data.result.memberWallet;
  31. },
  32. methods: {
  33. cashd() {
  34. this.price = this.price + "";
  35. if (this.$u.test.amount(parseInt(this.price))) {
  36. withdrawalApply({ price: this.price }).then((res) => {
  37. if (res.data.success) {
  38. uni.showToast({
  39. title: "提现成功!",
  40. duration: 2000,
  41. icon: "none",
  42. });
  43. setTimeout(() => {
  44. uni.navigateBack({
  45. delta: 1,
  46. });
  47. }, 1000);
  48. }
  49. });
  50. } else {
  51. uni.showToast({
  52. title: "请输入正确金额",
  53. duration: 2000,
  54. icon: "none",
  55. });
  56. }
  57. },
  58. handleAll() {
  59. this.price = this.walletNum;
  60. },
  61. },
  62. };
  63. </script>
  64. <style lang="scss" scoped>
  65. @import "./style.scss";
  66. </style>