修改停车订单页面数据不显示的bug
This commit is contained in:
parent
9e664e1a21
commit
849d6149bb
@ -7,8 +7,9 @@
|
||||
<text class="park-name">{{ orderDetail.parking.parking_name }}</text>
|
||||
</view>
|
||||
<view class="status-right">
|
||||
<image class="success-icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/park/park_orderOk.png"
|
||||
mode="aspectFit"></image>
|
||||
<image class="success-icon"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/park/park_orderOk.png" mode="aspectFit">
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -71,11 +72,11 @@
|
||||
|
||||
<script>
|
||||
import {
|
||||
isPhone,
|
||||
picUrl,
|
||||
request,
|
||||
upload,
|
||||
NavgateTo
|
||||
isPhone,
|
||||
picUrl,
|
||||
request,
|
||||
upload,
|
||||
NavgateTo
|
||||
} from '../../../utils';
|
||||
import { apiArr } from '@/api/park.js'
|
||||
|
||||
@ -115,22 +116,22 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// 计算停车时长
|
||||
calculateParkingDuration() {
|
||||
if (!this.orderDetail || !this.orderDetail.parking_record) {
|
||||
return '0分钟';
|
||||
}
|
||||
|
||||
|
||||
const inTime = new Date(this.orderDetail.parking_record.in_time);
|
||||
const outTime = new Date(this.orderDetail.parking_record.out_time);
|
||||
|
||||
|
||||
// 计算时间差(毫秒)
|
||||
const diffMs = outTime - inTime;
|
||||
|
||||
|
||||
// 转换为分钟
|
||||
const diffMinutes = Math.floor(diffMs / (1000 * 60));
|
||||
|
||||
|
||||
if (diffMinutes < 60) {
|
||||
return `${diffMinutes}分钟`;
|
||||
} else {
|
||||
@ -145,9 +146,17 @@ export default {
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
const order = options.order;
|
||||
if (order) {
|
||||
this.orderDetail = JSON.parse(order);
|
||||
console.log("接收的原始参数:", options);
|
||||
if (options && options.order) {
|
||||
try {
|
||||
// 先解码,再解析
|
||||
const decodedOrder = decodeURIComponent(options.order);
|
||||
this.orderDetail = JSON.parse(decodedOrder);
|
||||
console.log("解析成功:", this.orderDetail);
|
||||
} catch (err) {
|
||||
console.error("解析失败:", err);
|
||||
// 容错处理(如提示加载失败)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +69,10 @@ export default {
|
||||
methods: {
|
||||
// 查看订单详情
|
||||
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',
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
that.getOrderData();
|
||||
}, 1000);
|
||||
that.getOrderData();
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -159,7 +160,7 @@ export default {
|
||||
// 页面加载时获取订单数据
|
||||
this.getOrderData();
|
||||
},
|
||||
|
||||
|
||||
// 页面滑动到底部时触发
|
||||
onReachBottom() {
|
||||
this.page_size += 10;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user