exchangeIntegral.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <view class="exchangeIntegral">
  3. <view class="integral">
  4. <view class="">
  5. 可兑换积分
  6. </view>
  7. <view class="num">
  8. {{integral}}
  9. </view>
  10. </view>
  11. <view class="applyIntegral">
  12. <view class="">
  13. 申请兑换购物积分
  14. </view>
  15. <input type="number" class="num" v-model="num"/>
  16. </view>
  17. <view class="all" @click="all"><text>全部转换</text></view>
  18. <view class="button" @click="submit">提交申请</view>
  19. </view>
  20. </template>
  21. <script>
  22. import {wallet , shan} from '@/api/finance.js'
  23. export default {
  24. data() {
  25. return {
  26. integral: '',
  27. num: ''
  28. }
  29. },
  30. onLoad() {
  31. let obj = this
  32. wallet({}).then(({data})=>{
  33. console.log(data,']]]]]');
  34. let arr = Object.keys(data.back)
  35. arr.forEach(e=>{
  36. if(e=='SCJF'){
  37. obj.integral = (data.back[e].money.money*1)
  38. }
  39. })
  40. })
  41. },
  42. methods: {
  43. all() {
  44. this.num = this.integral
  45. },
  46. submit() {
  47. if(this.integral < this.num) {
  48. this.all()
  49. }
  50. shan({
  51. num: this.num,
  52. }).then(({data})=>{
  53. console.log(data,'9898');
  54. uni.navigateTo({
  55. url:'/pages/money/success'
  56. })
  57. }).catch(e=>{
  58. console.log(e);
  59. })
  60. }
  61. },
  62. watch: {
  63. num() {
  64. if(this.integral < this.num) {
  65. this.all()
  66. }
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .exchangeIntegral {
  73. .integral,.applyIntegral{
  74. display: flex;
  75. justify-content: space-between;
  76. padding: 30rpx;
  77. background-color: #fff;
  78. margin-bottom: 5rpx;
  79. font-size: 30rpx;
  80. .num {
  81. font-size: 40rpx;
  82. text-align: right;
  83. max-width: 400rpx;
  84. }
  85. }
  86. .all {
  87. width: 100%;
  88. height: 80rpx;
  89. line-height: 80rpx;
  90. margin-top: 2rpx;
  91. background-color: #fff;
  92. padding: 0 30rpx;
  93. margin-bottom: 380rpx;
  94. text {
  95. margin:auto 0 ;
  96. float: right;
  97. font-size: 28rpx;
  98. color: #EF3A55;
  99. }
  100. }
  101. .button {
  102. background: linear-gradient(90deg, #438BED 0%, #44BFEC 100%);
  103. color: #fff;
  104. width: 70%;
  105. padding: 20rpx;
  106. font-size: 30rpx;
  107. border-radius: 10rpx;
  108. text-align: center;
  109. margin: 0 auto;
  110. }
  111. }
  112. </style>