|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- <template>
- <view class="content">
- <text class="please">请选择车辆:</text>
- <view class="uni-list-cell-db">
- <picker @change="bindPickerChange" :value="state.index" :range="state.array">
- <view class="uni-input">{{state.array[state.index]}}</view>
- </picker>
- </view>
- <view class="time-btn" @click="query">查询</view>
- </view>
- <view class="list" v-for="(item,index) in state.tableData" :key="index">
- <view><text class="title">卡号:</text><text>{{item.cardId}}</text></view>
- <view><text class="title">签号:</text><text>{{item.obuId}}</text></view>
- <view><text class="title">车牌号:</text><text>{{item.vehiclePlate}}</text></view>
- <view><text class="title">过户状态:</text><text>{{item.statusChinese}}</text></view>
- <view><text class="title">过户开始时间:</text><text>{{item.insertTime}}</text></view>
- <view><text class="title">过户结束时间:</text><text>{{item.updateTime}}</text></view>
- </view>
- <view class="noRecord" v-if="state.noRecord">暂无过户记录</view>
- <view style="text-align: center;margin: 20rpx;margin-bottom: 50rpx;" v-if="state.flags">我是有底线的</view>
- </template>
-
- <script setup lang="ts">
- import { ref, reactive } from "vue";
- import { onLoad, onReachBottom } from "@dcloudio/uni-app";
- import { selectCarInfo, transferRecordApi } from "@/utils/network/api.js";
- import { getItem } from "@/utils/storage";
- import { request } from "@/utils/network/request.js";
- import { stringToJson } from "@/utils/network/encryption.js";
- const state = reactive({
- index: 0, //渠道订单编号
- array: [],
- carData: [], //所有车的数据
- vehicleId: "", //传给后端的车牌id
- tableData: [],
- noRecord: false,
- pageNo: 1,
- pageSize: 10,
- flags: false,
- });
- onLoad(() => {
- queryCarMsg();
- });
- const bindPickerChange = (e) => {
- state.index = e.detail.value
- }
- // 查询车辆信息
- const queryCarMsg = () => {
- const options = {
- type: 2,
- data: {
- "openId": getItem('openId')
- },
- method: "POST",
- showLoading: true,
- };
- //调用方式
- request(selectCarInfo, options).then((res) => {
- const data = (stringToJson(res.bizContent).vehicleManages)
- for (var i = 0; i < data.length; i++) {
- state.array.push(data[i]['vehiclePlate'])
- var obj = {};
- obj["vehiclePlate"] = data[i]['vehiclePlate']
- obj["vehicleId"] = data[i]['vehicleId']
- state.carData.push(obj)
- }
- console.log("state.list", data)
- console.log("state.carData", state.carData)
- })
- }
- const query = () => {
- for (var i = 0; i < state.carData.length; i++) {
- if (state.carData[i]["vehiclePlate"] == state.array[state.index]) {
- state.vehicleId = state.carData[i]["vehicleId"]
- }
- }
- console.log("state.array[state.index]", state.vehicleId)
- const options = {
- type: 2,
- data: {
- "openId": getItem('openId'),
- "uniqueId": state.vehicleId,
- "pageNo": state.pageNo,
- "pageSize": state.pageSize,
- },
- method: "POST",
- showLoading: true,
- };
- //调用方式
- request(transferRecordApi, options).then((res) => {
- const data = (stringToJson(res.bizContent)).data
- state.tableData = [...stringToJson(res.bizContent).data, ...state.tableData]
- if (state.tableData.length != 0) {
- for (var k = 0; k < state.tableData.length; k++) {
- if (state.tableData[k]["status"] == "WITHVEHICLE") {
- state.tableData[k]["statusChinese"] = "等待使用"
- } else if (state.tableData[k]["status"] == "USE") {
- state.tableData[k]["statusChinese"] = "已使用"
- } else {
- state.tableData[k]["statusChinese"] = "弃置"
- }
- state.tableData[k]["vehiclePlate"] = state.tableData[k]["uniquneId"].substring(0, state.tableData[k]["uniquneId"].length - 2)
- }
- state.noRecord = false
- // state.tableData = state.tableData
- } else {
- state.noRecord = true
- state.tableData = []
- }
- console.log("res", data, state.noRecord)
- })
- }
- // 触底加载
- onReachBottom(() => {
- if (state.tableData.length < state.pageNo * 10) return state.flags = true
- console.log("触底了")
- state.pageNo++
- query()
- })
- </script>
-
- <style scoped>
- .content {
- font-size: 32rpx;
- display: flex;
- padding: 20rpx;
- align-items: center;
- }
-
- .uni-input {
- border: 1rpx solid #c1c1c1;
- border-radius: 5rpx;
- padding: 2rpx 10rpx;
- }
-
- .please {
- margin-right: 26rpx;
- display: inline-block;
- }
-
- .time-btn {
- width: 120rpx;
- height: 60rpx;
- background: #00B38B;
- border-radius: 40rpx;
- color: #FFFFFF;
- font-size: 32rpx;
- line-height: 60rpx;
- text-align: center;
- margin-left: 60rpx;
- }
-
- .list {
- width: 93%;
- margin: 20rpx auto;
- background-color: #f4f4f4;
- border-radius: 10rpx;
- font-size: 32rpx;
- padding: 10rpx;
- box-sizing: border-box;
- }
-
- .list>view {
- margin: 20rpx;
- }
-
- .title {
- width: 30%;
- }
-
- .noRecord {
- text-align: center;
- margin: 100rpx auto;
- font-size: 32rpx;
- }
- </style>
|