index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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="item.available && getButtonText(item)"
  45. class="ptc-button"
  46. @click="onClickButton(item)"
  47. >
  48. {{ getButtonText(item) }}
  49. </button>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </template>
  55. <script>
  56. import { defineComponent } from 'vue'
  57. import { state, getCurrentOrder } from '@/store'
  58. export default defineComponent({
  59. name: 'OrderDetail',
  60. async beforeRouteEnter(to) {
  61. return await getCurrentOrder(to.params.id)
  62. },
  63. async beforeRouteUpdate(to) {
  64. return await getCurrentOrder(to.params.id)
  65. },
  66. computed: {
  67. info() {
  68. return state.currentOrder
  69. },
  70. },
  71. methods: {
  72. getButtonText(item) {
  73. switch (+item.type) {
  74. case 1:
  75. return +item.need_apply ? 'Apply' : 'Nearby shops'
  76. case 2:
  77. return item.button_type === 'contact_us'
  78. ? 'Contact us'
  79. : item.button_type && item.button_name
  80. case 4:
  81. return +item.receive_method === 2 ? 'Nearby shops' : 'Send to me'
  82. default:
  83. return ''
  84. }
  85. },
  86. onClickButton(item) {
  87. switch (+item.type) {
  88. case 1:
  89. return +item.need_apply
  90. ? this.$router.push(`/repaire/appointment?right_id=${item.id}`)
  91. : 'Nearby shops'
  92. case 2:
  93. return item.button_type === 'contact_us'
  94. ? 'Contact us'
  95. : item.button_type && (location.href = item.button_link)
  96. case 4:
  97. return +item.receive_method === 2
  98. ? 'Nearby shops'
  99. : this.$router.push({
  100. path: '/mailing',
  101. query: {
  102. right_id: item.id,
  103. right_name: item.title,
  104. },
  105. })
  106. default:
  107. return ''
  108. }
  109. },
  110. },
  111. })
  112. </script>
  113. <style lang="scss">
  114. .p-benefits {
  115. .l1 {
  116. display: flex;
  117. font-size: 28px;
  118. color: #90a0c0;
  119. strong {
  120. margin: 0 20px 0 10px;
  121. }
  122. }
  123. .l2 {
  124. margin-top: 48px;
  125. line-height: 56px;
  126. font-size: 40px;
  127. font-weight: bold;
  128. color: #333;
  129. text-align: center;
  130. }
  131. .l3 {
  132. margin-top: 8px;
  133. line-height: 40px;
  134. font-size: 28px;
  135. color: #999;
  136. text-align: center;
  137. }
  138. .l4 {
  139. margin: 64px 0 24px;
  140. font-size: 0;
  141. text-align: center;
  142. button {
  143. margin: auto;
  144. width: 412px;
  145. height: 68px;
  146. font-size: 32px;
  147. }
  148. }
  149. .l5 {
  150. line-height: 44px;
  151. font-weight: bold;
  152. font-size: 32px;
  153. color: $primary-color;
  154. text-align: center;
  155. }
  156. .benefit {
  157. padding-left: 100px;
  158. padding-bottom: 46px;
  159. background-repeat: no-repeat;
  160. background-position: 0 0;
  161. background-size: 64px 64px;
  162. // &-a {
  163. // background-image: url(@img/benefit0.png);
  164. // }
  165. // &-b {
  166. // background-image: url(@img/benefit1.png);
  167. // }
  168. // &-c {
  169. // background-image: url(@img/benefit2.png);
  170. // }
  171. // &-d {
  172. // background-image: url(@img/benefit3.png);
  173. // }
  174. // &-e {
  175. // background-image: url(@img/benefit4.png);
  176. // }
  177. + .benefit {
  178. padding-top: 48px;
  179. background-position: 0 48px;
  180. @include thin-border(top);
  181. }
  182. &-name {
  183. line-height: 56px;
  184. font-size: 40px;
  185. font-weight: bold;
  186. color: #1a1a1a;
  187. }
  188. &-desc {
  189. margin-top: 24px;
  190. line-height: 44px;
  191. font-size: 32px;
  192. color: #1a1a1a;
  193. }
  194. &-sup {
  195. margin-top: 8px;
  196. line-height: 44px;
  197. font-size: 32px;
  198. color: #999;
  199. }
  200. .ptc-button {
  201. margin-top: 24px;
  202. padding: 0 24px;
  203. width: auto;
  204. min-width: 248px;
  205. height: 68px;
  206. font-size: 32px;
  207. }
  208. }
  209. }
  210. </style>