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.

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