You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

consumption-record.vue 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <view class='content'>
  3. <view class='item' v-for="(item,index) in state.newList">
  4. <view>ETC卡号:{{item.cardId}}<text class="payStatus">{{item.payStatusC}}</text></view>
  5. <view>充值金额:¥{{item.rechargeMoney/100}}</view>
  6. <view>申请时间:{{item.insertTime}}</view>
  7. </view>
  8. </view>
  9. <view style="text-align: center;margin: 20rpx;" v-if="state.flags">我是有底线的</view>
  10. <view class="noContent" v-if="!state.newList.length">暂无消费明细</view>
  11. </template>
  12. <script lang="ts" setup>
  13. import { reactive } from "vue";
  14. import { request } from "@/utils/network/request.js";
  15. import { queryCardRecord } from "@/utils/network/api.js";
  16. import { stringToJson } from "@/utils/network/encryption.js";
  17. import { onLoad, onReachBottom } from "@dcloudio/uni-app";
  18. import { getItem } from "@/utils/storage";
  19. import { getCodeName } from "@/datas/queryKey.js";
  20. const state = reactive({
  21. list: '', //所有数据
  22. newList: '', //最终展示的
  23. cardId: '',
  24. value: '',//input框里的值
  25. pageNo: 1,
  26. pageSize: 16,
  27. flags: false,
  28. })
  29. onLoad((option : any) => {
  30. console.log("option", option)
  31. state.cardId = option.cardId;
  32. getList();
  33. })
  34. const getList = () => {
  35. const options = {
  36. type: 2,
  37. data: {
  38. 'cardId': state.cardId,
  39. 'openId': getItem('openId'),
  40. 'pageNo': state.pageNo,
  41. 'pageSize': state.pageSize
  42. },
  43. method: "POST",
  44. showLoading: true,
  45. };
  46. request(queryCardRecord, options).then((res) => {
  47. state.newList = [...stringToJson(res.bizContent).data, ...state.newList]
  48. for (var i = 0; i < state.newList.length; i++) {
  49. console.log("getCodeName", getCodeName('VCR_ORDER_STATUS', state.newList[i]['status']))
  50. state.newList[i]['payStatusC'] = getCodeName('VCR_ORDER_PAY_STATUS', state.newList[i]['payStatus'])
  51. }
  52. console.log("交易记录", state.newList)
  53. })
  54. }
  55. // 触底加载
  56. onReachBottom(() => {
  57. if (state.newList.length < state.pageNo * 16) return state.flags = true
  58. console.log("触底了")
  59. state.pageNo++
  60. getList()
  61. })
  62. </script>
  63. <style scoped>
  64. .noContent {
  65. text-align: center;
  66. margin-top: 100rpx;
  67. }
  68. .content {
  69. background-color: #EEF7F7;
  70. padding: 0 30rpx;
  71. overflow: hidden;
  72. font-size: 32rpx;
  73. }
  74. .search_wrap {
  75. display: flex;
  76. margin: 20rpx 0;
  77. }
  78. .search_wrap>input {
  79. background-color: white;
  80. width: 76%;
  81. height: 40rpx;
  82. line-height: 40rpx;
  83. padding: 10rpx 10rpx;
  84. border-radius: 10rpx 0 0 10rpx;
  85. }
  86. .item {
  87. width: 100%;
  88. border-radius: 10rpx;
  89. box-sizing: border-box;
  90. padding: 30rpx 20rpx;
  91. margin-top: 30rpx;
  92. /* background:linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%); */
  93. background: white;
  94. color: black;
  95. }
  96. .time {
  97. display: flex;
  98. margin-bottom: 16rpx;
  99. justify-content: space-between;
  100. }
  101. .payStatus {
  102. color: red;
  103. float: right;
  104. }
  105. </style>