You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
4.8 KiB

2 years ago
  1. <template>
  2. <div
  3. class="card tw-bg-white tw-rounded-[25px] md:tw-rounded-[30px] tw-border tw-border-solid tw-border-neutrals-200 tw-relative tw-shadow-[0px_1px_1px_0px_rgba(0,0,0,0.03)] tw-shadow-neutral-200"
  4. >
  5. <div class="tw-absolute like tw-w-[20px] tw-h-[18px]">
  6. <like
  7. :like="service.liked"
  8. :serviceId="service.id"
  9. :isForUserprofile="service.isUserProfile"
  10. @remove-relation="$emit('remove-relation')"
  11. ></like>
  12. </div>
  13. <div
  14. class="tw-grid tw-grid-cols-1 md:tw-grid-cols-[35%_65%] xl:tw-grid-cols-[264px_auto]"
  15. >
  16. <a
  17. :href="localePath(`/service/${service.id}`)"
  18. target="_blank"
  19. class="tw-w-full tw-h-auto tw-overflow-hidden tw-mb-[10px] tw-rounded-t-[25px] md:tw-mb-0 md:tw-rounded-bl-[25px] md:tw-rounded-tr-none md:tw-h-[25vw] xl:tw-h-[198px]"
  20. >
  21. <img
  22. :src="service.preview_image"
  23. class="tw-w-full tw-h-[64vw] tw-transition tw-duration-200 tw-ease-in-out md:tw-h-[25vw] xl:tw-w-[264px] xl:tw-h-[198px] xl:hover:tw-scale-110"
  24. />
  25. </a>
  26. <div class="tw-px-4 tw-pb-[9px] md:tw-px-5 md:tw-py-[10px]">
  27. <div
  28. class="tw-body-4 tw-text-[#757575] tw-flex tw-items-center tw-mb-1 md:tw-pt-[10px] md:tw-pb-[5px]"
  29. >
  30. <nuxt-link
  31. :to="localePath(`/service?country=${service.country}`)"
  32. class="tw-text-neutrals-600"
  33. >
  34. <span>{{ service.countryName }}</span>
  35. </nuxt-link>
  36. <div
  37. v-if="service.city"
  38. class="circle-decoration-location tw-bg-[#757575] tw-h-1 tw-w-1 tw-mx-[6px]"
  39. ></div>
  40. <nuxt-link
  41. :to="localePath(`/service?city=${service.city}`)"
  42. class="tw-text-neutrals-600"
  43. >
  44. <span>{{ service.cityName }}</span>
  45. </nuxt-link>
  46. </div>
  47. <a :href="localePath(`/service/${service.id}`)" target="_blank">
  48. <h2
  49. class="tw-body-4 md:tw-body-3 lg:tw-body-2 tw-text-black tw-font-bold tw-mb-[10px] md:tw-mt-[7px]"
  50. >
  51. {{ service.name }}
  52. </h2>
  53. </a>
  54. <div
  55. v-if="service.category"
  56. class="tw-mb-[10px] tw-bg-neutrals-100 tw-rounded-[10px] tw-w-fit tw-px-[10px] tw-py-1 tw-text-hint tw-body-4 tw-font-normal"
  57. >
  58. {{ service.categoryName }}
  59. </div>
  60. <div class="tw-flex tw-justify-start tw-items-center tw-mb-[10px]">
  61. <span v-if="service.rating" class="tw-body-3 tw-text-primary-1">{{
  62. service.rating || 0
  63. }}</span>
  64. <img
  65. v-if="service.rating"
  66. class="tw-mr-[6px]"
  67. src="~/assets/svg/reviewStar.svg"
  68. alt=""
  69. />
  70. <span v-if="service.reviews" class="tw-text-[#757575]">{{
  71. `(${service.reviews || 0}reviews)`
  72. }}</span>
  73. </div>
  74. <div class="tw-flex tw-justify-end">
  75. <div
  76. v-show="service.disacount"
  77. :class="[
  78. 'tw-mb-[8px]',
  79. 'tw-text-right',
  80. 'tw-bg-primary-1',
  81. 'tw-text-white',
  82. 'tw-text-size-[12px]',
  83. 'tw-w-fit',
  84. 'tw-rounded-[10px]',
  85. 'tw-py-[4px]',
  86. 'tw-px-[10px]',
  87. 'tw-text-right',
  88. ]"
  89. >
  90. 10% OFF
  91. </div>
  92. </div>
  93. <div class="tw-flex tw-justify-end md:tw-py-2">
  94. <div
  95. v-show="service.disacount"
  96. class="tw-body-3 tw-text-right tw-text-base-hint tw-line-through md:tw-body-2"
  97. >
  98. ${{ formatTotal(40500) }}
  99. </div>
  100. <div
  101. class="tw-body-3 tw-font-bold tw-text-primary-1 tw-ml-[8px] md:tw-body-2"
  102. >
  103. ${{ formatTotal(service.price) }}&nbsp;{{
  104. service.payment_currency === "TWD" ? $t("TWD") : $t("USD")
  105. }}
  106. <span
  107. class="tw-body-3 tw-text-primary-2 tw-font-bold md:tw-body-2"
  108. >{{ $t("up") }}</span
  109. >
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. </template>
  116. <script>
  117. import like from "@/components/newComponent/like/like.vue";
  118. export default {
  119. props: {
  120. service: {
  121. type: Object,
  122. },
  123. },
  124. components: {
  125. like,
  126. },
  127. computed: {
  128. formatTotal() {
  129. return function (total) {
  130. if (typeof total === "String") {
  131. const totalNumber = parseInt(total);
  132. return totalNumber.toLocaleString("en-US");
  133. } else {
  134. return total.toLocaleString("en-US");
  135. }
  136. };
  137. },
  138. },
  139. };
  140. </script>
  141. <style lang="scss" scoped>
  142. .card {
  143. -webkit-mask-image: -webkit-radial-gradient(white, black);
  144. }
  145. .like {
  146. left: 25px;
  147. top: 25px;
  148. @media screen and (min-width: 768px) {
  149. left: initial;
  150. right: 25px;
  151. }
  152. }
  153. </style>