index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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"
  7. :activeStyle="activeStyle" :itemStyle="itemStyle" lineWidth="24"></u-tabs>
  8. <!-- </u-sticky> -->
  9. <view class="list" v-if="tabIndex==0">
  10. <view class="empty" style="margin-top: 50%;" v-if="chargeList.length==0">
  11. <u-empty mode="data" />
  12. </view>
  13. <view class="item" v-for="(item,index) in chargeList" v-else
  14. :style="{'background-image':`url(${picBase+'mjl_c_bg.png'})`}">
  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 mode="data" />
  37. </view>
  38. <view class="item" v-for="(item,index) in cusumerList" v-else
  39. :style="{'background-image':`url(${picBase+'mjl_c_bg.png'})`}">
  40. <!-- <image src="../../../static/other/icon2.png" mode="" class="water"></image> -->
  41. <view class="top">
  42. <view class="name">
  43. {{item.nickname}}
  44. </view>
  45. <view class="money">
  46. 剩余{{item.surplus_diamond}}
  47. </view>
  48. </view>
  49. <view class="bot">
  50. <view class="count">
  51. 次数-{{item.plot}}
  52. </view>
  53. <view class="time">
  54. {{item.created_at}}
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. // import navBar from '@/components/navBar/index.vue'
  64. import {
  65. getChargeRecord,
  66. getConsumerRecord
  67. } from '@/api/index/index.js'
  68. export default {
  69. // components: {
  70. // navBar
  71. // },
  72. data() {
  73. return {
  74. picBase: this.$picBase2,
  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 = [1, 1]
  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 = [1, 1]
  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>