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.

270 lines
8.2 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
  1. <template>
  2. <div class="myBooking xl:tw-max-w-[1246px] xl:tw-mx-auto">
  3. <div class="xl:tw-flex xl:tw-justify-between xl:tw-items-start">
  4. <userSidebar
  5. :userData="userData"
  6. :firstName="firstName"
  7. :lastName="lastName"
  8. class="tw-hidden xl:tw-block"
  9. >
  10. </userSidebar>
  11. <!-- <div class="xl:tw-hidden"></div> -->
  12. <div
  13. class="tw-bg-transparent xl:tw-bg-neutrals-100 xl:tw-p-[30px] xl:tw-rounded-[20px] xl:tw-min-w-[900px] xl:tw-max-w-[900px]"
  14. >
  15. <div
  16. class="tw-flex tw-flex-col md:tw-flex-row md:tw-justify-between md:tw-items-center tw-mb-[20px] md:tw-mb-[34px]"
  17. >
  18. <div
  19. class="tw-text-[20px] tw-font-bold tw-text-base-primary tw-mb-[20px] md:t24 md:tw-mb-0"
  20. >
  21. <two-dots class="tw-mr-[30px]"></two-dots>{{ $t("My Bookings") }}
  22. </div>
  23. <div class="element tw-w-full md:tw-w-[320px]">
  24. <userSearchBar
  25. :input="{
  26. id: 'searchQuery',
  27. placeHolder: $t('Enter exhibitions, booking number ...'),
  28. type: 'text',
  29. }"
  30. :default="searchQuery"
  31. @change="searchQuery = $event"
  32. ></userSearchBar>
  33. </div>
  34. </div>
  35. <bookingListContent
  36. :searchQuery="searchQuery"
  37. :width="width"
  38. :userData="userData"
  39. ></bookingListContent>
  40. <!-- <section class="step sercion-6 tw-w-full md:tw-px-0 xl:tw-col-span-2">
  41. <h2 class="title-icon-left t16 md:t20 xl:t18 xl:tw-font-bold">
  42. {{ $t("You might like ...") }}
  43. </h2>
  44. <userYouMightLike
  45. :list="youMightLikeList"
  46. :countrycode="countrycode"
  47. :regionName="regionName"
  48. >
  49. </userYouMightLike>
  50. </section> -->
  51. </div>
  52. </div>
  53. </div>
  54. </template>
  55. <script>
  56. import TwoDots from "@/components/TwoDots";
  57. import userSearchBar from "@/components/user/userSearchBar.vue";
  58. import bookingListContent from "@/components/user/bookingListContent.vue";
  59. import userYouMightLike from "@/components/user/userYouMightLike.vue";
  60. import userSidebar from "@/components/user/userSidebar.vue";
  61. export default {
  62. name: "myBooking",
  63. layout: "profile_gray",
  64. components: {
  65. TwoDots,
  66. userSearchBar,
  67. bookingListContent,
  68. userYouMightLike,
  69. userSidebar,
  70. },
  71. data() {
  72. return {
  73. firstName: "",
  74. lastName: "",
  75. userData: {},
  76. userCompanyId: [],
  77. userCompanyList: [],
  78. userAddNewCompanyList: [],
  79. userSavedExhibitionList: [],
  80. userVisibleSavedExhibitionList: [],
  81. yearOptions: [],
  82. monthOptions: [],
  83. dayOptions: [],
  84. yearSelect: "",
  85. monthSelect: "",
  86. daySelect: "",
  87. phoneValid: false,
  88. width: 0,
  89. searchQuery: "",
  90. youMightLikeList: [],
  91. countrycode: [],
  92. regionName: [],
  93. };
  94. },
  95. created() {
  96. this.fetchUserData();
  97. // this.getLocationName();
  98. // this.getYouMightLikeData();
  99. if (process.browser) {
  100. window.addEventListener("resize", this.handleResize);
  101. }
  102. this.handleResize();
  103. },
  104. mounted() {
  105. this.yearOptions = Array.from(new Array(103), (val, index) =>
  106. (index + 1920).toString()
  107. );
  108. this.monthOptions = Array.from(new Array(13), (val, index) => {
  109. if (index < 10 && index > 0) {
  110. return "0" + index.toString();
  111. }
  112. if (index >= 10) {
  113. return index.toString();
  114. }
  115. });
  116. this.dayOptions = Array.from(new Array(32), (val, index) => {
  117. if (index < 10 && index > 0) {
  118. return "0" + index.toString();
  119. }
  120. if (index >= 10) {
  121. return index.toString();
  122. }
  123. });
  124. this.$nextTick(() => {
  125. window.addEventListener("resize", this.onResize);
  126. });
  127. },
  128. destroyed() {
  129. if (process.browser) {
  130. window.removeEventListener("resize", this.handleResize);
  131. }
  132. },
  133. methods: {
  134. patchUserData() {
  135. // if (this.width < 1366) {
  136. // this.isEditInfoDialogActive = !this.isEditInfoDialogActive;
  137. // }
  138. this.validators();
  139. // if (this.validators()) {
  140. // this.userData.prefer_country = JSON.stringify(this.languageSelect);
  141. // if (this.$vuetify.breakpoint.name !== "xs") {
  142. // this.userData.birth_date =
  143. // this.yearSelect + "-" + this.monthSelect + "-" + this.daySelect;
  144. // if (this.userData.birth_date.length < 10) {
  145. // this.userData.birth_date = null;
  146. // }
  147. // }
  148. const patchData = JSON.parse(JSON.stringify(this.userData));
  149. // delete patchData.LoginLog;
  150. //delete patchData.UserCompany;
  151. // delete patchData.UserSocialRelation;
  152. // delete patchData.UserExhibition;
  153. this.$axios
  154. .post(
  155. `/trending/api/Members/Member`, patchData
  156. )
  157. .then((response) => {
  158. //console.log(JSON.stringify(response));
  159. if (response.status == 200) {
  160. this.successUpdate = !this.successUpdate;
  161. setTimeout(() => {
  162. this.successUpdate = !this.successUpdate;
  163. }, 1000);
  164. }
  165. this.fetchUserData();
  166. })
  167. .catch((error) => {
  168. console.log(error);
  169. });
  170. },
  171. fetchUserData() {
  172. this.$axios
  173. .get(
  174. `/trending/api/Members/Info`
  175. )
  176. .then((response) => {
  177. //console.log(JSON.stringify(response));
  178. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  179. let data = response.data.DATA.rel
  180. if(data){
  181. this.userData = data;
  182. this.firstName = this.userData.FirstName;
  183. this.lastName = this.userData.LastName;
  184. this.userData.Phone ? (this.phoneValid = true): (this.phoneValid = false);
  185. //this.countryCode = this.userData.PhoneCode;
  186. if(this.userData.LanguageID == "en-US"){
  187. this.languageSelect.en = true;
  188. }else if(this.userData.LanguageID == "zh-TW"){
  189. this.languageSelect.zhtw = true;
  190. }else{
  191. this.languageSelect.en = "";
  192. this.languageSelect.zhtw = "";
  193. }
  194. if (
  195. this.userData.BirthDate && typeof this.userData.BirthDate === "object"
  196. ){
  197. this.yearSelect = "";
  198. this.monthSelect = "";
  199. this.daySelect = "";
  200. }else{
  201. const space = this.userData.BirthDate.split("T");
  202. const date = space[0].split("-");
  203. this.yearSelect = date[0];
  204. this.monthSelect = date[1];
  205. this.daySelect = date[2];
  206. }
  207. }
  208. }
  209. })
  210. .catch((error) => {
  211. console.log(error);
  212. });
  213. },
  214. logout() {
  215. this.$auth.$storage.removeUniversal("jwt");
  216. this.$auth.$storage.removeUniversal("userPicture");
  217. this.$auth.$storage.removeUniversal("userLastName");
  218. this.$auth.$storage.removeUniversal("userBeforePath");
  219. if (width < 1024) {
  220. this.$router.push(this.localePath("/"));
  221. } else {
  222. this.$router.push(this.localePath("/user"));
  223. }
  224. this.$auth.logout();
  225. },
  226. // async getLocationName() {
  227. // this.$axios
  228. // .get(
  229. // `/t/exhibitions/locations?lang=${this.$i18n.localeProperties["langQuery"]}&sort=False`
  230. // )
  231. // .then((response) => {
  232. // this.regionName = response.data.region_ori;
  233. // this.countrycode = response.data.country_ori;
  234. // })
  235. // .catch((error) => console.log(error));
  236. // },
  237. // async getYouMightLikeData() {
  238. // this.$axios
  239. // .get(
  240. // `https://dev-api-console.showeasy.com/user-services/advertisements?region=0&country=0&city=0&expo=0&counts=3&lang_code=${this.$i18n.localeProperties["langQuery"]}`
  241. // )
  242. // .then((res) => {
  243. // this.youMightLikeList = res.data;
  244. // })
  245. // .catch((error) => console.log(error));
  246. // },
  247. handleResize() {
  248. if (process.browser) {
  249. this.width = window.innerWidth;
  250. }
  251. },
  252. },
  253. };
  254. </script>
  255. <style scoped lang="scss"></style>