transfer.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="container">
  3. <view class="top-two">
  4. <view class="count">{{ money || 0 }}</view>
  5. <view class="text">可转账佣金</view>
  6. </view>
  7. <view class="top-three">
  8. <view class="text">收款人账户</view>
  9. <input class="input" type="text" placeholder="请输入收款人账户" v-model="to_user_account" />
  10. </view>
  11. <view class="top-three">
  12. <view class="text">收款人UID</view>
  13. <input class="input" type="number" placeholder="请输入收款人UID" v-model="to_uid" />
  14. </view>
  15. <view class="top-four">
  16. <view class="text">转账数量</view>
  17. <view class="row">
  18. <text class="tit">¥</text>
  19. <input class="input" type="number" placeholder="请输入转账数量" v-model="num" />
  20. </view>
  21. </view>
  22. <view class="btn" @click="sub">提交申请</view>
  23. </view>
  24. </template>
  25. <script>
  26. import { trade, getSpreadCount } from '@/api/user.js';
  27. export default {
  28. data() {
  29. return {
  30. num: '', //转账金额
  31. to_user_account: '', //收款人账户
  32. to_uid: '', //收款人UID
  33. money: 0
  34. };
  35. },
  36. onLoad() {
  37. this.getNum();
  38. },
  39. methods: {
  40. nav(url) {
  41. uni.navigateTo({
  42. url
  43. });
  44. },
  45. sub() {
  46. let obj = this;
  47. if (obj.num == '') {
  48. return this.$api.msg('转账金额不能为空!');
  49. }
  50. if (obj.num * 1 > obj.money * 1) {
  51. return this.$api.msg('可转账金额不足!');
  52. }
  53. if (obj.to_user_account == '') {
  54. return this.$api.msg('请输入收款人账户!');
  55. }
  56. if (obj.to_uid == '') {
  57. return this.$api.msg('请输入转账金额!');
  58. }
  59. trade({
  60. type: 'brokerage_price',
  61. num: obj.num,
  62. to_user_account: obj.to_user_account,
  63. to_uid: obj.to_uid
  64. }).then(res => {
  65. uni.showToast({
  66. title: '转账成功',
  67. duration: 2000
  68. });
  69. }).catch(err =>{
  70. console.log(err)
  71. });
  72. },
  73. getNum() {
  74. getSpreadCount({}, 3).then(({ data }) => {
  75. console.log(data);
  76. this.money = +data.count;
  77. });
  78. }
  79. }
  80. };
  81. </script>
  82. <style lang="scss">
  83. .container {
  84. background-color: #f2f3f5;
  85. width: 750rpx;
  86. // height: 1334rpx;
  87. .top-two {
  88. padding-bottom: 20rpx;
  89. background-color: #fff;
  90. .count {
  91. text-align: center;
  92. height: 50rpx;
  93. font-size: 42rpx;
  94. font-family: PingFang SC;
  95. font-weight: bold;
  96. color: #333333;
  97. line-height: 110rpx;
  98. margin: 0 auto;
  99. }
  100. .text {
  101. width: 140rpx;
  102. // height: 26rpx;
  103. font-size: 28rpx;
  104. font-family: PingFang SC;
  105. font-weight: 500;
  106. color: #666666;
  107. margin: 0 auto;
  108. margin-top: 50rpx;
  109. }
  110. }
  111. .top-three {
  112. margin-top: 20rpx;
  113. height: 160rpx;
  114. background-color: #fff;
  115. .text {
  116. width: 150rpx;
  117. height: 29rpx;
  118. font-size: 30rpx;
  119. font-family: PingFang SC;
  120. font-weight: 400;
  121. color: #333333;
  122. line-height: 110rpx;
  123. margin-left: 25rpx;
  124. }
  125. .input {
  126. margin-top: 65rpx;
  127. margin-left: 25rpx;
  128. }
  129. }
  130. .top-four {
  131. margin-top: 20rpx;
  132. height: 160rpx;
  133. background-color: #fff;
  134. .text {
  135. width: 150rpx;
  136. height: 29rpx;
  137. font-size: 30rpx;
  138. font-family: PingFang SC;
  139. font-weight: 400;
  140. color: #333333;
  141. line-height: 110rpx;
  142. margin-left: 25rpx;
  143. }
  144. .row {
  145. display: flex;
  146. // justify-content: center;
  147. margin-top: 65rpx;
  148. margin-left: 20rpx;
  149. .tit {
  150. font-size: 30rpx;
  151. font-family: PingFang SC;
  152. font-weight: 400;
  153. color: #333333;
  154. margin-right: 10rpx;
  155. }
  156. }
  157. }
  158. .btn {
  159. display: flex;
  160. justify-content: center;
  161. align-items: center;
  162. width: 674rpx;
  163. height: 90rpx;
  164. background: linear-gradient(-35deg, #f8dd4f, #fbeb77);
  165. border-radius: 44rpx;
  166. margin-top: 138rpx;
  167. margin-left: 38rpx;
  168. }
  169. }
  170. </style>