123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <template>
- <view class='content'>
- <view class='search_wrap'>
- <input type="text" v-model='state.value' placeholder='搜索ETC卡号' @confirm="doSearch" /><button size='mini'
- @click='search()'>搜索</button>
- </view>
- <view class='item' v-for="(item,index) in state.newList">
- <view class='time'><text>时间:{{item.tradeConfirmTime}}</text><text>¥{{item.fee/100}}</text></view>
- <view>ETC卡号:{{item.bankCardId}}</view>
- </view>
- </view>
- </template>
-
- <script lang="ts" setup>
- import { reactive } from "vue";
- import { request } from "@/utils/network/request.js";
- import { transactionRecord } from "@/utils/network/api.js";
- import { stringToJson } from "@/utils/network/encryption.js";
- import { onLoad } from "@dcloudio/uni-app";
- const state = reactive({
- list: '', //所有数据
- newList: '', //最终展示的
- name: '',
- value: '',//input框里的值
- })
- onLoad((option : any) => {
- console.log("option", option)
- state.name = option.name;
- getList();
- })
- const getList = () => {
- const options = {
- type: 2,
- data: {
- 'accountId': state.name,
- 'accountTransactionType': 0
- },
- method: "POST",
- showLoading: true,
- };
- request(transactionRecord, options).then((res) => {
- const data = stringToJson(res.bizContent);
- state.list = data.qtkCorporateAccountDetails;
- for (var i = 0; i < state.list.length; i++) {
- // state.list[i].tradeConfirmTime = state.list[i].tradeConfirmTime.split('T').join(' ');
- }
- state.newList = state.list;
- console.log("交易记录", data)
- })
- }
- const search = () => {
- state.newList = [];
- for (var i = 0; i < state.list.length; i++) {
- if (state.list[i].cardId.indexOf(state.value) >= 0) {
- state.newList.push(state.list[i]);
- }
- }
- console.log("state.newList", state.newList)
- }
- const doSearch = () => {
- search();
- }
- </script>
-
- <style scoped>
- .content {
- background-color: #EEF7F7;
- min-height: 100vh;
- padding: 0 30rpx;
- overflow: hidden;
- font-size: 32rpx;
- }
-
- .search_wrap {
- display: flex;
- margin: 20rpx 0;
- }
-
- .search_wrap>input {
- background-color: white;
- width: 76%;
- height: 40rpx;
- line-height: 40rpx;
- padding: 10rpx 10rpx;
- border-radius: 10rpx 0 0 10rpx;
- }
-
- .item {
- width: 100%;
- border-radius: 10rpx;
- box-sizing: border-box;
- padding: 30rpx 20rpx;
- margin-top: 30rpx;
- background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
- color: white;
- }
-
- .time {
- display: flex;
- margin-bottom: 16rpx;
- justify-content: space-between;
- }
- </style>
|