Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

consumption-record.vue 2.8KB

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