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.

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