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.

982 lines
34 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
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
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. <client-only>
  3. <div
  4. class="tw-px-[15px] tw-mb-[60px] xl:tw-px-[60px] xl:tw-max-w-screen-xl xl:tw-mx-auto xl:tw-grid xl:tw-grid-cols-[822px_auto] xl:tw-gap-[30px]"
  5. style="background-color: #f1f1f1;"
  6. >
  7. <!-- 步驟條 -->
  8. <section class="section section-one tw-my-[40px] md:tw-my-[50px] xl:tw-col-span-2">
  9. <StepInfo :step_active="step"></StepInfo>
  10. </section>
  11. <!-- 左半畫面 -->
  12. <section class="section section-two">
  13. <!-- 登入 or 加入會員 -->
  14. <div v-if="$auth.loggedIn == false">
  15. <h2
  16. class="t18 title-icon-left tw-text-black tw-mb-[15px] xl:tw-mb-[10px] xl:tw-text-[24px]"
  17. >
  18. {{ $t("Ordering person") }}
  19. </h2>
  20. <div
  21. class="notice tw-body-3 tw-text-black tw-mb-[20px] tw-hidden xl:tw-block"
  22. >
  23. {{
  24. $t(
  25. "Please choose to log in or sign up as a member"
  26. )
  27. }}
  28. </div>
  29. <div
  30. class="tw-flex tw-justify-between purchaser-info tw-p-8 tw-mb-[20px] tw-bg-white tw-rounded-xl"
  31. >
  32. <div style="width: 25%;">
  33. <div style="margin-bottom: 15px;">
  34. <nuxt-link :to="localePath('/user')">
  35. <button
  36. class="btn_login tw-transition"
  37. @click="checkRoute"
  38. >
  39. 登入
  40. </button>
  41. </nuxt-link>
  42. </div>
  43. <div>
  44. <nuxt-link :to="localePath('/user/signUp')">
  45. <button
  46. class="btn_add"
  47. >
  48. 加入會員
  49. </button>
  50. </nuxt-link>
  51. </div>
  52. </div>
  53. <div style="border-left: 1px solid #e5e5e5; width: 75%; padding-left: 30px;">
  54. <p class="tw-body-3 tw-text-primary-1 tw-font-bold">加入會員的好處 : </p>
  55. <ul>
  56. <li class="tw-body-3 tw-text-black tw-font-bold">訂單進行到哪加入會員即時掌握進度</li>
  57. <li class="tw-body-3 tw-text-black tw-font-bold">輕鬆管理訂單所有資料保留雲端紀錄隨手查</li>
  58. <li class="tw-body-3 tw-text-black tw-font-bold">您關注的展覽全蒐藏蒐集自己的展覽資料庫為展覽盡早做準備</li>
  59. <li class="tw-body-3 tw-text-black tw-font-bold">精準提供您需要的展覽資訊及服務優惠</li>
  60. </ul>
  61. </div>
  62. </div>
  63. </div>
  64. <!-- 訂購人資訊 -->
  65. <OrderPersonInfo
  66. :countryOptions="countryOptions"
  67. @orderingPersonInfo="orderingPersonInfo"
  68. @type="type = $event"
  69. @individual="individualData = $event"
  70. @company="companyData = $event"
  71. @orderingPerson_Validation="getOrderingPerson_validation"
  72. >
  73. </OrderPersonInfo>
  74. <!-- 訂購資訊 -->
  75. <h2
  76. class="t18 title-icon-left tw-text-black tw-mb-[15px] xl:tw-mb-[10px] xl:tw-text-[24px]"
  77. >
  78. {{ $t("Ordering information") }}
  79. </h2>
  80. <div
  81. class="notice tw-body-3 tw-text-black tw-mb-[20px] tw-hidden xl:tw-block"
  82. >
  83. {{
  84. $t(
  85. "Please confirm whether the information is filled in correctly. Once the information is sent, it cannot be changed"
  86. )
  87. }}
  88. </div>
  89. <BookingInfoItem
  90. :class="[orderingPerson_Validation ? 'noFilter' : 'haveFilter']"
  91. ref="ref_Booking"
  92. :info="order"
  93. :content="content"
  94. :orderingPerson_Validation="orderingPerson_Validation"
  95. :questions="questionList"
  96. @answer="answerData = $event"
  97. @bookingDetail_validation="getBookingDetail_validation"
  98. >
  99. </BookingInfoItem>
  100. <!-- 完成付款 -->
  101. <h2
  102. class="t18 title-icon-left tw-text-black tw-mb-[15px] lg:tw-mb-[8px] xl:tw-text-[24px] xl:tw-mt-[60px]"
  103. >
  104. {{ $t("Complete Payment") }}
  105. </h2>
  106. <div
  107. class="notice tw-body-3 tw-text-black tw-mb-[20px] tw-hidden xl:tw-block"
  108. >
  109. {{
  110. $t(
  111. "Please enter your info carefully. Once submitted it cannot be changed."
  112. )
  113. }}
  114. </div>
  115. <PurchaserInfo
  116. :class="[bookingDetail_Validation ? 'noFilter' : 'haveFilter']"
  117. ref="purchaserInfo"
  118. :countryOptions="countryOptions"
  119. :infoType="type"
  120. :bookingDetail_Validation="bookingDetail_Validation"
  121. @type="type = $event"
  122. @active="companyActiveLabel = $event"
  123. @individual="individualData = $event"
  124. @company="companyData = $event"
  125. @purchaserInfo_validation="getPurchaserInfo_validation"
  126. ></PurchaserInfo>
  127. <!-- 選擇付款方式 -->
  128. <ChooseMethod
  129. :class="[purchaserInfo_Validation ? 'noFilter' : 'haveFilter']"
  130. :orderNo="orderNo"
  131. :payTypes="payTypes"
  132. :chooseMethod="chooseMethod"
  133. :purchaserInfo_Validation="purchaserInfo_Validation"
  134. @paymentType="payment_type = $event"
  135. @update="updateToken($event)"
  136. >
  137. </ChooseMethod>
  138. <!-- <Invoice v-if="language == 'zh-tw'"></Invoice> -->
  139. <!-- 總金額 -->
  140. <PcTotalPrice
  141. :subTotal="total"
  142. :currency="currency"
  143. v-on:payNowClick="payNow()"
  144. ></PcTotalPrice>
  145. </section>
  146. <!-- 右半畫面 -->
  147. <section class="section section-three">
  148. <PriceInfo
  149. :info="order"
  150. :currency="currency"
  151. ></PriceInfo>
  152. <TotalPrice
  153. :subTotal="subTotal"
  154. :total="total"
  155. :currency="currency"
  156. v-on:payNowClick="payNow()"
  157. ></TotalPrice>
  158. </section>
  159. <!-- <AddContactModal @update="updateContactList"></AddContactModal> -->
  160. <!-- <EditContactModal
  161. ref="EditContactModal"
  162. :contact.sync="userContactList[this.activeLabel - 1]"
  163. @update="getContactList"
  164. ></EditContactModal>
  165. <AddCompanyModal
  166. :selectList.sync="countryOptions"
  167. @update="updateCompanyList()"
  168. >
  169. </AddCompanyModal>
  170. <EditCompanyModal
  171. :selectList.sync="countryOptions"
  172. :company.sync="userCompanyList[companyActiveLabel - 1]"
  173. @update="getCompanyList()"
  174. ></EditCompanyModal> -->
  175. <loading :isLoading="isLoading"></loading>
  176. </div>
  177. </client-only>
  178. </template>
  179. <script>
  180. import StepInfo from "@/components/service/StepInfo";
  181. import BookingInfoItem from "@/components/service/BookingInfoItem";
  182. import PurchaserInfo from "@/components/service/PurchaserInfo";
  183. import OrderPersonInfo from "@/components/service/OrderingPersonInfo";
  184. import ChooseMethod from "@/components/service/ChooseMethod";
  185. import PriceInfo from "@/components/service/PriceInfo";
  186. import TotalPrice from "@/components/service/TotalPrice";
  187. import PcTotalPrice from "@/components/service/PcTotalPrice";
  188. import elementInput from "@/components/newComponent/form/ElementInput";
  189. // import AddContactModal from "@/components/newComponent/modal/AddContactModal";
  190. // import EditContactModal from "@/components/newComponent/modal/EditContactModal";
  191. // import AddCompanyModal from "@/components/newComponent/modal/AddCompanyModal";
  192. // import EditCompanyModal from "@/components/newComponent/modal/EditCompanyModal";
  193. import Invoice from "@/components/service/Invoice.vue";
  194. // import ElementInputNew from "@/components/newComponent/form/ElementInputNew";
  195. import loading from "@/components/newComponent/loading/loading.vue";
  196. export default {
  197. name: "checkout",
  198. // layout: "service",
  199. //layout: ['login', 'service'],
  200. layout: "login",
  201. // auth: true,
  202. auth: false,
  203. components: {
  204. StepInfo,
  205. BookingInfoItem,
  206. PurchaserInfo,
  207. OrderPersonInfo,
  208. ChooseMethod,
  209. PriceInfo,
  210. TotalPrice,
  211. PcTotalPrice,
  212. elementInput,
  213. Invoice,
  214. loading,
  215. // AddContactModal,
  216. // EditContactModal,
  217. // AddCompanyModal,
  218. // EditCompanyModal,
  219. // ElementInputNew,
  220. },
  221. data() {
  222. return {
  223. isLoading: false,
  224. serviceID: '',
  225. apiUrl: process.env.SERVICE_CONSOLE,
  226. devECPayUrl: "https://dev-lambda.showeasy.com",
  227. language: this.$i18n.locale,
  228. step: "2",
  229. orderNo: this.$route.params.id,
  230. order: {
  231. title: '',
  232. detail: '',
  233. preview_image: '',
  234. date: '',
  235. quantity: '',
  236. total: 0,
  237. service_name: '',
  238. package_name: '',
  239. package_name: '',
  240. customer_plan_name: '',
  241. service_date: '',
  242. service_time: '',
  243. selectExhibition: '',
  244. selectExhibitionID: '',
  245. order_as: [],
  246. order_item: []
  247. },
  248. serviceId: "",
  249. currency: "NTD",
  250. type: "Company",
  251. individualData: {},
  252. companyData: {},
  253. contactData: {},
  254. paymentData: {},
  255. answerData: [],
  256. content: {
  257. preview_image: "",
  258. country: null,
  259. city: null,
  260. name: "",
  261. highlights: "",
  262. details: "",
  263. cancellation_policy: "",
  264. saved: false,
  265. confirmation_time: 24,
  266. supplier: null,
  267. available_sections: null,
  268. timeStatus: "",
  269. dateStatus: "",
  270. times: [],
  271. start: "",
  272. end: "",
  273. faq: null,
  274. packages: [],
  275. additionalServices: [],
  276. booking_questions: [],
  277. },
  278. subTotal: 0,
  279. total: 0,
  280. activeLabel: 0,
  281. companyActiveLabel: 0,
  282. userContactList: [],
  283. userCompanyList: [],
  284. countryOptions: [],
  285. contact: [],
  286. method: "",
  287. payToken: "",
  288. three_d_url: "",
  289. validation: {
  290. orderPersonInfo: true,
  291. bookingInfo: false,
  292. purchaserInfo: false,
  293. chooseMethod: false,
  294. },
  295. orderingPerson_Validation: false,
  296. bookingDetail_Validation: false,
  297. purchaserInfo_Validation: false,
  298. chooseMethod: "",
  299. payTypes: [],
  300. questionList: [{
  301. id: "question01",
  302. name: this.$t("Mobilization date"),
  303. type: "DateText",
  304. validation: true,
  305. value: '',
  306. requiredFlag: '1'
  307. },{
  308. id: "question02",
  309. name: this.$t("Mobilization time"),
  310. type: "TimeText",
  311. validation: true,
  312. value: '',
  313. requiredFlag: '1'
  314. },{
  315. id: "question03",
  316. name: this.$t("Exit date"),
  317. type: "DateText",
  318. validation: true,
  319. value: '',
  320. requiredFlag: '1'
  321. },{
  322. id: "question04",
  323. name: this.$t("Exit time"),
  324. type: "TimeText",
  325. validation: true,
  326. value: '',
  327. requiredFlag: '1'
  328. }],
  329. payment_type: '',
  330. personInfo: {},
  331. updatePersonalInfo: false,
  332. };
  333. },
  334. async created() {
  335. this.isLoading = true;
  336. // this.$nextTick(()=>{
  337. // this.isLoading = false;
  338. // });
  339. this.getOrderingPerson_validation();
  340. // if (this.$auth.loggedIn) {
  341. let data = this.$route.query;
  342. this.serviceID = this.$route.params.id;
  343. //思考可以如何優化
  344. //高雄
  345. if(this.serviceID == "fb48072e-2d82-4ec6-9aeb-759df42a9ab0"){
  346. let selectExhibitionData = data.selectExhibitionData;
  347. for(let k = 0; k < selectExhibitionData.length; k++) {
  348. console.log(selectExhibitionData[k])
  349. }
  350. console.log('資料檢查', selectExhibitionData)
  351. let selectExhibitionServiceData = JSON.parse(decodeURIComponent(data.selectExhibitionServiceData));
  352. let quantityData = JSON.parse(decodeURIComponent(data.quantityData));
  353. this.currency = decodeURIComponent(data.currencyName);
  354. // let pickupServiceData = JSON.parse(data.pickupServiceData);
  355. this.order.preview_image = decodeURIComponent(data.previewFile);
  356. this.order.title = decodeURIComponent(data.title);
  357. let serviceItems = "";
  358. let orderItems = [];
  359. if(selectExhibitionServiceData && selectExhibitionServiceData.length>0){
  360. for(let i=0;i<selectExhibitionServiceData.length;i++){
  361. let tmpData = selectExhibitionServiceData[i];
  362. let target = tmpData.selectServiceItems;
  363. let itemTypes = "";
  364. if(target && target.length>0){
  365. for(let j=0;j<target.length;j++){
  366. if(target[j].name!=""){
  367. if(j>0){
  368. itemTypes +=",";
  369. }
  370. itemTypes += target[j].name;
  371. }
  372. }
  373. }
  374. let item = "["+ tmpData.selectPackape.name +","+tmpData.length+"*"+tmpData.width+"*"+tmpData.height+"cm,"+tmpData.weight+"kg,"+itemTypes+"] x"+tmpData.quantity;
  375. orderItems.push(item);
  376. }
  377. }
  378. for(let n=0;n<quantityData.selectList.length;n++){
  379. let name = quantityData.selectList[n].name;
  380. let num = quantityData.selectList[n].number;
  381. let maxWeight = quantityData.selectList[n].maxWeight;
  382. let size = quantityData.selectList[n].size;
  383. if(num>0){
  384. let item = "["+ name +" "+ this.$t("Ton truck")+","+this.$t("Maximum load")+" "+maxWeight+","+this.$t("Car size")+" "+size+"] x"+num;
  385. orderItems.push(item);
  386. }
  387. }
  388. for(let n=0;n<quantityData.truckList.length;n++){
  389. let name = quantityData.truckList[n].name;
  390. let num = quantityData.truckList[n].number;
  391. if(num>0){
  392. let item = "["+ name +" "+this.$t("Ton lift tailgate truck")+"] x"+num;
  393. orderItems.push(item);
  394. }
  395. }
  396. if(data.totalPrice!=undefined && data.totalPrice!=""){
  397. let price = Number(data.totalPrice);
  398. this.order.total = Math.ceil(price);
  399. this.subTotal = Math.ceil(price);
  400. this.total = Math.ceil(price*0.05)+Math.ceil(price);
  401. }
  402. this.order.order_item = orderItems;
  403. let title = this.order.title;
  404. this.order.title = title;
  405. this.order.service_name = title;
  406. this.order.selectExhibition = title.slice(1, 19);
  407. // this.order.selectExhibitionID = selectExhibitionData.ArgumentID;
  408. }
  409. else{
  410. let selectExhibitionData = JSON.parse(decodeURIComponent(data.selectExhibitionData));
  411. console.log(selectExhibitionData)
  412. let selectExhibitionServiceData = JSON.parse(decodeURIComponent(data.selectExhibitionServiceData));
  413. let quantityData = JSON.parse(decodeURIComponent(data.quantityData));
  414. this.currency = decodeURIComponent(data.currencyName);
  415. // let pickupServiceData = JSON.parse(data.pickupServiceData);
  416. this.order.preview_image = decodeURIComponent(data.previewFile);
  417. this.order.title = decodeURIComponent(data.title);
  418. let serviceItems = "";
  419. let orderItems = [];
  420. if(selectExhibitionServiceData && selectExhibitionServiceData.length>0){
  421. for(let i=0;i<selectExhibitionServiceData.length;i++){
  422. let tmpData = selectExhibitionServiceData[i];
  423. let target = tmpData.selectServiceItems;
  424. let itemTypes = "";
  425. if(target && target.length>0){
  426. for(let j=0;j<target.length;j++){
  427. if(target[j].name!=""){
  428. if(j>0){
  429. itemTypes +=",";
  430. }
  431. itemTypes += target[j].name;
  432. }
  433. }
  434. }
  435. let item = "["+ tmpData.selectPackape.name +","+tmpData.length+"*"+tmpData.width+"*"+tmpData.height+"cm,"+tmpData.weight+"kg,"+itemTypes+"] x"+tmpData.quantity;
  436. orderItems.push(item);
  437. }
  438. }
  439. for(let n=0;n<quantityData.selectList.length;n++){
  440. let name = quantityData.selectList[n].name;
  441. let num = quantityData.selectList[n].number;
  442. let maxWeight = quantityData.selectList[n].maxWeight;
  443. let size = quantityData.selectList[n].size;
  444. if(num>0){
  445. let item = "["+ name +" "+ this.$t("Ton truck")+","+this.$t("Maximum load")+" "+maxWeight+","+this.$t("Car size")+" "+size+"] x"+num;
  446. orderItems.push(item);
  447. }
  448. }
  449. for(let n=0;n<quantityData.truckList.length;n++){
  450. let name = quantityData.truckList[n].name;
  451. let num = quantityData.truckList[n].number;
  452. if(num>0){
  453. let item = "["+ name +" "+this.$t("Ton lift tailgate truck")+"] x"+num;
  454. orderItems.push(item);
  455. }
  456. }
  457. if(data.totalPrice!=undefined && data.totalPrice!=""){
  458. let price = Number(data.totalPrice);
  459. this.order.total = Math.ceil(price);
  460. this.subTotal = Math.ceil(price);
  461. this.total = Math.ceil(price*0.05)+Math.ceil(price);
  462. }
  463. this.order.order_item = orderItems;
  464. let title = this.order.title;
  465. this.order.title = title;
  466. this.order.service_name = title;
  467. this.order.selectExhibition = selectExhibitionData.selectPackape.name;
  468. this.order.selectExhibitionID = selectExhibitionData.selectPackape.id;
  469. }
  470. // await this.getContactList();
  471. // await this.getActiveLength();
  472. // await this.getOrder();
  473. // await this.getServiceData();
  474. // await this.getPackages();
  475. await this.getOrderQuestions();
  476. await this.getCountries();
  477. await this.getPayTypes();
  478. // await this.getCompanyList();
  479. this.$nextTick(()=>{
  480. this.isLoading = false;
  481. });
  482. // }
  483. },
  484. mounted() {},
  485. methods: {
  486. checkRoute() {
  487. console.log(this.$route)
  488. },
  489. getQuestionList(){
  490. this.questionList = [{
  491. id: "question01",
  492. name: this.$t("Mobilization date"),
  493. type: "DateText",
  494. validation: true,
  495. value: '',
  496. requiredFlag: '1'
  497. },{
  498. id: "question02",
  499. name: this.$t("Mobilization time"),
  500. type: "TimeText",
  501. validation: true,
  502. value: '',
  503. requiredFlag: '1'
  504. },{
  505. id: "question03",
  506. name: this.$t("Exit date"),
  507. type: "DateText",
  508. validation: true,
  509. value: '',
  510. requiredFlag: '1'
  511. },{
  512. id: "question04",
  513. name: this.$t("Exit time"),
  514. type: "TimeText",
  515. validation: true,
  516. value: '',
  517. requiredFlag: '1'
  518. }];
  519. },
  520. // async getContactList() {
  521. // await this.$axios
  522. // .get(`/trending/api/Members/Contacts`)
  523. // .then((response) => {
  524. // if(response && response.data && response.data.DATA && response.data.DATA.rel){
  525. // let data = response.data.DATA.rel
  526. // if(data.length>0){
  527. // this.userContactList = data.map((item) => {
  528. // return {
  529. // first_name: item.FirstName,
  530. // last_name: item.LastName,
  531. // email: item.Email,
  532. // phone_number: item.PhoneCountryCode +"-"+ item.PhoneNo
  533. // };
  534. // });
  535. // }
  536. // }
  537. // })
  538. // .catch((err) => {
  539. // console.log(err);
  540. // });
  541. // },
  542. // async updateContactList() {
  543. // const patchData = {};
  544. // await this.$axios
  545. // .post(`/trending/api/Members/Contacts`,patchData)
  546. // .then((result) => {
  547. // // this.userContactList = result.data.contacts;
  548. // // this.activeLabel = this.userContactList.length;
  549. // // return result.data;
  550. // })
  551. // .catch((err) => {
  552. // console.log(err);
  553. // });
  554. // },
  555. async getOrder() {
  556. // await this.$axios
  557. // .get(
  558. // `/order/${this.$route.params.id}?jwt=${
  559. // this.$auth.$storage.getUniversal("jwt").token
  560. // }`
  561. // )
  562. // .then((res) => {
  563. // this.order = res.data;
  564. // for (let index in this.order[0].order_item) {
  565. // this.subTotal += this.order[0].order_item[index].item_amount;
  566. // }
  567. // for (let index in this.order[0].order_as) {
  568. // this.subTotal += this.order[0].order_as[index].as_amount;
  569. // }
  570. // this.serviceId = this.order[0].service_id;
  571. // this.currency = this.order[0].currency;
  572. // })
  573. // .catch((err) => {
  574. // console.log(err);
  575. // });
  576. },
  577. async getServiceData() {
  578. await this.$axios
  579. .get(`/trending/api/Onsite/Info?Lang=${this.$i18n.localeProperties["langQuery"]}&ServiceID=${this.$route.params.id}`)
  580. .then((response) => {
  581. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  582. let data = response.data.DATA.rel
  583. if(data){
  584. // this.content.service_name = data.ServiceName;
  585. // this.content.package_name = data.Features;
  586. // this.content.package_name = data.Details;
  587. // this.content.customer_plan_name = data.CancelPolicy;
  588. // this.content.specification_name = data.FQAs;
  589. // this.content.quantity = data.ConfirmDays;
  590. // this.content.service_date = "2023-02-13";
  591. // this.content.service_time = "02:00:12";
  592. // this.content.booking_questions = data.FQAs;
  593. // this.content.preview_image = res.data.preview_image;
  594. // this.content.name = res.data.name;
  595. // this.content.country = res.data.country;
  596. // this.content.city = res.data.city;
  597. // this.content.highlights = res.data.highlights;
  598. // this.content.details = res.data.details;
  599. // this.content.cancellation_policy = res.data.cancellation_policy;
  600. // this.content.supplier = res.data.supplier;
  601. // this.content.available_sections = res.data.available_sections;
  602. // this.content.times = res.data.available_sections.times;
  603. // this.content.timeStatus = res.data.available_sections.time_status;
  604. // this.content.dateStatus = res.data.available_sections.date_status;
  605. // this.content.start = res.data.available_sections.start;
  606. // this.content.end = res.data.available_sections.end;
  607. // this.content.payment_currency = 0;
  608. }
  609. }
  610. })
  611. .catch((error) => console.log(error));
  612. },
  613. async getPayTypes() {
  614. await this.$axios
  615. .get(`/trending/api/Onsite/PayTypes?Lang=${this.$i18n.localeProperties["langQuery"]}&ServiceID=${this.$route.params.id}`)
  616. .then((response) => {
  617. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  618. let data = response.data.DATA.rel
  619. if(data.length>0){
  620. this.chooseMethod = data[0].ArgumentID;
  621. this.payTypes = data.map((item)=>{
  622. return {
  623. id: item.ArgumentID,
  624. name: item.ArgumentValue,
  625. }
  626. });
  627. }
  628. }
  629. })
  630. .catch((err) => {
  631. console.log(err);
  632. });
  633. },
  634. async getOrderQuestions() {
  635. await this.$axios
  636. .get(`/trending/api/Onsite/OrderQuestions?Lang=${this.$i18n.localeProperties["langQuery"]}&ServiceID=${this.$route.params.id}`)
  637. .then((response) => {
  638. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  639. let data = response.data.DATA.rel;
  640. this.getQuestionList();
  641. if(data.length>0){
  642. let list = data.map((item)=>{
  643. return {
  644. id: item.QuestionID,
  645. name: item.SurveyName,
  646. type: item.AnswerType,
  647. validation: true,
  648. value: '',
  649. requiredFlag: item.RequiredFlag
  650. }
  651. });
  652. this.questionList = this.questionList.concat(list);
  653. }
  654. }
  655. })
  656. .catch((err) => {
  657. console.log(err);
  658. });
  659. },
  660. payNow() {
  661. let isPass1 = this.$refs.ref_Booking.getValidation();//this.bookingDetail_Validation;
  662. let isPass2 = true;
  663. this.$refs.purchaserInfo.updatePurchaserInfo(true);//this.purchaserInfo_Validation;
  664. isPass2 = this.purchaserInfo_Validation;
  665. if(isPass1 && isPass2){
  666. let vm = this;
  667. let answerList = [];
  668. let serviceDateS = "";
  669. let serviceDateE = "";
  670. if(this.answerData.length>2){
  671. serviceDateS = this.answerData[0].value.replaceAll(".","/") +" "+ this.answerData[1].value;
  672. serviceDateE = this.answerData[2].value.replaceAll(".","/") +" "+ this.answerData[3].value;
  673. answerList = this.answerData.map((item)=>{
  674. return item.name +":"+item.value;
  675. });
  676. }
  677. if(this.payment_type==null || this.payment_type==""){
  678. return false;
  679. }
  680. let params = {
  681. LangType: this.$i18n.localeProperties["langQuery"],
  682. ExhibitionID: this.order.selectExhibitionID,
  683. CurrencyID: this.$store.getters.getCurrency,
  684. PayType: this.payment_type,
  685. ServiceID: this.serviceID,
  686. TotalPrice: this.total + "",
  687. SubTotal: this.subTotal +"",
  688. BookingItem: this.order.order_item,
  689. OrderQuestion: answerList,
  690. ServiceDateS: serviceDateS,
  691. ServiceDateE: serviceDateE,
  692. //訂購人參數加在這兒
  693. FirstName: this.personInfo.FirstName,
  694. LastName: this.personInfo.LastName,
  695. Email: this.personInfo.Email,
  696. CountryID: this.personInfo.CountryID,
  697. Phone: this.personInfo.Phone,
  698. PhoneCode: this.personInfo.PhoneCode,
  699. //帳單個人資訊參數
  700. INVFirstName: this.individualData.first_name,
  701. INVLastName: this.individualData.last_name,
  702. INVEmail: this.individualData.email,
  703. INVICountryID: this.individualData.country,
  704. INVPhone: this.individualData.phone_number,
  705. INVPhoneCode: this.individualData.phone_code,
  706. //帳單公司資訊參數
  707. INVCompanyName: this.companyData.company_name,
  708. INVTaxNumber: this.companyData.unified_number,
  709. INVCountryID: this.companyData.country,
  710. INVStateName: this.companyData.state_or_province,
  711. INVCityName: this.companyData.city_,
  712. INVStreet1: this.companyData.company_address,
  713. INVZipCode: this.companyData.postal_code,
  714. }
  715. this.isLoading = true;
  716. let jsonData = null;
  717. let statusCode = 'failed'
  718. this.$axios.post( `/trending/api/Onsite/Booking`, params)
  719. .then((response) => {
  720. //console.log(response);
  721. this.isLoading = false;
  722. if(response && response.response && response.response.status==504){
  723. statusCode = 'failed'
  724. }else{
  725. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  726. statusCode = 'success'
  727. let data = response.data.DATA.rel;
  728. if(data){
  729. jsonData = data;
  730. }
  731. }else{
  732. statusCode = 'failed'
  733. }
  734. }
  735. this.$router.push(
  736. {
  737. path: this.localePath("/service/done/" + this.$route.params.id),
  738. //携带需要传递的参数
  739. query: {
  740. data: encodeURIComponent(JSON.stringify(jsonData)),
  741. status: statusCode,
  742. }
  743. });
  744. })
  745. .catch((err) => {
  746. this.isLoading = false;
  747. this.$router.push(
  748. {
  749. path: this.localePath("/service/done/" + this.$route.params.id),
  750. //携带需要传递的参数
  751. query: {
  752. data: encodeURIComponent(JSON.stringify(jsonData)),
  753. status: statusCode
  754. }
  755. });
  756. console.log(err);
  757. });
  758. }
  759. },
  760. async getCountries() {
  761. await this.$axios
  762. .get(`/trending/api/Onsite/Countries?Lang=${this.$i18n.localeProperties["langQuery"]}`)
  763. .then((response) => {
  764. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  765. let data = response.data.DATA.rel
  766. if(data.length>0){
  767. this.countryOptions = data.map((item)=>{
  768. return {
  769. id: item.CountryID,
  770. name: item.CountryENName + " " + item.CountryName,
  771. }
  772. });
  773. }
  774. }
  775. })
  776. .catch((err) => {
  777. console.log(err);
  778. });
  779. },
  780. getCompanyList() {
  781. this.$axios
  782. .get(
  783. `/trending/api/Members/Companies?Lang=${this.$i18n.localeProperties["langQuery"]}`
  784. )
  785. .then((response) => {
  786. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  787. let data = response.data.DATA.rel
  788. if(data.length>0){
  789. this.userCompanyList = data.map((item) => {
  790. return {
  791. company_name: item.CompanyName,
  792. company_tax_no: item.TaxNumber,
  793. company_address1: item.Street1,
  794. company_address2: item.Street2,
  795. company_city: item.CityName,
  796. company_state: item.StateName,
  797. company_country_name: item.Country.Country,
  798. company_zipcode: item.ZipCode,
  799. company_country: item.Country.CountryID,
  800. };
  801. });
  802. // this.userCompanyList = result.data.data;
  803. // Array.from(this.userCompanyList).forEach((item) => {
  804. // let id = item.company_country;
  805. // let countryName = this.countryOptions.filter(
  806. // (item) => item.id === id || null
  807. // );
  808. // item.company_country_name = countryName[0].name ?? 0;
  809. // });
  810. // return result.data;
  811. }
  812. }
  813. })
  814. .catch((err) => {
  815. console.log(err);
  816. });
  817. },
  818. updateCompanyList() {
  819. const patchData = {};
  820. this.$axios
  821. .post(
  822. `/trending/api/Members/Company`,patchData
  823. )
  824. .then((result) => {
  825. // this.userCompanyList = result.data.data;
  826. // this.companyActiveLabel = this.userCompanyList.length;
  827. // this.Company.company_name =
  828. // result.data.data[this.activeLabel].company_name;
  829. // this.Company.company_tax_no =
  830. // result.data.data[this.activeLabel].company_tax_no;
  831. // this.Company.company_address1 =
  832. // result.data.data[this.activeLabel].company_address1;
  833. // this.Company.company_address2 =
  834. // result.data.data[this.activeLabel].company_address2;
  835. // this.Company.company_city =
  836. // result.data.data[this.activeLabel].company_city;
  837. // this.Company.company_state =
  838. // result.data.data[this.activeLabel].company_state;
  839. // this.Company.company_country =
  840. // result.data.data[this.activeLabel].company_country_name;
  841. // this.Company.company_zipcode =
  842. // result.data.data[this.activeLabel].company_zipcode;
  843. // return result.data;
  844. })
  845. .catch((err) => {
  846. console.log(err);
  847. });
  848. },
  849. //emit回來的訂購人資訊
  850. orderingPersonInfo(value) {
  851. this.personInfo = value;
  852. },
  853. updateOrder() {
  854. let Object = {
  855. order_id: this.order[0].order_id,
  856. total: this.subTotal,
  857. amount: this.subTotal,
  858. discount: 0,
  859. contact: [this.contactData],
  860. answer: this.answerData,
  861. };
  862. if (this.type == "Individual") {
  863. Object.purchase_personal = this.individualData;
  864. } else {
  865. Object.purchase_company = this.companyData;
  866. }
  867. Object.payment = [this.paymentData];
  868. Object.payment[0].payment_index = 0;
  869. Object.payment[0].amount = this.subTotal;
  870. // this.$axios
  871. // .put(
  872. // `/order/${this.$route.params.id}?jwt=${
  873. // this.$auth.$storage.getUniversal("jwt").token || ""
  874. // }`,
  875. // Object
  876. // )
  877. // .then((res) => {
  878. // if (res.status == "200") {
  879. // if (this.paymentData.payment_type == "Credit Card") {
  880. // this.createPayment();
  881. // } else {
  882. // this.$router.push(
  883. // this.localePath("/service/done/" + this.$route.params.id)
  884. // );
  885. // }
  886. // }
  887. // })
  888. // .catch((error) => {
  889. // console.log(error);
  890. // });
  891. },
  892. // getActiveLength() {
  893. // this.activeLabel = this.userContactList.length > 0 ? 1 : 0;
  894. // },
  895. updateToken(token) {
  896. this.payToken = token;
  897. },
  898. // createPayment() {
  899. // this.$axios
  900. // .post(`${this.devECPayUrl}/payment/ecpay/create-payment`, {
  901. // pay_token: this.payToken,
  902. // payment_flow: "ecpay",
  903. // product_order_no: this.orderNo,
  904. // })
  905. // .then((response) => {
  906. // if (response.data.status_code === 200) {
  907. // window.location.assign(response.data.three_d_url);
  908. // }
  909. // })
  910. // .catch((error) => console.log(error));
  911. // },
  912. getOrderingPerson_validation(data) {
  913. this.orderingPerson_Validation = data;
  914. },
  915. getBookingDetail_validation(data) {
  916. this.bookingDetail_Validation = data;
  917. },
  918. getPurchaserInfo_validation(data) {
  919. this.purchaserInfo_Validation = data;
  920. },
  921. },
  922. };
  923. </script>
  924. <style lang="scss" scoped>
  925. .noFilter {
  926. pointer-events: auto;
  927. cursor: auto;
  928. }
  929. .haveFilter {
  930. cursor: not-allowed;
  931. pointer-events: none;
  932. filter: opacity(50%);
  933. }
  934. .btn_login, .btn_add {
  935. padding: 9px 16px;
  936. border-radius: 12px;
  937. border: solid 1px #696969;
  938. background-color: #fefefe;
  939. font-family: NotoSansTC;
  940. font-size: 16px;
  941. font-weight: bold;
  942. font-style: normal;
  943. color: #696969;
  944. }
  945. .btn_login:hover, .btn_add:hover {
  946. background-color: #696969;
  947. color: #fefefe;
  948. }
  949. p {
  950. margin: 0;
  951. }
  952. </style>