index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view class="container">
  3. <navBar title="我的记录" :back="true" color="#333333" background="#FFFFFF" />
  4. <view class="mainBox">
  5. <!-- <u-sticky bgColor="#fff"> -->
  6. <u-tabs :current="tabIndex" :list="list1" :scrollable="false" @click="tabclick" lineColor="#007AFF" :activeStyle="activeStyle" :itemStyle="itemStyle" lineWidth="24"></u-tabs>
  7. <!-- </u-sticky> -->
  8. <view class="list" v-if="tabIndex==0">
  9. <view class="empty" style="margin-top: 50%;" v-if="chargeList.length==0">
  10. <u-empty
  11. mode="data"
  12. />
  13. </view>
  14. <view class="item" v-for="(item,index) in chargeList" v-else>
  15. <!-- <image src="../../../static/other/icon2.png" mode="" class="water"></image> -->
  16. <view class="top">
  17. <view class="name">
  18. {{item.config_data.title}}
  19. </view>
  20. <view class="money">
  21. ¥{{item.amount}}
  22. </view>
  23. </view>
  24. <view class="bot">
  25. <view class="count">
  26. 次数+{{item.diamond}}
  27. </view>
  28. <view class="time">
  29. {{item.created_at}}
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="list" v-else>
  35. <view class="empty" style="margin-top: 50%;" v-if="cusumerList.length==0">
  36. <u-empty
  37. mode="data"
  38. />
  39. </view>
  40. <view class="item" v-for="(item,index) in cusumerList" v-else>
  41. <!-- <image src="../../../static/other/icon2.png" mode="" class="water"></image> -->
  42. <view class="top">
  43. <view class="name">
  44. {{item.nickname}}
  45. </view>
  46. <view class="money">
  47. 剩余{{item.surplus_diamond}}
  48. </view>
  49. </view>
  50. <view class="bot">
  51. <view class="count">
  52. 次数-{{item.plot}}
  53. </view>
  54. <view class="time">
  55. {{item.created_at}}
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. // import navBar from '@/components/navBar/index.vue'
  65. import {
  66. getChargeRecord,
  67. getConsumerRecord
  68. } from '@/api/index/index.js'
  69. export default {
  70. // components: {
  71. // navBar
  72. // },
  73. data() {
  74. return {
  75. tabIndex:0,
  76. activeStyle:{
  77. color:'#007AFF',
  78. 'font-size': '28rpx',
  79. 'font-family': 'PingFang-SC, PingFang-SC',
  80. 'font-weight': 'bold'
  81. },
  82. itemStyle:{
  83. width:'50%',
  84. // background:'#fff',
  85. display: 'flex',
  86. 'justify-content': 'center',
  87. 'align-items': 'center',
  88. height: '80rpx'
  89. },
  90. list1: [{
  91. name: '充值记录',
  92. }, {
  93. name: '消费记录',
  94. }],
  95. chargeList:[],
  96. cusumerList:[]
  97. }
  98. },
  99. onLoad(o) {
  100. if(o.tabIndex){
  101. this.tabIndex=Number(o.tabIndex)
  102. }
  103. this.getChargeRecord()
  104. this.getConsumerRecord()
  105. },
  106. methods: {
  107. async getChargeRecord() {
  108. let res1 = await getChargeRecord()
  109. console.log('充值记录返回值--------2', res1);
  110. if (res1.code == 0) {
  111. this.chargeList=res1.data.data
  112. // this.chargeList=[]
  113. } else {
  114. this.$toast(res1.message)
  115. }
  116. },
  117. async getConsumerRecord() {
  118. let res1 = await getConsumerRecord()
  119. console.log('消耗记录返回值--------2', res1);
  120. if (res1.code == 0) {
  121. this.cusumerList=res1.data.data
  122. // this.cusumerList=[]
  123. } else {
  124. this.$toast(res1.message)
  125. }
  126. },
  127. tabclick(e){
  128. console.log(e,e.index);
  129. this.tabIndex=e.index
  130. }
  131. }
  132. }
  133. </script>
  134. <style lang="scss" scoped>
  135. @import "./index.scss";
  136. </style>