integralTransforms.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <view class="integralTransforms">
  3. <view class="header">
  4. <text class="title">{{ jifen || '0.00' }}</text><br>
  5. <text>可转换积分</text>
  6. </view>
  7. <view class="account">
  8. <text class="title">收款人UID</text>
  9. <input type="number" placeholder="请输入收款人UID" v-model="account" />
  10. </view>
  11. <view class="num">
  12. <text class="title">转账数量</text>
  13. <view class="">
  14. <text class="ti">¥</text>
  15. <input type="number" v-model.number="num" placeholder="请输入转账数量" />
  16. </view>
  17. </view>
  18. <view class="button" @click="submit">
  19. 提交申请
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. // import { goPay } from '@/api/finance.js';
  25. import { spreadCommission, userBalance } from '@/api/wallet.js';
  26. import { mapState, mapMutations } from 'vuex';
  27. export default {
  28. data() {
  29. return {
  30. password:'',//交易密码
  31. jifen:'',//可转积分
  32. num: '', //转账数量
  33. account: '', //收款人账户
  34. type:''
  35. }
  36. },
  37. methods: {
  38. submit() {
  39. let obj = this
  40. if(obj.account == ''){
  41. obj.$api.msg('请输入对方账号ID')
  42. return
  43. }
  44. if(obj.num ==''){
  45. obj.$api.msg('请输入转账数量')
  46. return
  47. }
  48. if(obj.account == this.userInfo.uid){
  49. obj.$api.msg('请勿转账给自己')
  50. return
  51. }
  52. goPay({
  53. num: obj.num,
  54. uid: obj.account,
  55. }).then(data =>{
  56. console.log(data,'转账')
  57. obj.num = ''
  58. obj.account = ''
  59. obj.$api.msg('转账成功')
  60. })
  61. }
  62. },
  63. computed: {
  64. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  65. },
  66. onLoad(option) {
  67. // 获取用户余额
  68. userBalance({}).then(({ data }) => {
  69. this.jifen = data.now_money;
  70. });
  71. },
  72. watch: {
  73. num() {
  74. if (this.num > this.jifen) {
  75. this.num = this.jifen
  76. }
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. .integralTransforms {
  83. .header,
  84. .account,
  85. .num {
  86. background-color: #fff;
  87. margin: 20rpx 0;
  88. padding: 30rpx;
  89. input {
  90. margin-top: 10rpx;
  91. }
  92. .title {
  93. font-size: 30rpx;
  94. color: #333333;
  95. font-family: PingFang-SC-Regular;
  96. }
  97. }
  98. .header {
  99. text-align: center;
  100. text:nth-child(1) {
  101. font-size: 45rpx;
  102. }
  103. text:nth-child(3) {
  104. font-size: 30rpx;
  105. color: #666666;
  106. }
  107. }
  108. .num {
  109. .ti {
  110. float: left;
  111. }
  112. }
  113. .button {
  114. width: 520rpx;
  115. margin: 60rpx auto;
  116. padding: 20rpx;
  117. text-align: center;
  118. border-radius: 10rpx;
  119. background: #FF4C4C;
  120. color: #fff;
  121. }
  122. }
  123. </style>