index.vue 5.6 KB

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