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.

289 lines
7.8 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div>
  3. <Swiper class="swiper tw-mb-[15px] md:tw-mb-[30px]" :options="swiperOption" @click="slideClicked">
  4. <SwiperSlide v-for="(item, index) in bookingType" :key="index"
  5. :class="['tw-transition-all tw-delay-75 tw-ease-in-out', currentType === item
  6. ? 'tw-flex tw-justify-center tw-py-[13px] tw-border-b-2 tw-border-solid tw-border-0 tw-border-primary-1 tw-text-primary-1 tw-cursor-pointer'
  7. : 'tw-flex tw-justify-center tw-py-[13px] tw-border-b tw-border-base-disable hover:tw-border-b-2 tw-border-solid tw-border-0 tw-border-transparent hover:tw-text-primary-1 tw-cursor-pointer']">
  8. {{ item }}
  9. </SwiperSlide>
  10. </Swiper>
  11. <h4 class="t14 tw-font-bold md:t16 tw-mb-[10px]">{{ $t("Filter") }}</h4>
  12. <div class="element tw-w-fit md:tw-w-fit tw-mb-[15px] md:tw-mb-[30px]">
  13. <ElementSelect :select="{
  14. required: false,
  15. }" :selectList="categoryList" :default="0" @change="categorySelected" :defaultOptionMsg="$t('All Categories')">
  16. </ElementSelect>
  17. </div>
  18. <UserServiceItem v-for="(item, index) in bookingList" :key="index" :info="item" @contact-us="activeContactUs"
  19. @upload-remittance-slip="activeUploadSlip"></UserServiceItem>
  20. <!-- <div v-if="bookingList.length < 1" class="tw-mt-[5px] tw-mb-[60px]">
  21. <div class="tw-flex tw-justify-center tw-mt-[60px] tw-mb-[30px]">
  22. <img :src="emptyImg" alt="" class="tw-h-[142px] tw-w-[160px]" />
  23. </div>
  24. <div class="tw-text-center tw-body-3 tw-text-neutrals-800 tw-mb-[30px]">
  25. {{
  26. currentType === "全部"
  27. ? $t(`No Bookings yet ...`)
  28. : $t(`You don't have any ${currentType} bookings`)
  29. }}
  30. </div>
  31. <div class="tw-flex tw-justify-center tw-mb-[30px]">
  32. <button
  33. class="tw-transition tw-justify-center tw-items-center tw-btn-md tw-text-white tw-bg-primary-1 tw-px-[30px] tw-py-[8.5px] tw-rounded-xl tw-w-fit tw-h-fit">
  34. {{ $t("Explore with ShowEasy") }}
  35. </button>
  36. </div>
  37. </div> -->
  38. <!-- <div v-if="bookingList.length < 1"
  39. class="tw-mb-[60px] tw-py-[60px] tw-pl-[10px] md:tw-body-2">
  40. {{ $t("Sorry, we couldn't find anything for ") + searchQuery }}
  41. {{ $t("Sorry, we couldn't find anything for ") }}
  42. </div> -->
  43. <div class="tw-flex tw-justify-end">
  44. <pagination :pageLength="pageLength" @update="updatePage"></pagination>
  45. </div>
  46. <ContactUsModal :ContactUs="contactUs"></ContactUsModal>
  47. <UploadRemittanceSlipModal :uploadBookingID="uploadBookingID"></UploadRemittanceSlipModal>
  48. </div>
  49. </template>
  50. <script>
  51. import ElementSelect from "@/components/user/userSelect.vue";
  52. import UserServiceItem from "./userServiceItem.vue";
  53. import pagination from "@/components/newComponent/pagination/pagination.vue";
  54. import ContactUsModal from "@/components/booking/Modal/ContactUsModal.vue";
  55. import UploadRemittanceSlipModal from "@/components/booking/Modal/UploadRemittanceSlipModal.vue";
  56. import { Swiper, SwiperSlide } from "vue-awesome-swiper";
  57. export default {
  58. components: {
  59. ElementSelect,
  60. UserServiceItem,
  61. Swiper,
  62. SwiperSlide,
  63. pagination,
  64. ContactUsModal,
  65. UploadRemittanceSlipModal,
  66. },
  67. props: {
  68. searchQuery: {
  69. type: String,
  70. },
  71. width: {
  72. type: Number
  73. },
  74. userData: {
  75. type: Object
  76. },
  77. searchValue: {
  78. type: String
  79. }
  80. },
  81. data() {
  82. return {
  83. bookingType: [
  84. this.$t("booking.All"),
  85. this.$t("booking.Awaiting Confirmation"),
  86. this.$t("booking.Processing"),
  87. this.$t("booking.Completed"),
  88. this.$t("booking.Cancelled"),
  89. ],
  90. currentType: "All",
  91. emptyImg: require("~/assets/img/companyEmpty.png"),
  92. contactUs: {
  93. Phone: "info@showeasy.com",
  94. Mail: "+886-2-2725-5000",
  95. },
  96. swiperOption: {
  97. slidesPerView: 3,
  98. breakpoints: {
  99. 768: {
  100. slidesPerView: 5,
  101. },
  102. },
  103. },
  104. currentPage: 1,
  105. itemsPerPage: 6,
  106. total: 0,
  107. categoryValue: "",
  108. bookingList: [],
  109. bookingStatus: [],
  110. subCategoryIDs: [],
  111. uploadBookingID: "",
  112. categoryList: [],
  113. query: "",
  114. };
  115. },
  116. mounted() {
  117. this.fetchCategory();
  118. },
  119. watch: {
  120. searchValue: {
  121. handler: function () {
  122. this.query = this.searchValue;
  123. this.fetchNewBookingList();
  124. },
  125. },
  126. },
  127. async created() {
  128. await this.fetchNewBookingList();
  129. },
  130. computed: {
  131. result() {
  132. return this.total;
  133. },
  134. pageLength() {
  135. return Math.ceil(this.result / this.itemsPerPage);
  136. },
  137. },
  138. methods: {
  139. categorySelected(value) {
  140. this.subCategoryIDs = [];
  141. if (this.categoryValue != 0) {
  142. this.subCategoryIDs.push(value);
  143. }
  144. this.fetchNewBookingList();
  145. },
  146. slideClicked(swiper) {
  147. this.currentType = this.bookingType[swiper.clickedIndex];
  148. if (this.currentType == "0") {
  149. this.bookingStatus = [];
  150. } else if (this.currentType == "訂單確認中") {
  151. this.bookingStatus = ["01"];
  152. } else if (this.currentType == "訂單處理中") {
  153. this.bookingStatus = ["02"];
  154. } else if (this.currentType == "訂單完成") {
  155. this.bookingStatus = ["03"];
  156. } else if (this.currentType == "訂單取消") {
  157. this.bookingStatus = ["04"];
  158. } else {
  159. this.bookingStatus = [];
  160. }
  161. this.fetchNewBookingList();
  162. },
  163. activeContactUs() {
  164. this.$modal.show("ContactUs");
  165. },
  166. activeUploadSlip(bookingid) {
  167. this.uploadBookingID = bookingid;
  168. this.$modal.show("UploadRemittanceSlip");
  169. },
  170. fetchCategory() {
  171. this.$axios
  172. .get(`/trending/api/BookingOnline/BookingCategoryList?Lang=${this.$i18n.localeProperties["langQuery"]}`)
  173. .then((response) => {
  174. //console.log(JSON.stringify(response));
  175. if (response && response.data && response.data.DATA && response.data.DATA.rel) {
  176. let data = response.data.DATA.rel
  177. if (data) {
  178. this.categoryList = data;
  179. this.categoryList = this.categoryList.map((item) => {
  180. return {
  181. id: item.CategoryID,
  182. name: item.CategoryName,
  183. };
  184. });
  185. }
  186. }
  187. })
  188. .catch((error) => {
  189. console.log(error);
  190. });
  191. },
  192. async getBookingList() {
  193. await this.$axios
  194. .get(`/trending/api/BookingOnline/BookingCardList?` +
  195. `&PageIndex=${this.currentPage}` +
  196. `&PageSize=${this.itemsPerPage}` +
  197. `&SubCategoryIDs=${JSON.stringify(this.subCategoryIDs)}` +
  198. `&BookingStatuses=${JSON.stringify(this.bookingStatus)}` +
  199. `&PaymentStatuses` +
  200. `&Query=${this.query}` +
  201. `&Lang=${this.$i18n.localeProperties["langQuery"]}`)
  202. .then((response) => {
  203. if (response && response.data && response.data.DATA && response.data.DATA.rel) {
  204. let data = response.data.DATA.rel;
  205. if (data.DataList) {
  206. this.total = data.Total;
  207. this.bookingList = data.DataList;
  208. }
  209. }
  210. })
  211. .catch((error) => {
  212. console.log(error);
  213. });
  214. },
  215. async fetchNewBookingList() {
  216. this.currentPage = 1;
  217. await this.getBookingList();
  218. },
  219. updatePage(value) {
  220. this.currentPage = value;
  221. window.scrollTo(0, 0);
  222. this.getBookingList();
  223. },
  224. },
  225. };
  226. </script>
  227. <style lang="scss" scoped>
  228. ::-webkit-scrollbar {
  229. display: none;
  230. }
  231. :deep() {
  232. // .v-pagination__navigation{
  233. // background-color: #e5e5e5;
  234. // }
  235. .v-pagination>li>.v-pagination__item {
  236. background-color: inherit;
  237. }
  238. .v-pagination__navigation {
  239. background-color: inherit !important;
  240. }
  241. .v-pagination__navigation--disabled {
  242. opacity: 0;
  243. }
  244. }
  245. </style>