index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <div v-if="info" class="p-benefits bg-gray">
  3. <h3 class="ptc-title">Member benefits</h3>
  4. <div class="ptc-block">
  5. <div class="ptc-inner">
  6. <div class="l1">
  7. <i class="icon-lite"></i
  8. ><strong class="primary">{{ info.product_name }}</strong
  9. >{{ info.start_time }} to {{ info.end_time }}
  10. </div>
  11. <p class="l2">{{ info.phone_info }}</p>
  12. <p class="l3">{{ info.phone_imei }}</p>
  13. <p class="l4">
  14. <button class="ptc-button ptc-button--stroke">Renewal</button>
  15. </p>
  16. <p class="l5">
  17. <router-link :to="`/renewal?id=${$route.params.id}`">
  18. Renewal management >
  19. </router-link>
  20. </p>
  21. </div>
  22. </div>
  23. <div class="ptc-block">
  24. <div class="ptc-inner">
  25. <div
  26. v-for="(item, index) of info.rights"
  27. :key="index"
  28. class="benefit"
  29. :style="{ backgroundImage: `url(${item.icon})` }"
  30. >
  31. <p class="benefit-name">{{ item.title }}</p>
  32. <p class="benefit-desc">
  33. {{ item.type == 1 ? `Available ${item.left_times}` : item.remark }}
  34. </p>
  35. <p v-if="item.type == 1" class="benefit-sup">
  36. <template v-if="item.available">
  37. Member price:<span class="highlight">${{ item.price }}</span>
  38. </template>
  39. <template v-else
  40. >Available after {{ item.next_available_at }}</template
  41. >
  42. </p>
  43. <button
  44. v-if="
  45. (item.type == 1 && item.available) || [2, 4].includes(+item.type)
  46. "
  47. class="ptc-button"
  48. @click="onClickButton(item)"
  49. >
  50. {{
  51. item.type == 1
  52. ? 'Apply'
  53. : item.type == 2
  54. ? item.button_name
  55. : 'Send to me'
  56. }}
  57. </button>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </template>
  63. <script>
  64. import { defineComponent } from 'vue'
  65. import { getOrderInfo } from '@/service/order'
  66. export default defineComponent({
  67. name: 'OrderDetail',
  68. async beforeRouteEnter(to, from, next) {
  69. const { results } = await getOrderInfo(to.params.id)
  70. next(vm => (vm.info = results))
  71. },
  72. async beforeRouteUpdate(to) {
  73. this.info = (await getOrderInfo(to.params.id)).results
  74. },
  75. data() {
  76. return {
  77. /** @type {any} */
  78. info: null,
  79. }
  80. },
  81. methods: {
  82. onClickButton(right) {
  83. right.type === '1'
  84. ? this.$router.push(`/repaire/appointment?right_id=${right.id}`)
  85. : right.type === '2'
  86. ? (location.href = right.link)
  87. : this.$router.push({
  88. path: '/mailing',
  89. query: {
  90. right_id: right.id,
  91. right_name: right.title,
  92. },
  93. })
  94. },
  95. },
  96. })
  97. </script>
  98. <style lang="scss">
  99. .p-benefits {
  100. .l1 {
  101. display: flex;
  102. font-size: 28px;
  103. color: #90a0c0;
  104. strong {
  105. margin: 0 20px 0 10px;
  106. }
  107. }
  108. .l2 {
  109. margin-top: 48px;
  110. line-height: 56px;
  111. font-size: 40px;
  112. font-weight: bold;
  113. color: #333;
  114. text-align: center;
  115. }
  116. .l3 {
  117. margin-top: 8px;
  118. line-height: 40px;
  119. font-size: 28px;
  120. color: #999;
  121. text-align: center;
  122. }
  123. .l4 {
  124. margin: 64px 0 24px;
  125. font-size: 0;
  126. text-align: center;
  127. button {
  128. margin: auto;
  129. width: 412px;
  130. height: 68px;
  131. font-size: 32px;
  132. }
  133. }
  134. .l5 {
  135. line-height: 44px;
  136. font-weight: bold;
  137. font-size: 32px;
  138. color: $primary-color;
  139. text-align: center;
  140. }
  141. .benefit {
  142. padding-left: 100px;
  143. padding-bottom: 46px;
  144. background-repeat: no-repeat;
  145. background-position: 0 0;
  146. background-size: 64px 64px;
  147. // &-a {
  148. // background-image: url(@img/benefit0.png);
  149. // }
  150. // &-b {
  151. // background-image: url(@img/benefit1.png);
  152. // }
  153. // &-c {
  154. // background-image: url(@img/benefit2.png);
  155. // }
  156. // &-d {
  157. // background-image: url(@img/benefit3.png);
  158. // }
  159. // &-e {
  160. // background-image: url(@img/benefit4.png);
  161. // }
  162. + .benefit {
  163. padding-top: 48px;
  164. background-position: 0 48px;
  165. @include thin-border(top);
  166. }
  167. &-name {
  168. line-height: 56px;
  169. font-size: 40px;
  170. font-weight: bold;
  171. color: #1a1a1a;
  172. }
  173. &-desc {
  174. margin-top: 24px;
  175. line-height: 44px;
  176. font-size: 32px;
  177. color: #1a1a1a;
  178. }
  179. &-sup {
  180. margin-top: 8px;
  181. line-height: 44px;
  182. font-size: 32px;
  183. color: #999;
  184. }
  185. .ptc-button {
  186. margin-top: 24px;
  187. width: 248px;
  188. height: 68px;
  189. font-size: 32px;
  190. }
  191. }
  192. }
  193. </style>