index.vue 5.4 KB

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