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.

153 lines
4.7 KiB

2 years ago
2 years ago
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. :class="[
  77. 'tw-mb-[8px]',
  78. 'tw-text-right',
  79. 'tw-bg-primary-1',
  80. 'tw-text-white',
  81. 'tw-text-size-[12px]',
  82. 'tw-w-fit',
  83. 'tw-rounded-[10px]',
  84. 'tw-py-[4px]',
  85. 'tw-px-[10px]',
  86. 'tw-text-right',
  87. ]"
  88. >
  89. 10% OFF
  90. </div>
  91. </div>
  92. <div class="tw-flex tw-justify-end md:tw-py-2">
  93. <div
  94. class="tw-body-3 tw-text-right tw-text-base-hint tw-line-through md:tw-body-2"
  95. >
  96. ${{ formatTotal(40500) }}
  97. </div>
  98. <div
  99. class="tw-body-3 tw-font-bold tw-text-primary-1 tw-ml-[8px] md:tw-body-2"
  100. >
  101. ${{ formatTotal(service.price) }}&nbsp;{{
  102. service.payment_currency === "TWD" ? $t("TWD") : $t("USD")
  103. }}
  104. <span
  105. class="tw-body-3 tw-text-primary-2 tw-font-bold md:tw-body-2"
  106. >{{ $t("up") }}</span
  107. >
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </template>
  114. <script>
  115. import like from "@/components/newComponent/like/like.vue";
  116. export default {
  117. props: {
  118. service: {
  119. type: Object,
  120. },
  121. },
  122. components: {
  123. like,
  124. },
  125. computed: {
  126. formatTotal() {
  127. return function (total) {
  128. if (typeof total === "String") {
  129. const totalNumber = parseInt(total);
  130. return totalNumber.toLocaleString("en-US");
  131. } else {
  132. return total.toLocaleString("en-US");
  133. }
  134. };
  135. },
  136. },
  137. };
  138. </script>
  139. <style lang="scss" scoped>
  140. .card {
  141. -webkit-mask-image: -webkit-radial-gradient(white, black);
  142. }
  143. .like {
  144. left: 25px;
  145. top: 25px;
  146. @media screen and (min-width: 768px) {
  147. left: initial;
  148. right: 25px;
  149. }
  150. }
  151. </style>