StepTwo.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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">{{ 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', -1)">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. :disabled="!!state.form.renewal"
  32. >
  33. <i
  34. :class="[
  35. 'device-img',
  36. [, 'd-iphone', 'd-ipag', 'd-samsung'][brand.id] || 'd-other',
  37. ]"
  38. />
  39. <p class="device-name">{{ brand.name }}</p>
  40. </PtcRadio>
  41. </PtcRadioGroup>
  42. </div>
  43. </div>
  44. <div v-if="state.modelList.length" class="ptc-wrapper">
  45. <div class="ptc-block">
  46. <div class="ptc-inner">
  47. <p class="ptc-label">Choose phone model</p>
  48. <PtcRadioGroup v-model="state.form.phone_id" class="device-list">
  49. <PtcRadio
  50. v-for="model of state.modelList"
  51. :key="model.id"
  52. class="device-item"
  53. :value="model.id"
  54. :disabled="!!state.form.renewal"
  55. >
  56. <img class="device-img" :src="model.image" />
  57. <p class="device-name">{{ model.name }}</p>
  58. </PtcRadio>
  59. </PtcRadioGroup>
  60. </div>
  61. </div>
  62. <div class="ptc-button-group">
  63. <div class="ptc-inner">
  64. <button class="ptc-button" @click="$emit('go')">NEXT</button>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </template>
  70. <script setup lang="ts">
  71. import { PtcRadioGroup, PtcRadio } from '@/components/radio'
  72. import { state, getters, getModelList } from './store'
  73. const emit = defineEmits<{
  74. (e: 'go', delta?: number): void
  75. }>()
  76. // const showNextBtn = state.form.brand_id && state.form.phone_id
  77. function onSelectBrand() {
  78. state.form.phone_id = ''
  79. getModelList()
  80. }
  81. function onSelectModel() {
  82. setTimeout(() => emit('go'), 200)
  83. }
  84. </script>
  85. <style lang="scss">
  86. .device {
  87. &-list {
  88. display: flex;
  89. flex-wrap: wrap;
  90. width: 680px;
  91. margin: auto;
  92. }
  93. &-item {
  94. padding-top: 24px;
  95. width: 322px;
  96. height: 322px;
  97. text-align: center;
  98. font-size: 40px;
  99. font-weight: bold;
  100. &:nth-child(2n + 1) {
  101. margin-right: 34px;
  102. }
  103. &:nth-child(n + 3) {
  104. margin-top: 36px;
  105. }
  106. }
  107. &-img {
  108. display: inline-block;
  109. vertical-align: top;
  110. margin-bottom: 18px;
  111. width: 200px;
  112. height: 200px;
  113. background-color: #eee;
  114. background-size: contain;
  115. }
  116. }
  117. </style>