integralTransforms.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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">收款人账户</text>
  9. <input type="number" placeholder="请输入收款人账户" 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="num">
  19. <text class="title">交易密码</text>
  20. <view class="">
  21. <text class="ti">¥</text>
  22. <input type="password" v-model.number="password" placeholder="请输入交易密码" />
  23. </view>
  24. </view>
  25. <view class="button" @click="submit">
  26. 提交申请
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import { goPay,moneyLog, recharge, wallet } from '@/api/finance.js';
  32. import { mapState, mapMutations } from 'vuex';
  33. export default {
  34. data() {
  35. return {
  36. password:'',//交易密码
  37. jifen:'',//可转积分
  38. num: '', //转账数量
  39. account: '', //收款人账户
  40. type:''
  41. }
  42. },
  43. methods: {
  44. submit() {
  45. let obj = this
  46. if(obj.account == ''){
  47. obj.$api.msg('请输入对方账号ID')
  48. return
  49. }
  50. if(obj.num ==''){
  51. obj.$api.msg('请输入转账数量')
  52. return
  53. }
  54. if(obj.password == ''){
  55. obj.$api.msg("请输入交易密码")
  56. }
  57. if(obj.account == this.userInfo.uid){
  58. obj.$api.msg('请勿转账给自己')
  59. return
  60. }
  61. goPay({
  62. type: 'SCJF',
  63. num: obj.num,
  64. to_uid: obj.account,
  65. trade_psw: obj.password,
  66. // to_user_account: obj.account
  67. }).then(data =>{
  68. console.log(data,'转账')
  69. obj.num = ''
  70. obj.account = ''
  71. obj.password = ''
  72. uni.navigateTo({
  73. url:'/pages/money/success'
  74. })
  75. })
  76. }
  77. },
  78. computed: {
  79. //积分
  80. // integral() {
  81. // return this.$store.state.user.userInfo.integral
  82. // console.log(UserInfo)
  83. // },
  84. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  85. },
  86. onLoad(option) {
  87. console.log(this.userInfo)
  88. wallet({}).then(({data}) => {
  89. const obj = this
  90. const arr = Object.keys(data.back)
  91. console.log(data.back)
  92. arr.forEach(e => {
  93. if(e =='SCJF'){
  94. obj.jifen = (data.back[e].money.money * 1)
  95. console.log(obj.jifen)
  96. }
  97. })
  98. })
  99. },
  100. watch: {
  101. num() {
  102. if (this.num > this.jifen) {
  103. this.num = this.jifen
  104. }
  105. }
  106. }
  107. }
  108. </script>
  109. <style lang="scss" scoped>
  110. .integralTransforms {
  111. .header,
  112. .account,
  113. .num {
  114. background-color: #fff;
  115. margin: 20rpx 0;
  116. padding: 30rpx;
  117. input {
  118. margin-top: 10rpx;
  119. }
  120. .title {
  121. font-size: 30rpx;
  122. color: #333333;
  123. font-family: PingFang-SC-Regular;
  124. }
  125. }
  126. .header {
  127. text-align: center;
  128. text:nth-child(1) {
  129. font-size: 45rpx;
  130. }
  131. text:nth-child(3) {
  132. font-size: 30rpx;
  133. color: #666666;
  134. }
  135. }
  136. .num {
  137. .ti {
  138. float: left;
  139. }
  140. }
  141. .button {
  142. width: 520rpx;
  143. margin: 60rpx auto;
  144. padding: 20rpx;
  145. text-align: center;
  146. border-radius: 10rpx;
  147. background: linear-gradient(90deg, #438BED 0%, #44BFEC 100%);
  148. color: #fff;
  149. }
  150. }
  151. </style>