transfers.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="center">
  3. <view class="top">
  4. <view class="top-num" v-if="types == 'LALA'">{{ jf.toFixed(2) }}</view>
  5. <view class="top-font" v-if="types == 'LALA'">可转糖果</view>
  6. <view class="top-font" v-if="types == 'USDC'">{{ jf }}</view>
  7. <view class="top-font" v-if="types == 'USDC'">可转账购物积分</view>
  8. </view>
  9. <view class="main">
  10. <view class="main-font">收款人账户</view>
  11. <input class="main-input" type="text" value="" v-model="account" placeholder="请输入收款人账户" placeholder-class="main-input" />
  12. </view>
  13. <view class="main">
  14. <view class="main-font">收款人UID</view>
  15. <input class="main-input input" type="text" value="" v-model="uid" placeholder="请输入收款人UID" placeholder-class="main-input" />
  16. </view>
  17. <view class="main">
  18. <view class="main-font">交易密码</view>
  19. <input class="main-input" type="password" value="" v-model="password" placeholder="请输入交易密码" placeholder-class="main-input" />
  20. </view>
  21. <view class="main">
  22. <view class="main-font">转账数量</view>
  23. <input class="main-input" type="number" v-model="num > jf ? jf : num" placeholder="请输入转账数量" placeholder-class="main-input" />
  24. </view>
  25. <view class="btn" @click="transfer">
  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. jf: 0, //可转账购物积分
  37. uid: '', //收款人UID
  38. account:'',//收款人账号
  39. password:'',//交易密码
  40. num: '' ,//转账数量
  41. types:'',
  42. };
  43. },
  44. computed: {
  45. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  46. },
  47. onLoad(option) {
  48. if(option.type){
  49. this.types = option.type;
  50. }
  51. if( this.types == 'LALA' ) {
  52. uni.setNavigationBarTitle({
  53.   title: "糖果转账"
  54. })
  55. }
  56. console.log(this.userInfo,'11111')
  57. wallet({}).then(({ data }) => {
  58. const obj = this
  59. const arr = Object.keys(data.back);
  60. console.log(arr);
  61. arr.forEach(e => {
  62. if(e == obj.types){
  63. obj.jf = (data.back[e].money.money*1)
  64. }
  65. });
  66. });
  67. },
  68. methods:{
  69. transfer() {
  70. let obj = this;
  71. if (obj.account == '') {
  72. obj.$api.msg('请输入对方账号!');
  73. return;
  74. }
  75. if (obj.uid == '') {
  76. obj.$api.msg('请输入对方UID!');
  77. return;
  78. }
  79. if (obj.password == '') {
  80. obj.$api.msg('请输入交易密码!');
  81. return;
  82. }
  83. if (obj.num == '') {
  84. obj.$api.msg('请输入转账数量!');
  85. return;
  86. }
  87. if (obj.uid == this.userInfo.uid){
  88. obj.$api.msg('请勿转账给自己!');
  89. return;
  90. }
  91. goPay({
  92. type: this.types,
  93. num: obj.num,
  94. to_uid: obj.uid,
  95. trade_psw: obj.password,
  96. to_user_account: obj.account
  97. }).then(data => {
  98. obj.num = '';
  99. obj.UID = '';
  100. obj.password = '';
  101. obj.account = '';
  102. uni.navigateTo({
  103. url:'/pages/money/success'
  104. })
  105. });
  106. },
  107. }
  108. };
  109. </script>
  110. <style lang="scss">
  111. page,
  112. .center {
  113. background: #f2f3f5;
  114. height: 100%;
  115. }
  116. .top {
  117. margin-top: 20rpx;
  118. background: #ffffff;
  119. padding: 30rpx 0;
  120. text-align: center;
  121. .top-num {
  122. font-size: 42rpx;
  123. font-family: PingFang SC;
  124. font-weight: bold;
  125. color: #333333;
  126. }
  127. .top-font {
  128. font-size: 28rpx;
  129. font-family: PingFang SC;
  130. font-weight: 500;
  131. color: #666666;
  132. }
  133. }
  134. .main {
  135. padding: 36rpx 24rpx;
  136. background-color: #ffffff;
  137. margin-top: 20rpx;
  138. .main-font {
  139. font-size: 30rpx;
  140. font-family: PingFang SC;
  141. font-weight: 400;
  142. color: #333333;
  143. }
  144. .input {
  145. margin-top: 10rpx;
  146. }
  147. .main-input {
  148. font-size: 28rpx;
  149. font-family: PingFang SC;
  150. font-weight: 400;
  151. color: #999999;
  152. }
  153. }
  154. .btn {
  155. text-align: center;
  156. margin: 120rpx auto;
  157. width: 670rpx;
  158. height: 88rpx;
  159. background: linear-gradient(0deg, #2E58FF, #32C6FF);
  160. border-radius: 10px;
  161. text-align: center;
  162. line-height: 88rpx;
  163. font-size: 32rpx;
  164. font-family: SourceHanSansCN;
  165. font-weight: 500;
  166. color: #FEFEFE;
  167. }
  168. </style>