订单详情

This commit is contained in:
邱贞招 2024-06-20 20:37:25 +08:00
parent 6f83e8078c
commit 6411c17fe5
2 changed files with 257 additions and 6 deletions

View File

@ -0,0 +1,246 @@
<template>
<div class="place-search-map" :style="{width: width, height: height}" v-loading="loading">
<div id="container"></div>
<div class="input-card">
<h4>轨迹回放控制</h4>
<div class="input-item">
<input type="button" class="btn" value="开始动画" id="start" @click="startAnimation()" />
<input type="button" class="btn" value="暂停动画" id="pause" @click="pauseAnimation()" />
</div>
<div class="input-item">
<input type="button" class="btn" value="继续动画" id="resume" @click="resumeAnimation()" />
<input type="button" class="btn" value="停止动画" id="stop" @click="stopAnimation()" />
</div>
</div>
</div>
</template>
<script>
import AMapLoader from "@amap/amap-jsapi-loader";
import globalConfig from '@/utils/config/globalConfig'
import AreaTextSelect from '@/components/AreaTextSelect/index.vue'
export default {
name: "TrajectoryMap",
components: { AreaTextSelect },
props: {
width: {
type: String,
default: "100%"
},
height: {
type: String,
default: "100%"
},
initLng: {
type: String,
default: '120.250452'
},
initLat: {
type: String,
default: '27.101745'
},
tripRouteStr: {
type: String,
default: ''
}
},
data() {
return {
AMap: null,
map: null, //
placeSearch: null, // POI
geocoder: null, //
loading: false,
keyword: null,
markers: [],
line:[],
area: {
province: '福建省',
city: '宁德市',
}
}
},
mounted() {
this.initAMap();
},
beforeDestroy() {
this.destroyMap();
},
methods: {
destroyMap() {
this.map?.destroy();
},
initAMap() {
AMapLoader.load({
key: globalConfig.aMap.key, // WebKey load
version: "2.0", // JSAPI 1.4.15
plugins: ["AMap.MoveAnimation"]
}).then((AMap) => {
this.AMap = AMap;
this.map = new AMap.Map("container", {
// id
resizeEnable: true,
viewMode: "3D", // 3D
zoom: 16, //
center: [this.initLng == null ? 120.250452 : this.initLng, this.initLat == null ? 27.101745 : this.initLat], //
});
this.trajectory(); //
}).catch((e) => {
console.log(e);
});
},
//
trajectory() {
console.log("this.tripRouteStr-----------------"+JSON.stringify(this.tripRouteStr))
this.line = JSON.parse(this.tripRouteStr)
let line = this.line;
console.log("this.tripRouteStr-----------------"+JSON.parse(this.tripRouteStr))
if (Array.isArray(line)) {
// this.lineArr
console.log("this.lineArr-是数组");
} else {
// this.lineArr
console.log("this.lineArr-不是数组");
}
this.marker = new AMap.Marker({
map: this.map,
position: line[0],
icon: globalConfig.icon.blue,
offset: new AMap.Pixel(-26, -15),
autoRotation: true,
angle: -90
});
//
let polyline = new AMap.Polyline({
map: this.map,
path: line,
showDir: true,
strokeColor: "#28F", //线
// strokeOpacity: 1, //线
strokeWeight: 6 //线
// strokeStyle: "solid" //线
});
let passedPolyline = new AMap.Polyline({
map: this.map,
// path: this.lineArr,
strokeColor: "#AF5", //线
// strokeOpacity: 1, //线
strokeWeight: 6 //线
// strokeStyle: "solid" //线
});
this.marker.on("moving", function (e) {
passedPolyline.setPath(e.passedPath);
});
this.map.setFitView();
},
// /**
// * 线
// *
// * @param pointerArray [[a,b],[c,d]]
// * @return Array {min:number[a,b], max:number[c,d]}
// */
// getMaxBoundsPointer(pointerArray){
// console.log("JSON-------------"+JSON.stringify(pointerArray))
// let lngArray = pointerArray.map(item => item[0])
// let latArray = pointerArray.map(item => item[1])
// console.log("lngArray-------------"+lngArray)
// console.log("latArray-------------"+latArray)
// return {
// min: [Math.min(...lngArray), Math.min(...latArray)],
// max: [Math.max(...lngArray), Math.max(...latArray)],
// }
// },
startAnimation() {
this.marker.moveAlong(this.line, 200);
},
pauseAnimation() {
this.marker.pauseMove();
},
resumeAnimation() {
this.marker.resumeMove();
},
stopAnimation() {
this.marker.stopMove();
}
},
};
</script>
<style scoped lang="scss">
.place-search-map {
position: relative;
overflow: hidden;
#container {
height: 1000px;
width: 100%;
}
.input-card .btn {
margin-right: 1.2rem;
width: 9rem;
}
.input-card .btn:last-child {
margin-right: 0;
}
.btn {
display: inline-block;
font-weight: 400;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
border: 1px solid transparent;
transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
background-color: transparent;
background-image: none;
color: #25A5F7;
border-color: #25A5F7;
padding: .25rem .5rem;
line-height: 1.5;
border-radius: 1rem;
-webkit-appearance: button;
cursor:pointer;
}
.input-item {
position: relative;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-ms-flex-align: center;
align-items: center;
width: 100%;
height: 3rem;
}
.input-card {
position: absolute !important;
display: flex;
flex-direction: column;
min-width: 0;
word-wrap: break-word;
background-color: #fff;
background-clip: border-box;
border-radius: .25rem;
width: 22rem;
border-width: 0;
border-radius: 0.4rem;
box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);
position: fixed;
bottom: 1rem;
right: 1rem;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
padding: 0.75rem 1.25rem;
}
}
</style>

View File

@ -121,7 +121,7 @@
/>
<!-- 添加或修改订单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
<el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body>
<el-form ref="form" :model="form" label-width="110px">
<el-row>
<el-col :span="12">
@ -153,10 +153,11 @@
<!-- 显示路径 -->
<el-row>
<el-col :span="24">
<location-map
<trajectory-map
v-if="showPlaceSearchMap"
ref="map"
height="400px"
:trip-route-str="form.tripRouteStr"
/>
</el-col>
</el-row>
@ -217,12 +218,12 @@
<script>
import { listOrder, getOrder, delOrder, addOrder, updateOrder } from "@/api/system/order";
import LocationMap from '@/components/Map/location/LocationMap'
import TrajectoryMap from '@/components/Map/TrajectoryMap'
export default {
name: "Order",
dicts: ['et_order_type', 'et_pay_type', 'et_order_status'],
components: {LocationMap },
components: {TrajectoryMap },
data() {
return {
//
@ -244,6 +245,7 @@ export default {
showPlaceSearchMap: false,
//
open: false,
vehicleNum: null,
//
queryParams: {
pageNum: 1,
@ -266,6 +268,8 @@ export default {
payType: null,
payFee: null,
appointmentFee: null,
tripRouteStr: null,
vehicleNum: null
},
//
rules: {
@ -362,7 +366,8 @@ export default {
duration: null,
distance: null,
status: null,
createTime: null
createTime: null,
vehicleNum: null
};
this.resetForm("form");
},
@ -394,7 +399,7 @@ export default {
const orderId = row.orderId || this.ids
getOrder(orderId).then(response => {
this.form = response.data;
console.log("111111111111111111111111---------------"+JSON.stringify(response.data))
// console.log("111111111111111111111111---------------"+JSON.stringify(response.data))
this.showPlaceSearchMap = true;
this.open = true;
this.title = "订单详情";