StepTwo.vue 2.7 KB

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