Commit cb7d4094 authored by 琉璃丶c's avatar 琉璃丶c

1.去除 订单详情的 keepAlive

2.修复物流信息为空时不提示的问题
3.修复 nav-bar 警告问题
parent 47be9b1e
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
id="nav-bar" id="nav-bar"
v-if="navBar.show" v-if="navBar.show"
:left-arrow="navBar.leftArrow" :left-arrow="navBar.leftArrow"
@click-left="navBar.leftClick" @click-left="leftClick"
:right-text="navBar.rightText" :right-text="navBar.rightText"
:left-text="navBar.leftText" :left-text="navBar.leftText"
@click-right="navBar.rightClick" @click-right="rightClick"
:fixed="navBar.fixed" :fixed="navBar.fixed"
:title="navBar.title"> :title="navBar.title">
<template #right> <template #right>
...@@ -37,6 +37,14 @@ export default { ...@@ -37,6 +37,14 @@ export default {
this.$router.back() this.$router.back()
} }
}) })
},
methods: {
leftClick() {
this.navBar.leftClick()
},
rightClick() {
this.navBar.rightClick()
}
} }
} }
</script> </script>
......
...@@ -14,8 +14,7 @@ const myOrder = [ ...@@ -14,8 +14,7 @@ const myOrder = [
name: 'orderDetail', name: 'orderDetail',
meta: { meta: {
title: '订单详情', title: '订单详情',
auth: false, auth: false
keepAlive: true
}, },
component: resolve => require(['@/views/myOrder/detail/orderDetail'], resolve) component: resolve => require(['@/views/myOrder/detail/orderDetail'], resolve)
}, },
......
<template> <template>
<div class="logistics-content"> <div class="logistics-content">
<van-empty description="暂无数据" <van-empty description="暂无数据"
v-if="!shippingInfo&&!shippingInfo.shippingNo&& v-if="!((mapPointList&&mapPointList.length > 0)||(shippingInfo&&shippingInfo.shippingNo)||(stepList&&stepList.length > 0))"/>
(!stepList|| stepList.length<0)&&(!mapPointList||mapPointList.length < 0)"/> <!-- 高德地图 -->
<a-map-view :transport="sendType" :point-list="mapPointList" :drive-point="driveLine" v-if="mapPointList&&mapPointList.length > 0"/> <a-map-view :transport="sendType" :point-list="mapPointList" :drive-point="driveLine"
v-if="mapPointList&&mapPointList.length > 0"/>
<!-- 物流主信息 -->
<div class="logistics-header" v-if="shippingInfo&&shippingInfo.shippingNo"> <div class="logistics-header" v-if="shippingInfo&&shippingInfo.shippingNo">
<div class="header-title"> <div class="header-title">
<van-icon class="logistic-logo" :name="icons.logo"/> <van-icon class="logistic-logo" :name="icons.logo"/>
...@@ -26,10 +28,11 @@ ...@@ -26,10 +28,11 @@
<span class="logistic-values">{{ shippingInfo.estimatedArrivalTime }}</span> <span class="logistic-values">{{ shippingInfo.estimatedArrivalTime }}</span>
</div> </div>
</span> </span>
<span class="logistic-type">{{shippingInfo.roadType==='D'?'市内':'市外'}}</span> <span class="logistic-type">{{ shippingInfo.roadType === 'D' ? '市内' : '市外' }}</span>
</div> </div>
</div> </div>
<div id="stepLine" :class="stepList.length>2?'logistics-step-line':'logistics-step-line_show'" v-if="stepList"> <!-- 物流追踪信息 -->
<div id="stepLine" :class="stepList.length>2?'logistics-step-line':'logistics-step-line_show'" v-if="stepList&&stepList.length > 0">
<logistics-step> <logistics-step>
<step-item v-for="(item, index) in stepList" :stepInfo=item :key="index"/> <step-item v-for="(item, index) in stepList" :stepInfo=item :key="index"/>
</logistics-step> </logistics-step>
...@@ -187,7 +190,7 @@ export default { ...@@ -187,7 +190,7 @@ export default {
} }
getGpsMapPoint(data).then(res => { getGpsMapPoint(data).then(res => {
if (res.code === 200 && res.data.code === '00000' && if (res.code === 200 && res.data.code === '00000' &&
res.data.entity && res.data.entity.gisMapInfoList) { res.data.entity && res.data.entity.gisMapInfoList) {
this.mapPointList = res.data.entity.gisMapInfoList this.mapPointList = res.data.entity.gisMapInfoList
} }
}).catch(err => { }).catch(err => {
...@@ -200,7 +203,7 @@ export default { ...@@ -200,7 +203,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.logistics-content { .logistics-content {
background-color:#f2f3f5; background-color: #f2f3f5;
height: calc(100vh - 46px); height: calc(100vh - 46px);
overflow: scroll; overflow: scroll;
...@@ -261,8 +264,8 @@ export default { ...@@ -261,8 +264,8 @@ export default {
height: 150px; height: 150px;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
background-color:#fff; background-color: #fff;
padding:1px; padding: 1px;
.show-more { .show-more {
display: block; display: block;
...@@ -278,8 +281,9 @@ export default { ...@@ -278,8 +281,9 @@ export default {
} }
.logistics-step-line_show { .logistics-step-line_show {
background-color:#fff; background-color: #fff;
padding: 1px 1px 10px 1px; padding: 1px 1px 10px 1px;
.show-more { .show-more {
display: none; display: none;
} }
......
...@@ -145,34 +145,39 @@ export default { ...@@ -145,34 +145,39 @@ export default {
} }
} }
}, },
activated() { // activated() {
// 设置标题栏关闭返回按钮 // this.initPager()
this.$store.commit('setNavBar', { // },
show: true, // deactivated() {
leftArrow: true, // // 当页面销毁必须要移除这个事件,vue不刷新页面,不移除会重复执行这个事件
rightIcon: false, // window.removeEventListener('popstate', this.onBrowserBack, false)
title: '订单详情', // },
leftText: '',
leftClick: this.onBrowserBack,
rightClick: null
})
// 给window添加一个popstate事件,拦截返回键,执行this.onBrowserBack事件,addEventListener需要指向一个方法
window.addEventListener('popstate', this.onBrowserBack, false)
this.orderItem = this.$route.query
this.getOrderDetail()
this.getInvoiceDetail()
this.getTrackInfoDetail()
},
deactivated() {
// 当页面销毁必须要移除这个事件,vue不刷新页面,不移除会重复执行这个事件
window.removeEventListener('popstate', this.onBrowserBack, false)
},
mounted() { mounted() {
this.initPager()
}, },
destroyed() { destroyed() {
// 当页面销毁必须要移除这个事件,vue不刷新页面,不移除会重复执行这个事件
window.removeEventListener('popstate', this.onBrowserBack, false)
}, },
methods: { methods: {
initPager() {
// 设置标题栏关闭返回按钮
this.$store.commit('setNavBar', {
show: true,
leftArrow: true,
rightIcon: false,
title: '订单详情',
leftText: '',
leftClick: this.onBrowserBack,
rightClick: null
})
// 给window添加一个popstate事件,拦截返回键,执行this.onBrowserBack事件,addEventListener需要指向一个方法
window.addEventListener('popstate', this.onBrowserBack, false)
this.orderItem = this.$route.query
this.getOrderDetail()
this.getInvoiceDetail()
this.getTrackInfoDetail()
},
onBrowserBack() { onBrowserBack() {
this.$router.go(-1) this.$router.go(-1)
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment