candy.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view class="center">
  3. <view class="content-money">
  4. <view class="buttom">
  5. <text class="text">可兑换积分</text>
  6. <view class="icon"><text>¥</text>{{ money }}</view>
  7. </view>
  8. <view class="interval"></view>
  9. <view class="buttom">
  10. <text class="text">申请兑换糖果</text>
  11. <view class=" icon"><input class="input" type="number" v-model="withdrawal" placeholder="申请兑换糖果数量" placeholder-class="placeholder" /></view>
  12. </view>
  13. <view class="interval"></view>
  14. <view class="tip">
  15. <view class=" tip-icon" @click="all()">全部转换</view>
  16. </view>
  17. </view>
  18. <view class="code">
  19. </view>
  20. <view class="btn" @click="buy()">
  21. 提交申请
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import { wallet } from '@/api/finance.js';
  27. export default {
  28. data(){
  29. return{
  30. money: 0,
  31. withdrawal:'',
  32. buying: false,
  33. }
  34. },
  35. onLoad() {
  36. wallet({}).then(({ data }) => {
  37. const obj = this
  38. const arr = Object.keys(data.back);
  39. arr.forEach(e => {
  40. if(e == 'USDC'){
  41. obj.money = (data.back[e].money.money*1)
  42. }
  43. });
  44. });
  45. },
  46. methods:{
  47. all(){
  48. this.withdrawal = this.money
  49. },
  50. buy(){
  51. if (this.buying) {
  52. } else {
  53. this.buying = true
  54. shan({
  55. origin_money_type: this.moneyType[this.index].name,
  56. money_type: this.add.name,
  57. num: this.pushMoney,
  58. }).then(({
  59. data
  60. }) => {
  61. console.log(data)
  62. this.buying = false
  63. this.$api.msg("闪兑成功")
  64. }).catch(e => {
  65. this.buying = false
  66. console.log(e)
  67. })
  68. }
  69. }
  70. }
  71. }
  72. </script>
  73. <style lang="scss">
  74. page,.center {
  75. height: 100%;
  76. background: #FFFFFF;
  77. }
  78. .content-money {
  79. padding: 0 20rpx;
  80. background-color: #ffffff;
  81. .buttom {
  82. display: flex;
  83. justify-content: space-between;
  84. align-items: center;
  85. height: 110rpx;
  86. }
  87. .interval {
  88. width: 100%;
  89. height: 1px;
  90. background: #E6E6E6;
  91. }
  92. .icon {
  93. font-size: 48rpx;
  94. font-family: SourceHanSansCN;
  95. font-weight: 500;
  96. color: #333333;
  97. text{
  98. font-size: 32rpx;
  99. }
  100. .input {
  101. text-align: right;
  102. flex: 1;
  103. font-size: 30rpx;
  104. color: $font-color-dark;
  105. }
  106. .iconlocation {
  107. text-align: right;
  108. font-size: 36rpx;
  109. color: $font-color-light;
  110. }
  111. }
  112. .text {
  113. font-size: 32rpx;
  114. font-family: PingFang SC;
  115. font-weight: 500;
  116. color: #333333;
  117. }
  118. .tip {
  119. height: 74rpx;
  120. display: flex;
  121. justify-content: flex-end;
  122. align-items: center;
  123. .tip-text {
  124. font-size: 24rpx;
  125. font-family: PingFang SC;
  126. font-weight: 500;
  127. color: #999999;
  128. }
  129. .tip-icon {
  130. font-size: 26rpx;
  131. font-family: SourceHanSansCN;
  132. font-weight: 400;
  133. color: #EF041F;
  134. }
  135. }
  136. }
  137. .btn {
  138. text-align: center;
  139. margin: 134rpx auto;
  140. width: 670rpx;
  141. height: 88rpx;
  142. background: linear-gradient(0deg, #2E58FF, #32C6FF);
  143. border-radius: 10px;
  144. text-align: center;
  145. line-height: 88rpx;
  146. font-size: 32rpx;
  147. font-family: SourceHanSansCN;
  148. font-weight: 500;
  149. color: #FEFEFE;
  150. }
  151. .code {
  152. width: 750rpx;
  153. height: 20rpx;
  154. background: #F7F7F7;
  155. }
  156. </style>