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.

328 lines
12 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 id="print" ref="print"
  3. class="tw-px-[15px] tw-my-[60px] md:tw-px-[60px] xl:tw-max-w-screen-xl xl:tw-mx-auto xl:tw-grid xl:tw-grid-cols-1"
  4. >
  5. <div class="section section-one">
  6. <h2
  7. class="t18 title-icon-left tw-text-black tw-mb-[20px] xl:tw-mb-[31px]"
  8. >
  9. {{ $t("Booking info") }}
  10. </h2>
  11. <BookingInfo
  12. class="tw-mb-[20px]"
  13. :BookingOrder="BookingOrder"
  14. @contact-us="activeContactUs"
  15. @view-details="activeViewDetails"
  16. @cancellation-policy="activeCancellationPolicy"
  17. @cancel-booking="activeCancelBooking"
  18. ></BookingInfo>
  19. <ContactUs :ContactUs="ContactUs"></ContactUs>
  20. <CancellationPolicy :Policy="BookingOrder.CancellationPolicy"></CancellationPolicy>
  21. <ViewDetails :BookingOrder="BookingOrder"></ViewDetails>
  22. <CancelBooking :BookingOrder="BookingOrder"></CancelBooking>
  23. <BookingInfoItem :info="BookingOrder" @other-details="activeOtherDetails" @notice-details="activeNoticeDetails"></BookingInfoItem>
  24. <OtherDetails :BookingOrder="BookingOrder"></OtherDetails>
  25. <NoticeDetails :BookingOrder="BookingOrder"></NoticeDetails>
  26. <PaymentDetails v-if="BookingOrder.BookingStatus != '01'"
  27. class="tw-mb-[20px]"
  28. @banking-details = "activeBankingDetails"
  29. @upload-remittanceSlip = "activeUpload"
  30. :BookingOrder="BookingOrder"
  31. ></PaymentDetails>
  32. <BankingDetails :BankingDetails="BankingDetails"></BankingDetails>
  33. <UploadRemittanceSlip @reload-BookingContent="reloadBookingContent" :uploadBookingID="BookingOrder.BookingID"></UploadRemittanceSlip>
  34. <Cancellation :Policy="BookingOrder.CancellationPolicy" class="tw-mb-[20px]"></Cancellation>
  35. <div class="element tw-hidden xl:tw-flex xl:tw-justify-center xl:tw-items-center xl:tw-mt-[12px] no-print">
  36. <button @click="onPrint()"
  37. class="print tw-transition tw-flex tw-justify-center tw-items-center tw-btn-md tw-text-primary-1 tw-bg-neutrals-0 tw-border tw-border-solid tw-border-primary-1 tw-px-[30px] tw-py-[13.5px] tw-rounded-xl hover:tw-bg-primary-3">
  38. {{ $t("Print this page") }}
  39. </button>
  40. </div>
  41. <!-- <ContactInfo
  42. class="tw-mb-[20px]"
  43. :ContactInfo="ContactInfo"
  44. ></ContactInfo> -->
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. import ContactInfo from "@/components/booking/ContactInfo";
  50. import Cancellation from "@/components/booking/Cancellation";
  51. import PaymentDetails from "@/components/booking/PaymentDetails";
  52. import BookingInfoItem from "@/components/booking/BookingInfoItem";
  53. import BookingInfo from "@/components/booking/BookingInfo";
  54. import ViewDetails from "@/components/booking/Modal/ViewDetailsModal.vue";
  55. import OtherDetails from "@/components/booking/Modal/OtherDetailsModal.vue";
  56. import NoticeDetails from "@/components/booking/Modal/NoticeDetailsModal.vue";
  57. import ContactUs from "@/components/booking/Modal/ContactUsModal.vue";
  58. import CancelBooking from "@/components/booking/Modal/CancelBookingModal.vue";
  59. import CancellationPolicy from "@/components/booking/Modal/CancellationPolicyModal.vue";
  60. import BankingDetails from "@/components/booking/Modal/BankingDetailsModal.vue";
  61. import UploadRemittanceSlip from "@/components/booking/Modal/UploadRemittanceSlipModal.vue";
  62. export default {
  63. layout: "service",
  64. auth: true,
  65. components: {
  66. ContactInfo,
  67. Cancellation,
  68. PaymentDetails,
  69. BookingInfoItem,
  70. BookingInfo,
  71. ViewDetails,
  72. OtherDetails,
  73. NoticeDetails,
  74. ContactUs,
  75. CancelBooking,
  76. CancellationPolicy,
  77. BankingDetails,
  78. UploadRemittanceSlip,
  79. },
  80. data() {
  81. return {
  82. apiUrl: process.env.SERVICE_CONSOLE,
  83. content: {
  84. preview_image: "",
  85. country: null,
  86. city: null,
  87. name: "",
  88. highlights: "",
  89. details: "",
  90. cancellation_policy: "",
  91. saved: false,
  92. confirmation_time: 24,
  93. supplier: null,
  94. available_sections: null,
  95. timeStatus: '',
  96. dateStatus: '',
  97. times: [],
  98. start: '',
  99. end: '',
  100. faq: null,
  101. packages: [],
  102. additionalServices: [],
  103. booking_questions: [],
  104. },
  105. Supplier:{
  106. },
  107. BookingOrder: {},
  108. PaymentDetails: [],
  109. ContactInfo: {
  110. //type: Object,
  111. // UserName: "Zack Yang",
  112. // UserMail: "zackyang@gmail.com",
  113. // UserPhone: "+8869-38-234-424",
  114. },
  115. BankingDetails: {
  116. type: Object,
  117. BankName: "E.SUN COMMERCIAL BANK,LTD.,TAIPEI,TAIWAN",
  118. SwiftCode: "ESUNTWTP",
  119. BankAddress:
  120. "No.66-1,Sanching Rd.,Nangang Dist.,Taipei City 115602,Taiwan",
  121. AccountNumber: "1182-879-079298",
  122. AccountName: "SHOWEASY CO.,LTD",
  123. },
  124. NoticeDetails: {
  125. type: Object,
  126. PickUpAddress:
  127. "3rd Floor,No 457,Chongyang Road,Nangang District,Taipei City,Taiwan,11560",
  128. DropOffAddress:
  129. "3rd Floor,No 457,Chongyang Road,Nangang District,Taipei City,Taiwan,11560",
  130. DriverName: "Zack Yang",
  131. DriverMail: "zackyang@gmail.com",
  132. DriverPhone: "+8869-38-234-424",
  133. },
  134. OtherDetail: [],
  135. ViewDetails: {
  136. type: Object,
  137. Deposit: "30.000",
  138. FirstPayment: "20.000",
  139. SecondPayment: "50.000",
  140. ThirdPayment: "60.000",
  141. FinalPayment: "40.000",
  142. TotalAmount: "200.000",
  143. },
  144. ContactUs: {
  145. type: Object,
  146. Phone: "+886-2-2725-5000",
  147. Mail: "info@showeasy.com",
  148. },
  149. onsiteService: {},
  150. payment: {},
  151. bookingID: "",
  152. };
  153. },
  154. async created() {
  155. await this.getBookingID();
  156. await this.getOrder();
  157. if (this.$auth.authtoken != null) {
  158. // await this.getServiceData();
  159. // await this.getPackages();
  160. // await this.getAdditionalServices();
  161. // await this.getNotice();
  162. }
  163. },
  164. methods: {
  165. print() {
  166. if (process.browser) {
  167. this.$nextTick(()=>{
  168. window.print();
  169. });
  170. }
  171. },
  172. onPrint() {
  173. this.$print(this.$refs.print)
  174. this.$nextTick(()=>{
  175. let arr=document.getElementsByClassName('isNeedRemove')
  176. if(arr.length) arr[0].remove();
  177. })
  178. },
  179. async getBookingID(){
  180. await this.$axios
  181. .get(`/trending/api/BookingOnline/FindBookingID?BookingNo=${this.$route.params.id}&Lang=${this.$i18n.localeProperties["langQuery"]}`)
  182. .then((response) => {
  183. const data = response.data.DATA.rel;
  184. this.bookingID = data;
  185. console.log("ID:" + this.bookingID);
  186. })
  187. .catch((error) => {
  188. console.log(error);
  189. });
  190. },
  191. async getOrder() {
  192. await this.$axios
  193. .get(`/trending/api/BookingOnline/Booking?BookingID=${this.bookingID}&BookingNo=${this.$route.params.id}&Lang=${this.$i18n.localeProperties["langQuery"]}`)
  194. .then((response) => {
  195. const data = response.data.DATA.rel;
  196. this.BookingOrder = data;
  197. console.log("訂單:" + JSON.stringify(this.BookingOrder));
  198. })
  199. .catch((error) => {
  200. console.log(error);
  201. });
  202. },
  203. async getServiceData() {
  204. await this.$axios
  205. .get(
  206. `${this.apiUrl}/user-services/content?service_id=${this.serviceId}&lang_code=${this.$i18n.localeProperties["langQuery"]}&currency=${this.currency}`
  207. )
  208. .then((res) => {
  209. this.content.preview_image = res.data.preview_image;
  210. this.content.name = res.data.name;
  211. this.content.country = res.data.country;
  212. this.content.city = res.data.city;
  213. this.content.highlights = res.data.highlights;
  214. this.content.details = res.data.details;
  215. this.content.cancellation_policy = res.data.cancellation_policy;
  216. this.content.supplier = res.data.supplier;
  217. this.content.available_sections = res.data.available_sections;
  218. this.content.times = res.data.available_sections.times;
  219. this.content.timeStatus = res.data.available_sections.time_status;
  220. this.content.dateStatus = res.data.available_sections.date_status;
  221. this.content.start = res.data.available_sections.start;
  222. this.content.end = res.data.available_sections.end;
  223. this.content.payment_currency = res.data.payment_currency;
  224. this.content.booking_questions = res.data.booking_questions;
  225. this.Supplier = res.data.supplier;
  226. })
  227. .catch((error) => console.log(error));
  228. },
  229. async getPackages() {
  230. let orderPackageId = this.BookingOrder.order_item[0].package_id ? this.BookingOrder.order_item[0].package_id : "";
  231. await this.$axios
  232. .get(
  233. `${this.apiUrl}/user-services/packages?service_id=${this.serviceId}&lang_code=${this.$i18n.localeProperties["langQuery"]}&currency=${this.currency}`
  234. )
  235. .then((res) => {
  236. this.content.packages = res.data;
  237. let packageObject = this.content.packages[this.content.packages.findIndex(item => item.package_id === orderPackageId)]
  238. for (let i in packageObject.questions) {
  239. packageObject.questions[i].required = packageObject.questions[i].required_ans;
  240. this.content.booking_questions.push(packageObject.questions[i])
  241. }
  242. })
  243. .catch((error) => console.log(error));
  244. },
  245. async getAdditionalServices() {
  246. await this.$axios
  247. .get(
  248. `${this.apiUrl}/user-services/additional?service_id=${this.serviceId}&lang_code=${this.$i18n.localeProperties["langQuery"]}&currency=${this.currency}`
  249. )
  250. .then((res) => {
  251. this.content.additionalServices =
  252. res.data.services == [] ? null : res.data;
  253. if(this.BookingOrder.order_as.length > 0 ) {
  254. for (let i in this.content.additionalServices[0].questions) {
  255. this.content.additionalServices[0].questions[i].required = this.content.additionalServices[0].questions[i].required_ans;
  256. this.content.booking_questions.push(this.content.additionalServices[0].questions[i]);
  257. }
  258. }
  259. })
  260. .catch((error) => console.log(error));
  261. },
  262. async getNotice(){
  263. await this.$axios
  264. .get(
  265. `https://lambda.showeasy.com/order-message/ticket?order_no=${this.BookingOrder.order_display_id}&message_title=message`
  266. )
  267. .then((res) => {
  268. if(res.data.items.length > 0 ) {
  269. this.NoticeDetails = res.data.items[res.data.items.length-1];
  270. } else {
  271. this.NoticeDetails.message_content = "";
  272. }
  273. })
  274. .catch((error) => console.log(error));
  275. },
  276. activeContactUs() {
  277. this.$modal.show("ContactUs");
  278. },
  279. activeViewDetails() {
  280. this.$modal.show("ViewDetails");
  281. },
  282. activeCancellationPolicy() {
  283. this.$modal.show("CancellationPolicy");
  284. },
  285. activeCancelBooking() {
  286. this.$modal.show("CancelBooking");
  287. },
  288. activeBankingDetails(){
  289. this.$modal.show("BankingDetails");
  290. },
  291. activeUpload(){
  292. this.$modal.show("UploadRemittanceSlip");
  293. },
  294. activeOtherDetails() {
  295. this.$modal.show("OtherDetails");
  296. },
  297. activeNoticeDetails() {
  298. this.$modal.show("NoticeDetails");
  299. },
  300. reloadBookingContent(){
  301. this.getOrder();
  302. this.$nuxt.refresh();
  303. }
  304. },
  305. };
  306. </script>
  307. <style lang="scss" scoped>
  308. .print {
  309. &::before {
  310. content: "";
  311. display: inline-block;
  312. position: relative;
  313. background-image: url("~/assets/svg/print.svg");
  314. background-position: center;
  315. background-repeat: no-repeat;
  316. background-size: cover;
  317. width: 20px;
  318. height: 20px;
  319. margin-right: 14px;
  320. }
  321. }
  322. </style>