index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view class="entitlementCard">
  3. <view class="lable-box">
  4. <view @click.stop="activeLable = item.value"
  5. :class="['lable-item',activeLable === item.value ? 'active-lable-item' : '']" v-for="item in lableList">
  6. {{ item.lable }}
  7. </view>
  8. </view>
  9. <view class="entitlementCard-content">
  10. <template v-for="item in dataList[activeLable]">
  11. <card :styles="{'margin-bottom': '30rpx'}" :cardInfo="item" @onClickCard="onClickCard" />
  12. </template>
  13. <uni-load-more :status="loadingStatus" v-if="loadingStatus ==='loading' " />
  14. <view class="empty-data" v-if="loadingStatus=== 'noMore' && dataList[activeLable].length === 0 ">
  15. <EmptyDate />
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import { getYimaCard } from "@/api/government.js"
  22. import card from "./card.vue"
  23. export default {
  24. components: { card },
  25. data() {
  26. return {
  27. activeLable: 'ACTIVED',
  28. lableList: [{
  29. value: 'ACTIVED',
  30. lable: '未使用'
  31. }, {
  32. value: 'FROZEN',
  33. lable: '已停用'
  34. }, {
  35. value: 'EXPIRED',
  36. lable: '已过期'
  37. }],
  38. dataList: {
  39. ACTIVED: [],
  40. FROZEN: [],
  41. EXPIRED: []
  42. },
  43. loadingStatus: 'noMore'
  44. }
  45. },
  46. created() {
  47. // this.init()
  48. },
  49. methods: {
  50. // 点击卡包
  51. onClickCard(e) {
  52. uni.navigateTo({
  53. url: `/pages/government/entitlementCard/cardDetails?cardNo=${e.cardNo}`
  54. })
  55. },
  56. init() {
  57. this.getCard();
  58. },
  59. getCard() {
  60. this.loadingStatus = 'loading'
  61. this.dataList = {
  62. ACTIVED: [],
  63. EXPIRED: [],
  64. FROZEN: []
  65. };
  66. getYimaCard().then(res => {
  67. if (res.code == 200) {
  68. // ACTIVED-正常
  69. // FROZEN-停用
  70. // EXPIRED-过期
  71. const { outAppCardVoList } = res.data || []
  72. outAppCardVoList.forEach(el => {
  73. const key = el.status;
  74. this.dataList[key].push(el);
  75. })
  76. }
  77. }).finally(() => {
  78. setTimeout(() => {
  79. this.loadingStatus = 'noMore'
  80. uni.stopPullDownRefresh();
  81. }, 150)
  82. })
  83. },
  84. }
  85. }
  86. </script>
  87. <style lang="scss" scoped>
  88. .entitlementCard {
  89. .lable-box {
  90. display: flex;
  91. flex-direction: row;
  92. justify-content: space-between;
  93. align-items: stretch;
  94. padding: 0 92rpx;
  95. height: 103.5rpx;
  96. border-bottom: 1rpx solid #e6e6e6;
  97. .lable-item {
  98. display: flex;
  99. flex-direction: column;
  100. justify-content: center;
  101. font-size: 30rpx;
  102. font-family: PingFang SC, PingFang SC-Regular;
  103. font-weight: 400;
  104. color: #1a1a1a;
  105. position: relative;
  106. &:before {
  107. content: '';
  108. position: absolute;
  109. left: 0;
  110. bottom: 0;
  111. height: 4rpx;
  112. width: 100%;
  113. background: transparent;
  114. border-radius: 2rpx;
  115. }
  116. }
  117. .active-lable-item {
  118. color: #3BB7CE;
  119. &:before {
  120. background: #3bb7ce;
  121. }
  122. }
  123. }
  124. .entitlementCard-content {
  125. width: 100%;
  126. padding: 50rpx 30rpx 0;
  127. }
  128. }
  129. </style>