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.

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