{"ast":null,"code":"import \"core-js/modules/es.array.push.js\";\nimport { myMixins } from '@/utils/myMixins.js';\nimport AttentionItem from '@/components/attentionItem';\nimport operationBtn from \"@/components/operationBtn\";\nimport commonBtn from \"@/components/commonBtn\";\nimport { getCurrentOrder } from '@/api/order';\nimport { orderStatus } from '@/utils/status';\nimport { operatorOrder } from '@/api/order';\nimport { getRoad } from '@/utils/map';\nexport default {\n name: \"orderStatus\",\n mixins: [myMixins],\n data() {\n return {\n map: '',\n marker: '',\n destMarker: '',\n driverMarker: '',\n finishFlag: true,\n ticketId: '',\n orderInfo: null,\n userPhone: '',\n plateNumber: '',\n attentionStr: '',\n statusStr: ''\n };\n },\n components: {\n AttentionItem,\n operationBtn,\n commonBtn\n },\n async mounted() {\n this.ticketId = this.$route.query.ticketId;\n this.userPhone = this.$route.query.userPhone;\n this.plateNumber = this.$route.query.plateNumber;\n await this.initMap();\n await this.getOrderInfo();\n },\n methods: {\n callDriver() {\n window.location.href = 'tel:' + this.orderInfo?.driveinfo?.driverPhone;\n },\n callClient() {\n window.location.href = 'tel:' + localStorage.getItem('client');\n },\n async urgedOrder() {\n await operatorOrder({\n appCode: localStorage.getItem('appCode'),\n ticketId: this.ticketId,\n userPhone: this.userPhone,\n plateNumber: this.plateNumber,\n type: 1,\n content: '服务催促'\n });\n this.$toast('已催促');\n },\n getStatusStr() {\n let res = orderStatus(this.orderInfo.orderStatus, this.orderInfo.appraiseFlag);\n this.statusStr = res.name;\n this.attentionStr = res.tip;\n },\n initMap() {\n this.map = new AMap.Map('mapId', {\n viewMode: '2D',\n // 默认使用 2D 模式\n zoom: 11 //初始化地图层级\n });\n },\n\n markerFn(lng, lat, marker, markerCls) {\n if (marker) {\n this.map.remove(marker);\n }\n let content = `
`;\n marker = new AMap.Marker({\n position: new AMap.LngLat(lng, lat),\n content: content,\n offset: new AMap.Pixel(-13, -30)\n });\n this.map.add(marker);\n },\n async getOrderInfo() {\n this.orderInfo = await getCurrentOrder({\n ticketId: this.ticketId,\n userPhone: this.userPhone,\n plateNumber: this.plateNumber\n });\n // 事发地 marker\n if (this?.orderInfo?.startLng && this?.orderInfo?.startLat) {\n this.markerFn(this.orderInfo.startLng, this.orderInfo.startLat, this.marker, 'my-position');\n }\n // 目的地 marker\n if (this?.orderInfo?.desLat && this?.orderInfo?.desLng) {\n this.markerFn(this.orderInfo.desLng, this.orderInfo.desLat, this.destMarker, 'dest-position');\n }\n if (this?.orderInfo?.driveinfo?.driverLat && this?.orderInfo?.driveinfo?.driverLng) {\n this.markerFn(this?.orderInfo?.driveinfo?.driverLng, this?.orderInfo?.driveinfo?.driverLat, this.driverMarker, 'driver-position');\n }\n if (this?.orderInfo?.orderStatus == 35) {\n let res = await getRoad(this.map, this?.orderInfo?.driveinfo?.driverLng, this?.orderInfo?.driveinfo?.driverLat, this.orderInfo.startLng, this.orderInfo.startLat);\n console.log('路径规划', res);\n this.drawRoute(res);\n }\n this.getStatusStr();\n },\n drawRoute(route) {\n let path = this.parseRouteToPath(route);\n let routeLine = new AMap.Polyline({\n path: path,\n isOutline: true,\n outlineColor: '#ffeeee',\n borderWeight: 2,\n strokeWeight: 5,\n strokeOpacity: 0.9,\n strokeColor: '#0091ff',\n lineJoin: 'round'\n });\n this.map.add(routeLine);\n this.map.setFitView([this.driverMarker, this.marker, routeLine]);\n },\n parseRouteToPath(route) {\n // 获取第一个路径规划\n let path = [];\n for (let i = 0, l = route.steps.length; i < l; i++) {\n let step = route.steps[i];\n for (let j = 0, n = step.path.length; j < n; j++) {\n path.push(step.path[j]);\n }\n }\n return path;\n }\n }\n};","map":{"version":3,"names":["myMixins","AttentionItem","operationBtn","commonBtn","getCurrentOrder","orderStatus","operatorOrder","getRoad","name","mixins","data","map","marker","destMarker","driverMarker","finishFlag","ticketId","orderInfo","userPhone","plateNumber","attentionStr","statusStr","components","mounted","$route","query","initMap","getOrderInfo","methods","callDriver","window","location","href","driveinfo","driverPhone","callClient","localStorage","getItem","urgedOrder","appCode","type","content","$toast","getStatusStr","res","appraiseFlag","tip","AMap","Map","viewMode","zoom","markerFn","lng","lat","markerCls","remove","Marker","position","LngLat","offset","Pixel","add","startLng","startLat","desLat","desLng","driverLat","driverLng","console","log","drawRoute","route","path","parseRouteToPath","routeLine","Polyline","isOutline","outlineColor","borderWeight","strokeWeight","strokeOpacity","strokeColor","lineJoin","setFitView","i","l","steps","length","step","j","n","push"],"sources":["src/views/index/orderStatus.vue"],"sourcesContent":["\r\n