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.

987 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. const beforePathCookie = this.$route.fullPath;
  336. this.$auth.$storage.setUniversal('userBeforePath', beforePathCookie);
  337. this.isLoading = true;
  338. // this.$nextTick(()=>{
  339. // this.isLoading = false;
  340. // });
  341. this.getOrderingPerson_validation();
  342. // if (this.$auth.loggedIn) {
  343. let data = this.$route.query;
  344. this.serviceID = this.$route.params.id;
  345. //思考可以如何優化
  346. //高雄
  347. // if(this.serviceID == "fb48072e-2d82-4ec6-9aeb-759df42a9ab0"){
  348. if(this.serviceID == "1c6e0001-e2dd-46b5-a617-4dac2f34894f"){
  349. let selectExhibitionData = JSON.parse(decodeURIComponent(data.selectExhibitionData));
  350. // for(let k = 0; k < selectExhibitionData.length; k++) {
  351. // console.log(selectExhibitionData[k])
  352. // }
  353. console.log('資料檢查', selectExhibitionData)
  354. let selectExhibitionServiceData = JSON.parse(decodeURIComponent(data.selectExhibitionServiceData));
  355. let quantityData = JSON.parse(decodeURIComponent(data.quantityData));
  356. this.currency = decodeURIComponent(data.currencyName);
  357. // let pickupServiceData = JSON.parse(data.pickupServiceData);
  358. this.order.preview_image = decodeURIComponent(data.previewFile);
  359. this.order.title = decodeURIComponent(data.title);
  360. let serviceItems = "";
  361. let orderItems = [];
  362. if(selectExhibitionServiceData && selectExhibitionServiceData.length>0){
  363. for(let i=0;i<selectExhibitionServiceData.length;i++){
  364. let tmpData = selectExhibitionServiceData[i];
  365. let target = tmpData.selectServiceItems;
  366. let itemTypes = "";
  367. if(target && target.length>0){
  368. for(let j=0;j<target.length;j++){
  369. if(target[j].name!=""){
  370. if(j>0){
  371. itemTypes +=",";
  372. }
  373. itemTypes += target[j].name;
  374. }
  375. }
  376. }
  377. let item = "["+ tmpData.selectPackape.name +","+tmpData.length+"*"+tmpData.width+"*"+tmpData.height+"cm,"+tmpData.weight+"kg,"+itemTypes+"] x"+tmpData.quantity;
  378. orderItems.push(item);
  379. }
  380. }
  381. for(let n=0;n<quantityData.selectList.length;n++){
  382. let name = quantityData.selectList[n].name;
  383. let num = quantityData.selectList[n].number;
  384. let maxWeight = quantityData.selectList[n].maxWeight;
  385. let size = quantityData.selectList[n].size;
  386. if(num>0){
  387. let item = "["+ name +" "+ this.$t("Ton truck")+","+this.$t("Maximum load")+" "+maxWeight+","+this.$t("Car size")+" "+size+"] x"+num;
  388. orderItems.push(item);
  389. }
  390. }
  391. for(let n=0;n<quantityData.truckList.length;n++){
  392. let name = quantityData.truckList[n].name;
  393. let num = quantityData.truckList[n].number;
  394. if(num>0){
  395. let item = "["+ name +" "+this.$t("Ton lift tailgate truck")+"] x"+num;
  396. orderItems.push(item);
  397. }
  398. }
  399. if(data.totalPrice!=undefined && data.totalPrice!=""){
  400. let price = Number(data.totalPrice);
  401. this.order.total = Math.ceil(price);
  402. this.subTotal = Math.ceil(price);
  403. this.total = Math.ceil(price*0.05)+Math.ceil(price);
  404. }
  405. this.order.order_item = orderItems;
  406. let title = this.order.title;
  407. this.order.title = title;
  408. this.order.service_name = title;
  409. this.order.selectExhibition = title.slice(1, 19);
  410. this.order.selectExhibitionID = selectExhibitionData[1].id;
  411. }
  412. else{
  413. let selectExhibitionData = JSON.parse(decodeURIComponent(data.selectExhibitionData));
  414. console.log(selectExhibitionData)
  415. let selectExhibitionServiceData = JSON.parse(decodeURIComponent(data.selectExhibitionServiceData));
  416. let quantityData = JSON.parse(decodeURIComponent(data.quantityData));
  417. this.currency = decodeURIComponent(data.currencyName);
  418. // let pickupServiceData = JSON.parse(data.pickupServiceData);
  419. this.order.preview_image = decodeURIComponent(data.previewFile);
  420. this.order.title = decodeURIComponent(data.title);
  421. let serviceItems = "";
  422. let orderItems = [];
  423. if(selectExhibitionServiceData && selectExhibitionServiceData.length>0){
  424. for(let i=0;i<selectExhibitionServiceData.length;i++){
  425. let tmpData = selectExhibitionServiceData[i];
  426. let target = tmpData.selectServiceItems;
  427. let itemTypes = "";
  428. if(target && target.length>0){
  429. for(let j=0;j<target.length;j++){
  430. if(target[j].name!=""){
  431. if(j>0){
  432. itemTypes +=",";
  433. }
  434. itemTypes += target[j].name;
  435. }
  436. }
  437. }
  438. let item = "["+ tmpData.selectPackape.name +","+tmpData.length+"*"+tmpData.width+"*"+tmpData.height+"cm,"+tmpData.weight+"kg,"+itemTypes+"] x"+tmpData.quantity;
  439. orderItems.push(item);
  440. }
  441. }
  442. for(let n=0;n<quantityData.selectList.length;n++){
  443. let name = quantityData.selectList[n].name;
  444. let num = quantityData.selectList[n].number;
  445. let maxWeight = quantityData.selectList[n].maxWeight;
  446. let size = quantityData.selectList[n].size;
  447. if(num>0){
  448. let item = "["+ name +" "+ this.$t("Ton truck")+","+this.$t("Maximum load")+" "+maxWeight+","+this.$t("Car size")+" "+size+"] x"+num;
  449. orderItems.push(item);
  450. }
  451. }
  452. for(let n=0;n<quantityData.truckList.length;n++){
  453. let name = quantityData.truckList[n].name;
  454. let num = quantityData.truckList[n].number;
  455. if(num>0){
  456. let item = "["+ name +" "+this.$t("Ton lift tailgate truck")+"] x"+num;
  457. orderItems.push(item);
  458. }
  459. }
  460. if(data.totalPrice!=undefined && data.totalPrice!=""){
  461. let price = Number(data.totalPrice);
  462. this.order.total = Math.ceil(price);
  463. this.subTotal = Math.ceil(price);
  464. this.total = Math.ceil(price*0.05)+Math.ceil(price);
  465. }
  466. this.order.order_item = orderItems;
  467. let title = this.order.title;
  468. this.order.title = title;
  469. this.order.service_name = title;
  470. this.order.selectExhibition = selectExhibitionData.selectPackape.name;
  471. this.order.selectExhibitionID = selectExhibitionData.selectPackape.id;
  472. }
  473. // await this.getContactList();
  474. // await this.getActiveLength();
  475. // await this.getOrder();
  476. // await this.getServiceData();
  477. // await this.getPackages();
  478. await this.getOrderQuestions();
  479. await this.getCountries();
  480. await this.getPayTypes();
  481. // await this.getCompanyList();
  482. this.$nextTick(()=>{
  483. this.isLoading = false;
  484. });
  485. // }
  486. },
  487. mounted() {},
  488. methods: {
  489. checkRoute() {
  490. console.log(this.$route)
  491. },
  492. getQuestionList(){
  493. this.questionList = [{
  494. id: "question01",
  495. name: this.$t("Mobilization date"),
  496. type: "DateText",
  497. validation: true,
  498. value: '',
  499. requiredFlag: '1'
  500. },{
  501. id: "question02",
  502. name: this.$t("Mobilization time"),
  503. type: "TimeText",
  504. validation: true,
  505. value: '',
  506. requiredFlag: '1'
  507. },{
  508. id: "question03",
  509. name: this.$t("Exit date"),
  510. type: "DateText",
  511. validation: true,
  512. value: '',
  513. requiredFlag: '1'
  514. },{
  515. id: "question04",
  516. name: this.$t("Exit time"),
  517. type: "TimeText",
  518. validation: true,
  519. value: '',
  520. requiredFlag: '1'
  521. }];
  522. },
  523. // async getContactList() {
  524. // await this.$axios
  525. // .get(`/trending/api/Members/Contacts`)
  526. // .then((response) => {
  527. // if(response && response.data && response.data.DATA && response.data.DATA.rel){
  528. // let data = response.data.DATA.rel
  529. // if(data.length>0){
  530. // this.userContactList = data.map((item) => {
  531. // return {
  532. // first_name: item.FirstName,
  533. // last_name: item.LastName,
  534. // email: item.Email,
  535. // phone_number: item.PhoneCountryCode +"-"+ item.PhoneNo
  536. // };
  537. // });
  538. // }
  539. // }
  540. // })
  541. // .catch((err) => {
  542. // console.log(err);
  543. // });
  544. // },
  545. // async updateContactList() {
  546. // const patchData = {};
  547. // await this.$axios
  548. // .post(`/trending/api/Members/Contacts`,patchData)
  549. // .then((result) => {
  550. // // this.userContactList = result.data.contacts;
  551. // // this.activeLabel = this.userContactList.length;
  552. // // return result.data;
  553. // })
  554. // .catch((err) => {
  555. // console.log(err);
  556. // });
  557. // },
  558. async getOrder() {
  559. // await this.$axios
  560. // .get(
  561. // `/order/${this.$route.params.id}?jwt=${
  562. // this.$auth.$storage.getUniversal("jwt").token
  563. // }`
  564. // )
  565. // .then((res) => {
  566. // this.order = res.data;
  567. // for (let index in this.order[0].order_item) {
  568. // this.subTotal += this.order[0].order_item[index].item_amount;
  569. // }
  570. // for (let index in this.order[0].order_as) {
  571. // this.subTotal += this.order[0].order_as[index].as_amount;
  572. // }
  573. // this.serviceId = this.order[0].service_id;
  574. // this.currency = this.order[0].currency;
  575. // })
  576. // .catch((err) => {
  577. // console.log(err);
  578. // });
  579. },
  580. async getServiceData() {
  581. await this.$axios
  582. .get(`/trending/api/Onsite/Info?Lang=${this.$i18n.localeProperties["langQuery"]}&ServiceID=${this.$route.params.id}`)
  583. .then((response) => {
  584. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  585. let data = response.data.DATA.rel
  586. if(data){
  587. // this.content.service_name = data.ServiceName;
  588. // this.content.package_name = data.Features;
  589. // this.content.package_name = data.Details;
  590. // this.content.customer_plan_name = data.CancelPolicy;
  591. // this.content.specification_name = data.FQAs;
  592. // this.content.quantity = data.ConfirmDays;
  593. // this.content.service_date = "2023-02-13";
  594. // this.content.service_time = "02:00:12";
  595. // this.content.booking_questions = data.FQAs;
  596. // this.content.preview_image = res.data.preview_image;
  597. // this.content.name = res.data.name;
  598. // this.content.country = res.data.country;
  599. // this.content.city = res.data.city;
  600. // this.content.highlights = res.data.highlights;
  601. // this.content.details = res.data.details;
  602. // this.content.cancellation_policy = res.data.cancellation_policy;
  603. // this.content.supplier = res.data.supplier;
  604. // this.content.available_sections = res.data.available_sections;
  605. // this.content.times = res.data.available_sections.times;
  606. // this.content.timeStatus = res.data.available_sections.time_status;
  607. // this.content.dateStatus = res.data.available_sections.date_status;
  608. // this.content.start = res.data.available_sections.start;
  609. // this.content.end = res.data.available_sections.end;
  610. // this.content.payment_currency = 0;
  611. }
  612. }
  613. })
  614. .catch((error) => console.log(error));
  615. },
  616. async getPayTypes() {
  617. await this.$axios
  618. .get(`/trending/api/Onsite/PayTypes?Lang=${this.$i18n.localeProperties["langQuery"]}&ServiceID=${this.$route.params.id}`)
  619. .then((response) => {
  620. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  621. let data = response.data.DATA.rel
  622. if(data.length>0){
  623. this.chooseMethod = data[0].ArgumentID;
  624. this.payTypes = data.map((item)=>{
  625. return {
  626. id: item.ArgumentID,
  627. name: item.ArgumentValue,
  628. }
  629. });
  630. }
  631. }
  632. })
  633. .catch((err) => {
  634. console.log(err);
  635. });
  636. },
  637. async getOrderQuestions() {
  638. await this.$axios
  639. .get(`/trending/api/Onsite/OrderQuestions?Lang=${this.$i18n.localeProperties["langQuery"]}&ServiceID=${this.$route.params.id}`)
  640. .then((response) => {
  641. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  642. let data = response.data.DATA.rel;
  643. this.getQuestionList();
  644. if(data.length>0){
  645. let list = data.map((item)=>{
  646. return {
  647. id: item.QuestionID,
  648. name: item.SurveyName,
  649. type: item.AnswerType,
  650. validation: true,
  651. value: '',
  652. requiredFlag: item.RequiredFlag
  653. }
  654. });
  655. this.questionList = this.questionList.concat(list);
  656. }
  657. }
  658. })
  659. .catch((err) => {
  660. console.log(err);
  661. });
  662. },
  663. async payNow() {
  664. let isPass1 = this.$refs.ref_Booking.getValidation();//this.bookingDetail_Validation;
  665. let isPass2 = true;
  666. this.$refs.purchaserInfo.updatePurchaserInfo(true);//this.purchaserInfo_Validation;
  667. isPass2 = this.purchaserInfo_Validation;
  668. if(isPass1 && isPass2){
  669. let vm = this;
  670. let answerList = [];
  671. let serviceDateS = "";
  672. let serviceDateE = "";
  673. if(this.answerData.length>2){
  674. serviceDateS = this.answerData[0].value.replaceAll(".","/") +" "+ this.answerData[1].value;
  675. serviceDateE = this.answerData[2].value.replaceAll(".","/") +" "+ this.answerData[3].value;
  676. answerList = this.answerData.map((item)=>{
  677. return item.name +":"+item.value;
  678. });
  679. }
  680. if(this.payment_type==null || this.payment_type==""){
  681. return false;
  682. }
  683. let params = {
  684. LangType: this.$i18n.localeProperties["langQuery"],
  685. ExhibitionID: this.order.selectExhibitionID,
  686. CurrencyID: this.$store.getters.getCurrency,
  687. PayType: this.payment_type,
  688. ServiceID: this.serviceID,
  689. TotalPrice: this.total + "",
  690. SubTotal: this.subTotal +"",
  691. BookingItem: this.order.order_item,
  692. OrderQuestion: answerList,
  693. ServiceDateS: serviceDateS,
  694. ServiceDateE: serviceDateE,
  695. //訂購人參數加在這兒
  696. FirstName: this.personInfo.FirstName,
  697. LastName: this.personInfo.LastName,
  698. Email: this.personInfo.Email,
  699. CountryID: this.personInfo.CountryID,
  700. Phone: this.personInfo.Phone,
  701. PhoneCode: this.personInfo.PhoneCode,
  702. //帳單個人資訊參數
  703. INVFirstName: this.individualData.first_name,
  704. INVLastName: this.individualData.last_name,
  705. INVEmail: this.individualData.email,
  706. INVICountryID: this.individualData.country,
  707. INVPhone: this.individualData.phone_number,
  708. INVPhoneCode: this.individualData.phone_code,
  709. //帳單公司資訊參數
  710. INVCompanyName: this.companyData.company_name,
  711. INVTaxNumber: this.companyData.unified_number,
  712. INVCountryID: this.companyData.country,
  713. INVStateName: this.companyData.state_or_province,
  714. INVCityName: this.companyData.city_,
  715. INVStreet1: this.companyData.company_address,
  716. INVZipCode: this.companyData.postal_code,
  717. }
  718. this.isLoading = true;
  719. let jsonData = null;
  720. let statusCode = 'failed'
  721. await this.$axios.post( `/trending/api/Onsite/Booking`, params)
  722. .then((response) => {
  723. //console.log(response);
  724. this.isLoading = false;
  725. if(response && response.response && response.response.status==504){
  726. statusCode = 'failed'
  727. }else{
  728. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  729. statusCode = 'success'
  730. let data = response.data.DATA.rel;
  731. if(data){
  732. jsonData = data;
  733. }
  734. }else{
  735. statusCode = 'failed'
  736. }
  737. }
  738. this.$router.push(
  739. {
  740. path: this.localePath("/service/done/" + this.$route.params.id),
  741. //携带需要传递的参数
  742. query: {
  743. data: encodeURIComponent(JSON.stringify(jsonData)),
  744. status: statusCode,
  745. }
  746. });
  747. })
  748. .catch((err) => {
  749. this.isLoading = false;
  750. this.$router.push(
  751. {
  752. path: this.localePath("/service/done/" + this.$route.params.id),
  753. //携带需要传递的参数
  754. query: {
  755. data: encodeURIComponent(JSON.stringify(jsonData)),
  756. status: statusCode
  757. }
  758. });
  759. console.log(err);
  760. });
  761. }
  762. },
  763. async getCountries() {
  764. await this.$axios
  765. .get(`/trending/api/Onsite/Countries?Lang=${this.$i18n.localeProperties["langQuery"]}`)
  766. .then((response) => {
  767. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  768. let data = response.data.DATA.rel
  769. if(data.length>0){
  770. this.countryOptions = data.map((item)=>{
  771. return {
  772. id: item.CountryID,
  773. name: item.CountryENName + " " + item.CountryName,
  774. }
  775. });
  776. }
  777. }
  778. })
  779. .catch((err) => {
  780. console.log(err);
  781. });
  782. },
  783. getCompanyList() {
  784. this.$axios
  785. .get(
  786. `/trending/api/Members/Companies?Lang=${this.$i18n.localeProperties["langQuery"]}`
  787. )
  788. .then((response) => {
  789. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  790. let data = response.data.DATA.rel
  791. if(data.length>0){
  792. this.userCompanyList = data.map((item) => {
  793. return {
  794. company_name: item.CompanyName,
  795. company_tax_no: item.TaxNumber,
  796. company_address1: item.Street1,
  797. company_address2: item.Street2,
  798. company_city: item.CityName,
  799. company_state: item.StateName,
  800. company_country_name: item.Country.Country,
  801. company_zipcode: item.ZipCode,
  802. company_country: item.Country.CountryID,
  803. };
  804. });
  805. // this.userCompanyList = result.data.data;
  806. // Array.from(this.userCompanyList).forEach((item) => {
  807. // let id = item.company_country;
  808. // let countryName = this.countryOptions.filter(
  809. // (item) => item.id === id || null
  810. // );
  811. // item.company_country_name = countryName[0].name ?? 0;
  812. // });
  813. // return result.data;
  814. }
  815. }
  816. })
  817. .catch((err) => {
  818. console.log(err);
  819. });
  820. },
  821. updateCompanyList() {
  822. const patchData = {};
  823. this.$axios
  824. .post(
  825. `/trending/api/Members/Company`,patchData
  826. )
  827. .then((result) => {
  828. // this.userCompanyList = result.data.data;
  829. // this.companyActiveLabel = this.userCompanyList.length;
  830. // this.Company.company_name =
  831. // result.data.data[this.activeLabel].company_name;
  832. // this.Company.company_tax_no =
  833. // result.data.data[this.activeLabel].company_tax_no;
  834. // this.Company.company_address1 =
  835. // result.data.data[this.activeLabel].company_address1;
  836. // this.Company.company_address2 =
  837. // result.data.data[this.activeLabel].company_address2;
  838. // this.Company.company_city =
  839. // result.data.data[this.activeLabel].company_city;
  840. // this.Company.company_state =
  841. // result.data.data[this.activeLabel].company_state;
  842. // this.Company.company_country =
  843. // result.data.data[this.activeLabel].company_country_name;
  844. // this.Company.company_zipcode =
  845. // result.data.data[this.activeLabel].company_zipcode;
  846. // return result.data;
  847. })
  848. .catch((err) => {
  849. console.log(err);
  850. });
  851. },
  852. //emit回來的訂購人資訊
  853. orderingPersonInfo(value) {
  854. this.personInfo = value;
  855. },
  856. updateOrder() {
  857. let Object = {
  858. order_id: this.order[0].order_id,
  859. total: this.subTotal,
  860. amount: this.subTotal,
  861. discount: 0,
  862. contact: [this.contactData],
  863. answer: this.answerData,
  864. };
  865. if (this.type == "Individual") {
  866. Object.purchase_personal = this.individualData;
  867. } else {
  868. Object.purchase_company = this.companyData;
  869. }
  870. Object.payment = [this.paymentData];
  871. Object.payment[0].payment_index = 0;
  872. Object.payment[0].amount = this.subTotal;
  873. // this.$axios
  874. // .put(
  875. // `/order/${this.$route.params.id}?jwt=${
  876. // this.$auth.$storage.getUniversal("jwt").token || ""
  877. // }`,
  878. // Object
  879. // )
  880. // .then((res) => {
  881. // if (res.status == "200") {
  882. // if (this.paymentData.payment_type == "Credit Card") {
  883. // this.createPayment();
  884. // } else {
  885. // this.$router.push(
  886. // this.localePath("/service/done/" + this.$route.params.id)
  887. // );
  888. // }
  889. // }
  890. // })
  891. // .catch((error) => {
  892. // console.log(error);
  893. // });
  894. },
  895. // getActiveLength() {
  896. // this.activeLabel = this.userContactList.length > 0 ? 1 : 0;
  897. // },
  898. updateToken(token) {
  899. this.payToken = token;
  900. },
  901. // createPayment() {
  902. // this.$axios
  903. // .post(`${this.devECPayUrl}/payment/ecpay/create-payment`, {
  904. // pay_token: this.payToken,
  905. // payment_flow: "ecpay",
  906. // product_order_no: this.orderNo,
  907. // })
  908. // .then((response) => {
  909. // if (response.data.status_code === 200) {
  910. // window.location.assign(response.data.three_d_url);
  911. // }
  912. // })
  913. // .catch((error) => console.log(error));
  914. // },
  915. getOrderingPerson_validation(data) {
  916. this.orderingPerson_Validation = data;
  917. },
  918. getBookingDetail_validation(data) {
  919. this.bookingDetail_Validation = data;
  920. },
  921. getPurchaserInfo_validation(data) {
  922. this.purchaserInfo_Validation = data;
  923. },
  924. },
  925. };
  926. </script>
  927. <style lang="scss" scoped>
  928. .noFilter {
  929. pointer-events: auto;
  930. cursor: auto;
  931. }
  932. .haveFilter {
  933. cursor: not-allowed;
  934. pointer-events: none;
  935. filter: opacity(50%);
  936. }
  937. .btn_login, .btn_add {
  938. padding: 9px 16px;
  939. border-radius: 12px;
  940. border: solid 1px #696969;
  941. background-color: #fefefe;
  942. font-family: NotoSansTC;
  943. font-size: 16px;
  944. font-weight: bold;
  945. font-style: normal;
  946. color: #696969;
  947. }
  948. .btn_login:hover, .btn_add:hover {
  949. background-color: #696969;
  950. color: #fefefe;
  951. }
  952. p {
  953. margin: 0;
  954. }
  955. </style>