Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view class='content'>
  3. <view class='search_wrap'>
  4. <input type="text" v-model='state.value' placeholder='搜索ETC卡号' @confirm="doSearch" /><button size='mini'
  5. @click='search()'>搜索</button>
  6. </view>
  7. <view class='item' v-for="(item,index) in state.newList">
  8. <view class='time'><text>时间:{{item.tradeConfirmTime}}</text><text>¥{{item.fee/100}}</text></view>
  9. <view>ETC卡号:{{item.bankCardId}}</view>
  10. </view>
  11. </view>
  12. </template>
  13. <script lang="ts" setup>
  14. import { reactive } from "vue";
  15. import { request } from "@/utils/network/request.js";
  16. import { transactionRecord } from "@/utils/network/api.js";
  17. import { stringToJson } from "@/utils/network/encryption.js";
  18. import { onLoad } from "@dcloudio/uni-app";
  19. const state = reactive({
  20. list: '', //所有数据
  21. newList: '', //最终展示的
  22. name: '',
  23. value: '',//input框里的值
  24. })
  25. onLoad((option : any) => {
  26. console.log("option", option)
  27. state.name = option.name;
  28. getList();
  29. })
  30. const getList = () => {
  31. const options = {
  32. type: 2,
  33. data: {
  34. 'accountId': state.name,
  35. 'accountTransactionType': 0
  36. },
  37. method: "POST",
  38. showLoading: true,
  39. };
  40. request(transactionRecord, options).then((res) => {
  41. const data = stringToJson(res.bizContent);
  42. state.list = data.qtkCorporateAccountDetails;
  43. for (var i = 0; i < state.list.length; i++) {
  44. // state.list[i].tradeConfirmTime = state.list[i].tradeConfirmTime.split('T').join(' ');
  45. }
  46. state.newList = state.list;
  47. console.log("交易记录", data)
  48. })
  49. }
  50. const search = () => {
  51. state.newList = [];
  52. for (var i = 0; i < state.list.length; i++) {
  53. if (state.list[i].cardId.indexOf(state.value) >= 0) {
  54. state.newList.push(state.list[i]);
  55. }
  56. }
  57. console.log("state.newList", state.newList)
  58. }
  59. const doSearch = () => {
  60. search();
  61. }
  62. </script>
  63. <style scoped>
  64. .content {
  65. background-color: #EEF7F7;
  66. min-height: 100vh;
  67. padding: 0 30rpx;
  68. overflow: hidden;
  69. font-size: 32rpx;
  70. }
  71. .search_wrap {
  72. display: flex;
  73. margin: 20rpx 0;
  74. }
  75. .search_wrap>input {
  76. background-color: white;
  77. width: 76%;
  78. height: 40rpx;
  79. line-height: 40rpx;
  80. padding: 10rpx 10rpx;
  81. border-radius: 10rpx 0 0 10rpx;
  82. }
  83. .item {
  84. width: 100%;
  85. border-radius: 10rpx;
  86. box-sizing: border-box;
  87. padding: 30rpx 20rpx;
  88. margin-top: 30rpx;
  89. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  90. color: white;
  91. }
  92. .time {
  93. display: flex;
  94. margin-bottom: 16rpx;
  95. justify-content: space-between;
  96. }
  97. </style>