withdrawal.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view>
  3. <view class="withdrawal-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"
  13. >可提现金额<span>{{ distributionData.canRebate | unitPrice }}</span
  14. >元</view
  15. >
  16. </view>
  17. </view>
  18. </view>
  19. <view class="submit" @click="cashd">提现</view>
  20. </view>
  21. </template>
  22. <script>
  23. import { distribution, cash } from "@/api/goods";
  24. export default {
  25. data() {
  26. return {
  27. price: 0,
  28. distributionData: "",
  29. };
  30. },
  31. mounted() {
  32. this.init();
  33. },
  34. methods: {
  35. cashd() {
  36. this.price = this.price + "";
  37. if (this.$u.test.amount(parseInt(this.price))) {
  38. cash({ price: this.price }).then((res) => {
  39. if(res.data.success){
  40. uni.showToast({
  41. title: '提现成功!',
  42. duration: 2000,
  43. icon:"none"
  44. });
  45. setTimeout(()=>{
  46. uni.navigateBack({
  47. delta: 1
  48. });
  49. },1000)
  50. }
  51. });
  52. } else {
  53. uni.showToast({
  54. title: "请输入正确金额",
  55. duration: 2000,
  56. icon: "none",
  57. });
  58. }
  59. },
  60. handleAll() {
  61. this.price = this.distributionData.canRebate;
  62. },
  63. /**
  64. * 初始化推广商品
  65. */
  66. init() {
  67. uni.showLoading({
  68. title: "加载中",
  69. });
  70. distribution().then((res) => {
  71. if (res.data.result) {
  72. this.distributionData = res.data.result;
  73. }
  74. uni.hideLoading();
  75. });
  76. },
  77. },
  78. };
  79. </script>
  80. <style lang="scss" scoped>
  81. /deep/ .u-input__input,
  82. .u-input {
  83. font-size: 80rpx !important;
  84. height: 102rpx !important;
  85. }
  86. /deep/ .u-input__input{
  87. height: 100%;
  88. font-size: 80rpx;
  89. }
  90. .content {
  91. display: flex;
  92. > .price {
  93. width: 60%;
  94. margin: 20rpx 0;
  95. font-size: 80rpx;
  96. display: flex;
  97. }
  98. > .all {
  99. justify-content: center;
  100. width: 40%;
  101. display: flex;
  102. flex-direction: column;
  103. align-items: flex-end;
  104. }
  105. }
  106. .withdrawal-list {
  107. margin: 20rpx 0;
  108. background: #fff;
  109. padding: 16rpx 32rpx;
  110. }
  111. .title {
  112. font-size: 35rpx;
  113. }
  114. .submit {
  115. margin: 80rpx auto;
  116. width: 94%;
  117. background: $light-color;
  118. height: 90rpx;
  119. color: #fff;
  120. border-radius: 10rpx;
  121. text-align: center;
  122. line-height: 90rpx;
  123. }
  124. </style>