index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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">
  13. <span v-if="info.phone_imei">{{ info.phone_imei }}</span>
  14. <router-link
  15. v-else
  16. class="primary bold"
  17. :to="`/imei/bind?id=${info.id}`"
  18. >BIND IMEI ></router-link
  19. >
  20. </p>
  21. <p
  22. v-if="
  23. info.subscribe_type != 3 && info.status == 1 && info.cancel_sub != 1
  24. "
  25. class="l5"
  26. >
  27. <router-link :to="`/renewal?id=${$route.params.id}`">
  28. Renewal management >
  29. </router-link>
  30. </p>
  31. <p
  32. v-else-if="
  33. info.subscribe_type == 3 && info.status == 1 && info.can_renewal
  34. "
  35. class="l4"
  36. >
  37. <button
  38. class="ptc-button ptc-button--stroke"
  39. @click="$router.push(`/fill-order?renewal=${info.id}`)"
  40. >
  41. Renewal
  42. </button>
  43. </p>
  44. </div>
  45. </div>
  46. <div class="ptc-block">
  47. <div class="ptc-inner">
  48. <div
  49. v-for="(item, index) of info.rights"
  50. :key="index"
  51. class="benefit"
  52. :style="{ backgroundImage: `url(${item.icon})` }"
  53. >
  54. <p class="benefit-name">{{ item.title }}</p>
  55. <p class="benefit-desc">
  56. {{ item.type == 1 ? `Available ${item.left_times}` : item.remark }}
  57. </p>
  58. <p v-if="item.type == 1" class="benefit-sup">
  59. <template v-if="item.available">
  60. Member price:<span class="highlight">${{ item.price }}</span>
  61. </template>
  62. <template v-else-if="item.left_times > 0"
  63. >Available after {{ item.next_available_at }}</template
  64. >
  65. </p>
  66. <button
  67. v-if="item.available && getButtonText(item)"
  68. class="ptc-button"
  69. @click="onClickButton(item)"
  70. >
  71. {{ getButtonText(item) }}
  72. </button>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </template>
  78. <script>
  79. import { defineComponent } from 'vue'
  80. import { state, getCurrentOrder } from '@/store'
  81. export default defineComponent({
  82. name: 'OrderDetail',
  83. async beforeRouteEnter(to) {
  84. return await getCurrentOrder(to.params.id)
  85. },
  86. async beforeRouteUpdate(to) {
  87. return await getCurrentOrder(to.params.id)
  88. },
  89. computed: {
  90. info() {
  91. return state.currentOrder
  92. },
  93. },
  94. methods: {
  95. getButtonText(item) {
  96. switch (+item.type) {
  97. case 1:
  98. return +item.need_apply ? 'Apply' : 'Find Nearby Store'
  99. case 2:
  100. return item.button_type === 'contact_us'
  101. ? 'Contact us'
  102. : item.button_type && item.button_name
  103. case 4:
  104. return +item.receive_method === 2 ? 'Find Nearby Store' : 'Send to me'
  105. default:
  106. return ''
  107. }
  108. },
  109. onClickButton(item) {
  110. switch (+item.type) {
  111. case 1:
  112. return +item.need_apply
  113. ? this.$router.push(`/repair/appointment?right_id=${item.id}`)
  114. : window.open('https://www.ptc.net.au/store-locator/')
  115. case 2:
  116. return item.button_type === 'contact_us'
  117. ? window.open('https://www.ptc.net.au/contact-us/')
  118. : item.button_type && (location.href = item.button_link)
  119. case 4:
  120. return +item.receive_method === 2
  121. ? window.open('https://www.ptc.net.au/store-locator/')
  122. : this.$router.push({
  123. path: '/mailing',
  124. query: {
  125. right_id: item.id,
  126. right_name: item.title,
  127. },
  128. })
  129. default:
  130. return ''
  131. }
  132. },
  133. },
  134. })
  135. </script>
  136. <style lang="scss">
  137. .p-benefits {
  138. .l1 {
  139. display: flex;
  140. font-size: 28px;
  141. color: #90a0c0;
  142. strong {
  143. margin: 0 20px 0 10px;
  144. }
  145. }
  146. .l2 {
  147. margin-top: 48px;
  148. line-height: 56px;
  149. font-size: 40px;
  150. font-weight: bold;
  151. color: #333;
  152. text-align: center;
  153. }
  154. .l3 {
  155. margin-top: 8px;
  156. line-height: 40px;
  157. font-size: 28px;
  158. color: #999;
  159. text-align: center;
  160. }
  161. .l4 {
  162. margin: 64px 0 24px;
  163. font-size: 0;
  164. text-align: center;
  165. button {
  166. margin: auto;
  167. width: 412px;
  168. height: 68px;
  169. font-size: 32px;
  170. }
  171. }
  172. .l5 {
  173. margin-top: 32px;
  174. line-height: 44px;
  175. font-weight: bold;
  176. font-size: 32px;
  177. color: $primary-color;
  178. text-align: center;
  179. }
  180. .benefit {
  181. padding-left: 100px;
  182. padding-bottom: 46px;
  183. background-repeat: no-repeat;
  184. background-position: 0 0;
  185. background-size: 64px 64px;
  186. // &-a {
  187. // background-image: url(@img/benefit0.png);
  188. // }
  189. // &-b {
  190. // background-image: url(@img/benefit1.png);
  191. // }
  192. // &-c {
  193. // background-image: url(@img/benefit2.png);
  194. // }
  195. // &-d {
  196. // background-image: url(@img/benefit3.png);
  197. // }
  198. // &-e {
  199. // background-image: url(@img/benefit4.png);
  200. // }
  201. + .benefit {
  202. padding-top: 48px;
  203. background-position: 0 48px;
  204. @include thin-border(top);
  205. }
  206. &-name {
  207. line-height: 56px;
  208. font-size: 40px;
  209. font-weight: bold;
  210. color: #1a1a1a;
  211. }
  212. &-desc {
  213. margin-top: 24px;
  214. line-height: 44px;
  215. font-size: 32px;
  216. color: #1a1a1a;
  217. }
  218. &-sup {
  219. margin-top: 8px;
  220. line-height: 44px;
  221. font-size: 32px;
  222. color: #999;
  223. }
  224. .ptc-button {
  225. margin-top: 24px;
  226. padding: 0 24px;
  227. width: auto;
  228. min-width: 248px;
  229. height: 68px;
  230. font-size: 32px;
  231. }
  232. }
  233. }
  234. </style>