|
@@ -25,7 +25,7 @@
|
|
|
<span class="cell-value">{{ state.detail.shop_name }}</span>
|
|
|
</div>
|
|
|
<div class="cell">
|
|
|
- <strong class="primary" @click="navigate">Navigation></strong>
|
|
|
+ <strong class="primary pointer" @click="navigate">Navigation></strong>
|
|
|
</div>
|
|
|
<div class="cell">
|
|
|
<span class="cell-label">Phone Brand:</span>
|
|
@@ -65,6 +65,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
+import { onMounted } from 'vue'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
import { state } from '../store'
|
|
|
import { cancelRepair } from '@/service/repair'
|
|
@@ -73,6 +74,11 @@ import dayjs from 'dayjs'
|
|
|
import getLocation from '@/utils/getLocation'
|
|
|
|
|
|
const router = useRouter()
|
|
|
+let coords: GeolocationCoordinates | undefined
|
|
|
+
|
|
|
+onMounted(async () => {
|
|
|
+ coords = (await getLocation({ timeout: 800 }))?.coords
|
|
|
+})
|
|
|
|
|
|
const formattedTime = (() => {
|
|
|
const _ = dayjs(state.date, 'YYYY-MM-DD')
|
|
@@ -94,12 +100,10 @@ async function applyCancel() {
|
|
|
setTimeout(() => router.push('/repair/history'), 500)
|
|
|
}
|
|
|
|
|
|
-async function navigate() {
|
|
|
- const { coords } = (await getLocation({ timeout: 800 })) || {}
|
|
|
- window.open(
|
|
|
- `https://maps.google.com/maps?${
|
|
|
- coords ? `saddr=${coords.latitude},${coords.longitude}&` : ''
|
|
|
- }daddr=${state.shop.coordinates || ''}`
|
|
|
- )
|
|
|
+function navigate() {
|
|
|
+ const url = `https://maps.google.com/maps?${
|
|
|
+ coords ? `saddr=${coords.latitude},${coords.longitude}&` : ''
|
|
|
+ }daddr=${state.shop.coordinates || ''}`
|
|
|
+ window.open(url)
|
|
|
}
|
|
|
</script>
|