recharge.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view class="">
  3. <u-navbar
  4. title="充值"
  5. :autoBack="true"
  6. bgColor="#00A447"
  7. leftIconColor="#fff"
  8. :titleStyle="{color:'#fff'}"
  9. :safeAreaInsetTop="true"
  10. >
  11. </u-navbar>
  12. <view class="top-bg"></view>
  13. <view class="page-wrap">
  14. <view class="num-wrap">
  15. <view class="title">充值</view>
  16. <view class="inner u-flex u-row-around u-flex-wrap">
  17. <view class="num-item"
  18. :class="{active:activeIndex == index}"
  19. @click="numClick(index)"
  20. v-for="(item,index) in numItem" :key="item">
  21. ¥ {{item}}
  22. </view>
  23. </view>
  24. <view class="full-btn" @click="submit">充 值</view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. activeIndex:0,
  34. numItem:[500,10000,15000]
  35. }
  36. },
  37. onShow() {
  38. },
  39. onLoad() {
  40. },
  41. methods: {
  42. numClick(index){
  43. this.activeIndex = index
  44. },
  45. submit(){
  46. let num = this.numItem[this.activeIndex];
  47. console.log('num',num);
  48. return
  49. this.$u.api.charge({num:num}).then(res=>{
  50. console.log('res',res.data);
  51. }).catch(err=>{
  52. console.log('charge',err);
  53. })
  54. }
  55. }
  56. }
  57. </script>
  58. <style>
  59. page{
  60. background-color: #F5F5F5;
  61. }
  62. </style>
  63. <style lang="scss" scoped>
  64. .top-bg{
  65. width: 100%;
  66. height: 450rpx;
  67. background-color: #00A447;
  68. border-radius: 0 0 20% 20%;
  69. position: absolute;
  70. top: 0;
  71. left: 0;
  72. z-index:-1;
  73. }
  74. .num-wrap{
  75. padding: 20rpx;
  76. background-color: #fff;
  77. border-radius: 8rpx;
  78. .title{
  79. font-size: 32rpx;
  80. font-weight: 600;
  81. margin-bottom: 20rpx;
  82. }
  83. .inner{
  84. margin-bottom: 40rpx;
  85. .num-item{
  86. width: 30%;
  87. height: 260rpx;
  88. line-height: 260rpx;
  89. background-color: #EBF8F1;
  90. border: 4rpx solid #EBF8F1;
  91. text-align: center;
  92. font-size: 36rpx;
  93. font-weight: 600;
  94. color: #333333;
  95. &.active{
  96. border-color: #00A447;
  97. }
  98. }
  99. }
  100. .full-btn{
  101. background-color: #FFB600;;
  102. }
  103. }
  104. </style>