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.

341 lines
11 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
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="categories" :default="0" @change="getCategory" :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" v-if="renderList.length > 0">
  44. <pagination :pageLength="pageLength" @update="updateCurrentPage"></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. },
  78. data() {
  79. return {
  80. apiUrl: process.env.SERVICE_CONSOLE,
  81. bookingType: [
  82. this.$t("booking.All"),
  83. this.$t("booking.Awaiting Confirmation"),
  84. this.$t("booking.Processing"),
  85. this.$t("booking.Completed"),
  86. this.$t("booking.Cancelled"),
  87. ],
  88. previewImage:[],
  89. currentType: "All",
  90. filterList: ["All categories"],
  91. categoryList: [],
  92. categories: [],
  93. emptyImg: require("~/assets/img/companyEmpty.png"),
  94. contactUs: {
  95. Phone: "info@showeasy.com",
  96. Mail: "+886-2-2725-5000",
  97. },
  98. swiperOption: {
  99. slidesPerView: 3,
  100. breakpoints: {
  101. 768: {
  102. slidesPerView: 5,
  103. },
  104. },
  105. },
  106. apiEndPoint: process.env.SERVICE_CONSOLE,
  107. perPageItems: 6,
  108. currentPage: 1,
  109. selectedCategory: 0,
  110. bookingList: [],
  111. bookingStatus: [],
  112. subCategoryIDs:[],
  113. categoryValue: "",
  114. uploadBookingID: "",
  115. };
  116. },
  117. mounted() {
  118. this.fetchCategory();
  119. },
  120. // watch: {
  121. // searchQuery: {
  122. // handler: function () {
  123. // this.
  124. // },
  125. // },
  126. // },
  127. created(){
  128. this.getUserOrderList();
  129. },
  130. computed: {
  131. // bookingFilter() {
  132. // const categoryList = this.filterByCategory(
  133. // this.bookingList,
  134. // this.selectedCategory
  135. // );
  136. // const tabList = this.filterByTab(categoryList, this.currentType);
  137. // //const searchList = this.filterByQuery(tabList, this.searchQuery);
  138. // //return searchList;
  139. // },
  140. renderList() {
  141. // for (let i in this.bookingList) {
  142. // this.getServiceData(this.bookingList[i], i);
  143. // }
  144. //return this.sliceRenderList(this.bookingFilter);
  145. },
  146. // result() {
  147. // return this.bookingFilter.length;
  148. // },
  149. // pageLength() {
  150. // return Math.ceil(this.result / this.perPageItems);
  151. // },
  152. },
  153. methods: {
  154. getCategory(value){
  155. console.log("value:" + value);
  156. this.categoryValue = value;
  157. if(this.categoryValue == 0){
  158. this.subCategoryIDs = [];
  159. }else{
  160. this.subCategoryIDs.push(value);
  161. }
  162. },
  163. slideClicked(swiper) {
  164. this.currentType = this.bookingType[swiper.clickedIndex];
  165. if(this.currentType == "0"){
  166. this.bookingStatus = [];
  167. }else if(this.currentType == "訂單確認中"){
  168. this.bookingStatus = ["01"];
  169. console.log("Unpaid");
  170. }else if(this.currentType == "訂單處理中"){
  171. this.bookingStatus = ["02"];
  172. }else if(this.currentType == "訂單完成"){
  173. this.bookingStatus = ["03"];
  174. }else if(this.currentType == "訂單取消"){
  175. this.bookingStatus = ["04"];
  176. }else{
  177. this.bookingStatus = [];
  178. }
  179. this.getUserOrderList();
  180. },
  181. activeContactUs() {
  182. this.$modal.show("ContactUs");
  183. },
  184. activeUploadSlip(bookingid) {
  185. this.uploadBookingID = bookingid;
  186. this.$modal.show("UploadRemittanceSlip");
  187. },
  188. fetchCategory() {
  189. this.$axios
  190. .get(`/trending/api/BookingOnline/GetBookingCategory?LangType=${this.$i18n.localeProperties["langQuery"]}`)
  191. .then((response) => {
  192. //console.log(JSON.stringify(response));
  193. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  194. let data = response.data.DATA.rel
  195. if(data){
  196. this.categories = data;
  197. this.categories = this.categories.map((item) => {
  198. return {
  199. id: item.CategoryID,
  200. name: item.CategoryName,
  201. };
  202. });
  203. // const initial = {
  204. // id: "999",
  205. // name: this.$t("userProfile.allCategory"),
  206. // };
  207. // this.categories.splice(0, 0, initial);
  208. //this.getCategoryList();
  209. }
  210. }
  211. })
  212. .catch((error) => {
  213. console.log(error);
  214. });
  215. },
  216. // getCategoryList() {
  217. // const userCategory = [
  218. // ...new Set(
  219. // this.bookingList.map((item) => {
  220. // return item.categoryId;
  221. // })
  222. // ),
  223. // ];
  224. // this.bookingList = this.bookingList.map((item) => {
  225. // item.categoryName =(this.categories[item.categoryId] && this.categories[item.categoryId].name ) ? this.categories[item.categoryId].name : "";
  226. // return item;
  227. // });
  228. // for (const index of userCategory) {
  229. // this.categoryList.push(this.categories[index]);
  230. // }
  231. // },
  232. // updateCategory(categoryId) {
  233. // this.selectedCategory = Number(categoryId);
  234. // },
  235. filterByCategory(data, categoryId) {
  236. if (categoryId === 0) return data;
  237. return data.filter((item) => item.categoryId === categoryId);
  238. },
  239. // filterByTab(data, type) {
  240. // switch (type) {
  241. // case "All":
  242. // this.currentPage = 1;
  243. // return data;
  244. // case "Unpaid":
  245. // this.currentPage = 1;
  246. // return data.filter((item) => item.order_payment[item.order_payment.length-1].payment_status === 0);
  247. // case "Completed":
  248. // this.currentPage = 1;
  249. // return data.filter((item) => item.order_payment[item.order_payment.length-1].payment_status === 2);
  250. // case "Cancelled":
  251. // this.currentPage = 1;
  252. // return data.filter((item) => item.order_payment[item.order_payment.length-1].payment_status === -1);
  253. // case "Processing":
  254. // this.currentPage = 1;
  255. // return data.filter(
  256. // (item) =>
  257. // item.order_payment[item.order_payment.length-1].payment_status !== -1 &&
  258. // item.order_payment[item.order_payment.length-1].payment_status !== 2 &&
  259. // item.order_payment[item.order_payment.length-1].payment_status !== 0
  260. // );
  261. // default:
  262. // return data;
  263. // }
  264. // },
  265. // updateCurrentPage(value) {
  266. // this.currentPage = value;
  267. // },
  268. // sliceRenderList(data) {
  269. // return data.slice(
  270. // (this.currentPage - 1) * this.perPageItems,
  271. // this.currentPage * this.perPageItems
  272. // );
  273. // },
  274. // filterByQuery(data, query) {
  275. // if (query.length < 1) return data;
  276. // return data.filter((item) => {
  277. // return (
  278. // item.service_name.toLowerCase().includes(query.toLowerCase()) ||
  279. // item.order_display_id.toLowerCase().includes(query.toLowerCase()) ||
  280. // item.partnerName.toLowerCase().includes(query.toLowerCase()) ||
  281. // item.categoryName.toLowerCase().includes(query.toLowerCase())
  282. // );
  283. // });
  284. // },
  285. async getUserOrderList() {
  286. this.$axios
  287. .get(`/trending/api/BookingOnline/BookingCardList?SubCategoryIDs=${JSON.stringify(this.subCategoryIDs)}&BookingStatuses=${JSON.stringify(this.bookingStatus)}&PaymentStatuses&Lang=${this.$i18n.localeProperties["langQuery"]}`)
  288. .then((response) => {
  289. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  290. let data = response.data.DATA.rel
  291. if(data){
  292. this.bookingList = data;
  293. }
  294. }
  295. })
  296. .catch((error) => {
  297. console.log(error);
  298. });
  299. },
  300. // async getServiceData(object,i) {
  301. // this.$axios
  302. // .get(
  303. // `${this.apiUrl}/user-services/content?service_id=${object.service_id}&lang_code=${this.$i18n.localeProperties["langQuery"]}&currency=${object.currency}`
  304. // )
  305. // .then((res) => {
  306. // this.bookingList[i].preview_image = res.data.preview_image
  307. // })
  308. // .catch((error) => console.log(error));
  309. // },
  310. },
  311. };
  312. </script>
  313. <style lang="scss" scoped>
  314. ::-webkit-scrollbar {
  315. display: none;
  316. }
  317. :deep() {
  318. // .v-pagination__navigation{
  319. // background-color: #e5e5e5;
  320. // }
  321. .v-pagination>li>.v-pagination__item {
  322. background-color: inherit;
  323. }
  324. .v-pagination__navigation {
  325. background-color: inherit !important;
  326. }
  327. .v-pagination__navigation--disabled {
  328. opacity: 0;
  329. }
  330. }
  331. </style>