index.vue 5.2 KB

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