修改停车订单页面数据不显示的bug

This commit is contained in:
赵毅 2025-09-13 11:56:08 +08:00
parent 9e664e1a21
commit 849d6149bb
2 changed files with 30 additions and 20 deletions

View File

@ -7,8 +7,9 @@
<text class="park-name">{{ orderDetail.parking.parking_name }}</text> <text class="park-name">{{ orderDetail.parking.parking_name }}</text>
</view> </view>
<view class="status-right"> <view class="status-right">
<image class="success-icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/park/park_orderOk.png" <image class="success-icon"
mode="aspectFit"></image> src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/park/park_orderOk.png" mode="aspectFit">
</image>
</view> </view>
</view> </view>
@ -71,11 +72,11 @@
<script> <script>
import { import {
isPhone, isPhone,
picUrl, picUrl,
request, request,
upload, upload,
NavgateTo NavgateTo
} from '../../../utils'; } from '../../../utils';
import { apiArr } from '@/api/park.js' import { apiArr } from '@/api/park.js'
@ -115,22 +116,22 @@ export default {
} }
}); });
}, },
// //
calculateParkingDuration() { calculateParkingDuration() {
if (!this.orderDetail || !this.orderDetail.parking_record) { if (!this.orderDetail || !this.orderDetail.parking_record) {
return '0分钟'; return '0分钟';
} }
const inTime = new Date(this.orderDetail.parking_record.in_time); const inTime = new Date(this.orderDetail.parking_record.in_time);
const outTime = new Date(this.orderDetail.parking_record.out_time); const outTime = new Date(this.orderDetail.parking_record.out_time);
// //
const diffMs = outTime - inTime; const diffMs = outTime - inTime;
// //
const diffMinutes = Math.floor(diffMs / (1000 * 60)); const diffMinutes = Math.floor(diffMs / (1000 * 60));
if (diffMinutes < 60) { if (diffMinutes < 60) {
return `${diffMinutes}分钟`; return `${diffMinutes}分钟`;
} else { } else {
@ -145,9 +146,17 @@ export default {
} }
}, },
onLoad(options) { onLoad(options) {
const order = options.order; console.log("接收的原始参数:", options);
if (order) { if (options && options.order) {
this.orderDetail = JSON.parse(order); try {
//
const decodedOrder = decodeURIComponent(options.order);
this.orderDetail = JSON.parse(decodedOrder);
console.log("解析成功:", this.orderDetail);
} catch (err) {
console.error("解析失败:", err);
//
}
} }
} }
} }

View File

@ -69,7 +69,10 @@ export default {
methods: { methods: {
// //
viewOrderDetail(order) { viewOrderDetail(order) {
NavgateTo('../orderDetail/index?order=' + JSON.stringify(order)) const orderStr = JSON.stringify(order);
// &?
const encodedOrder = encodeURIComponent(orderStr);
NavgateTo(`../orderDetail/index?order=${encodedOrder}`);
}, },
// //
@ -89,9 +92,7 @@ export default {
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}); });
setTimeout(() => { that.getOrderData();
that.getOrderData();
}, 1000);
}) })
} }
} }
@ -159,7 +160,7 @@ export default {
// //
this.getOrderData(); this.getOrderData();
}, },
// //
onReachBottom() { onReachBottom() {
this.page_size += 10; this.page_size += 10;