StepTwo.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div class="step-2">
  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">Lite</strong>
  8. <span style="font-size: 0"
  9. ><strong class="s2">$99</strong
  10. ><span class="s3">{{
  11. state.form.subscribe_type === 'year' ? 'Annual' : 'Monthly'
  12. }}</span></span
  13. >
  14. <strong class="s4" @click="$router.back()">Modify ></strong>
  15. </div>
  16. </div>
  17. </div>
  18. <div class="ptc-block">
  19. <div class="ptc-inner">
  20. <p class="ptc-label">Choose a mobile phone brand</p>
  21. <PtcRadioGroup
  22. v-model="state.form.brand_id"
  23. class="device-list"
  24. @change="onSelectBrand"
  25. >
  26. <PtcRadio
  27. v-for="brand of state.brandList"
  28. :key="brand.id"
  29. class="device-item"
  30. :value="brand.id"
  31. >
  32. <img class="device-img" />
  33. <p class="device-name">{{ brand.name }}</p>
  34. </PtcRadio>
  35. </PtcRadioGroup>
  36. </div>
  37. </div>
  38. <template v-if="state.form.brand_id">
  39. <div class="ptc-block">
  40. <div class="ptc-inner">
  41. <p class="ptc-label">Choose phone model</p>
  42. <PtcRadioGroup
  43. v-model="state.form.phone_id"
  44. class="device-list"
  45. @change="onSelectModel"
  46. >
  47. <PtcRadio
  48. v-for="model of state.modelList"
  49. :key="model.id"
  50. class="device-item"
  51. :value="model.id"
  52. >
  53. <img class="device-img" />
  54. <p class="device-name">{{ model.name }}</p>
  55. </PtcRadio>
  56. </PtcRadioGroup>
  57. </div>
  58. </div>
  59. </template>
  60. </div>
  61. </template>
  62. <script setup lang="ts">
  63. import { PtcRadioGroup, PtcRadio } from '@/components/radio'
  64. import { state, getModelList } from './store'
  65. const emit = defineEmits<{
  66. (e: 'next'): void
  67. }>()
  68. function onSelectBrand() {
  69. state.form.phone_id = ''
  70. getModelList()
  71. }
  72. function onSelectModel() {
  73. setTimeout(() => emit('next'), 200)
  74. }
  75. </script>
  76. <style lang="scss">
  77. .device {
  78. &-list {
  79. display: flex;
  80. flex-wrap: wrap;
  81. width: 680px;
  82. margin: auto;
  83. }
  84. &-item {
  85. padding-top: 24px;
  86. width: 322px;
  87. height: 322px;
  88. text-align: center;
  89. font-size: 40px;
  90. font-weight: bold;
  91. &:nth-child(2n + 1) {
  92. margin-right: 34px;
  93. }
  94. &:nth-child(n + 3) {
  95. margin-top: 36px;
  96. }
  97. }
  98. &-img {
  99. margin-bottom: 18px;
  100. width: 200px;
  101. height: 200px;
  102. background: teal;
  103. }
  104. }
  105. </style>