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.

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