StepThree.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <div class="step-3">
  3. <div class="ptc-block">
  4. <div class="ptc-inner">
  5. <p class="ptc-label">Version & Price</p>
  6. <div class="detail">
  7. <strong class="s1">{{ getters.selectedProduct.name }}</strong>
  8. <span style="font-size: 0"
  9. ><strong class="s2">${{ getters.cost }}</strong
  10. ><span class="s3">{{
  11. state.form.subscribe_type === 'year' ? 'Annual' : 'Monthly'
  12. }}</span></span
  13. >
  14. <strong class="s4" @click="$emit('go', -2)">Modify ></strong>
  15. </div>
  16. </div>
  17. </div>
  18. <div class="ptc-block">
  19. <div class="ptc-inner">
  20. <p class="ptc-label">Phone model</p>
  21. <div class="detail">
  22. <strong class="s1">{{ getters.modelName }}</strong>
  23. <strong class="s4" @click="$emit('go', -1)">Modify ></strong>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="ptc-wrapper">
  28. <div class="ptc-block">
  29. <div class="ptc-inner">
  30. <p class="text">
  31. Please enter a valid email address, we will send you the latest
  32. status of the order through this contact method。
  33. </p>
  34. <input
  35. v-model="state.form.email"
  36. class="ptc-input"
  37. placeholder="email address"
  38. />
  39. </div>
  40. </div>
  41. <div class="ptc-button-group">
  42. <div class="ptc-inner">
  43. <button class="ptc-button" @click="submit">SUBMIT</button>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </template>
  49. <script setup lang="ts">
  50. import { string } from 'yup'
  51. import { state, getters } from './store'
  52. import { checkoutOrder } from '@/service/order'
  53. import Toast from '@/components/toast'
  54. defineEmits<{
  55. (e: 'go', delta?: number): void
  56. }>()
  57. async function submit() {
  58. try {
  59. await string()
  60. .email('Please enter a valid email address')
  61. .validate(state.form.email)
  62. const { results } = await checkoutOrder(state.form)
  63. location.href = results
  64. } catch (err) {
  65. Toast(err.message)
  66. }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. .text {
  71. margin-bottom: 48px;
  72. line-height: 44px;
  73. font-size: 32px;
  74. color: #333;
  75. }
  76. </style>