candy.vue 3.4 KB

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