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.

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