修改停车订单页面数据不显示的bug
This commit is contained in:
parent
9e664e1a21
commit
849d6149bb
@ -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);
|
||||||
|
// 容错处理(如提示加载失败)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user