candy.vue 3.5 KB

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