StepFive.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <div class="container">
  3. <div class="ptc-inner">
  4. <div class="alert">
  5. <i class="alert-icon"></i>
  6. <p class="alert-message">{{ formattedTime }}</p>
  7. </div>
  8. <!-- <div class="action">
  9. <i class="icon-calendar"></i><strong>Add to calendar ></strong>
  10. </div> -->
  11. <div class="note">
  12. <ul class="note-list">
  13. <li class="note-item">
  14. Thank you for booking your mobile phone repair with us!
  15. </li>
  16. <li class="note-item">
  17. Our booking agent will be contacting you shortly to confirm your
  18. booking.
  19. </li>
  20. </ul>
  21. </div>
  22. <div class="detail">
  23. <div class="cell">
  24. <span class="cell-label">Store:</span>
  25. <span class="cell-value">{{ state.detail.shop_name }}</span>
  26. </div>
  27. <div class="cell">
  28. <strong class="primary pointer" @click="navigate">Navigation></strong>
  29. </div>
  30. <div class="cell">
  31. <span class="cell-label">Phone Brand:</span>
  32. <span class="cell-value">{{ state.detail.phone_brand }}</span>
  33. </div>
  34. <div class="cell">
  35. <span class="cell-label">Phone Model:</span>
  36. <span class="cell-value">{{ state.detail.phone_model }}</span>
  37. </div>
  38. <div class="cell">
  39. <span class="cell-label">Phone Number:</span>
  40. <span class="cell-value">{{ state.detail.phone_number }}</span>
  41. </div>
  42. <div class="cell">
  43. <span class="cell-label">IMEI:</span>
  44. <span class="cell-value">{{ state.detail.phone_imei }}</span>
  45. </div>
  46. <div class="cell">
  47. <span class="cell-label">Service:</span>
  48. <span class="cell-value">{{ state.detail.fix_name }}</span>
  49. </div>
  50. <div class="cell">
  51. <span class="cell-label">Member Price:</span>
  52. <span class="cell-value">${{ state.detail.price }}</span>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="ptc-button-group mg0">
  57. <div class="ptc-inner">
  58. <button class="ptc-button" @click="reselect">Reselect time</button>
  59. <button class="ptc-button ptc-button--stroke" @click="applyCancel">
  60. Cancel appointment
  61. </button>
  62. </div>
  63. </div>
  64. </div>
  65. </template>
  66. <script setup lang="ts">
  67. import { onMounted } from 'vue'
  68. import { useRouter } from 'vue-router'
  69. import { state } from '../store'
  70. import { cancelRepair } from '@/service/repair'
  71. import Toast from '@/components/toast'
  72. import dayjs from 'dayjs'
  73. import getLocation from '@/utils/getLocation'
  74. const router = useRouter()
  75. let coords: GeolocationCoordinates | undefined
  76. onMounted(async () => {
  77. coords = (await getLocation({ timeout: 800 }))?.coords
  78. })
  79. const formattedTime = (() => {
  80. const _ = dayjs(state.date, 'YYYY-MM-DD')
  81. return `${_.format('dddd')},${_.format('MMMM')} ${_.format('DD')} ${
  82. state.uiPeriod
  83. }`
  84. })()
  85. function reselect() {
  86. if (state.rightId) {
  87. router.replace({ path: '', query: { id: state.repairId } })
  88. }
  89. state.step = 1
  90. }
  91. async function applyCancel() {
  92. const { message } = await cancelRepair(+state.repairId)
  93. Toast(message)
  94. setTimeout(() => router.push('/repair/history'), 500)
  95. }
  96. function navigate() {
  97. const url = `https://maps.google.com/maps?${
  98. coords ? `saddr=${coords.latitude},${coords.longitude}&` : ''
  99. }daddr=${state.shop.coordinates || ''}`
  100. window.open(url)
  101. }
  102. </script>