ProductDetailPage.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. <template>
  2. <q-page>
  3. <div class="row" style="background-color: #e5f2fa; height: 50px">
  4. <div class="col-sm-3"></div>
  5. <div
  6. class="col-12 col-sm-9 text-body1 q-pl-md flex"
  7. style="align-items: center"
  8. >
  9. Travel shop > {{ productTypeName }} > {{ productName }}
  10. </div>
  11. </div>
  12. <div class="row q-pa-md" style="min-height: 340px">
  13. <div class="col-12 col-sm-4" style="height: 340px">
  14. <q-carousel
  15. animated
  16. v-model="slide"
  17. navigation
  18. infinite
  19. height="100%"
  20. :autoplay="autoplay"
  21. arrows
  22. transition-prev="slide-right"
  23. transition-next="slide-left"
  24. @mouseenter="autoplay = false"
  25. @mouseleave="autoplay = 2000"
  26. >
  27. <q-carousel-slide
  28. v-for="imageUrl in imageContainer.imageList"
  29. :key="imageUrl"
  30. :name="imageUrl"
  31. :img-src="imageUrl"
  32. >
  33. </q-carousel-slide>
  34. </q-carousel>
  35. </div>
  36. <div class="col-12 col-sm-8 column" style="height: 340px">
  37. <div class="text-h4 q-pl-md" style="height: 50px">
  38. {{ productName }}
  39. </div>
  40. <div class="q-ml-md q-pl-md col" style="background-color: #fff9c6">
  41. {{ removeHtmlTag(productDescription).substring(0, 300) }}...
  42. </div>
  43. </div>
  44. </div>
  45. <div class="row" style="min-height: 500px">
  46. <div class="col-12 col-sm-4 row justify-center" style="height: 500px">
  47. <!-- https://github.com/shubhadip/vuejs3-datepicker#install -->
  48. <datepicker
  49. v-if="renderComponent && productTypeId != LOCALSPECIALTYPRODUCTTYPE"
  50. @selected="handleSelectDate"
  51. use-utc="true"
  52. :disabled-dates="state.disabledDates"
  53. v-model="selectedDate"
  54. :prevent-disable-date-selection="true"
  55. inline="true"
  56. :icon-width="40"
  57. calendar-class="calendarclass"
  58. ></datepicker>
  59. </div>
  60. <div
  61. class="col-12 col-sm-8 q-pl-xl q-pt-md column"
  62. style="min-height: 500px"
  63. >
  64. <div class="row">
  65. <div class="col-3 col-sm-2 text-weight-bold text-h4">Days:</div>
  66. <div
  67. v-if="productTypeId != FLIGHTPRODUCTTYPE"
  68. class="col-11 col-sm-10 flex text-h6 q-pl-sm"
  69. style="align-items: center"
  70. >
  71. {{ days - 1 }} nights {{ days }} days
  72. </div>
  73. <div
  74. v-if="productTypeId === FLIGHTPRODUCTTYPE"
  75. class="col-11 col-sm-10 flex text-h6 q-pl-sm"
  76. style="align-items: center"
  77. >
  78. {{ days }} days
  79. </div>
  80. </div>
  81. <div class="row">
  82. <div class="col-3 col-sm-2 text-weight-bold text-h4">Option:</div>
  83. <div
  84. class="col-11 col-sm-10 flex text-h6 q-pl-sm"
  85. style="align-items: center"
  86. >
  87. <q-btn-toggle
  88. v-model="activeIndex"
  89. spread
  90. no-caps
  91. toggle-color="blue-6"
  92. color="white"
  93. text-color="black"
  94. @click="
  95. setActiveCate(packageCategories[activeIndex], activeIndex)
  96. "
  97. :options="labelValuePair(packageCategories)"
  98. />
  99. </div>
  100. </div>
  101. <div class="row text-weight-bold text-h4 q-mt-xl">Passengers</div>
  102. <div class="row q-mt-md" style="border-top: 2px solid black">
  103. <div
  104. v-if="productTypeId != LOCALSPECIALTYPRODUCTTYPE"
  105. class="row col-12 q-pr-md q-mt-md"
  106. >
  107. <div class="col-11 col-sm-4 q-pr-md">
  108. <q-input
  109. label="Adult Count"
  110. v-model.number="adultCount"
  111. type="number"
  112. min="1"
  113. outlined
  114. />
  115. </div>
  116. <div class="col-11 col-sm-4 q-pr-md">
  117. <q-input
  118. label="Child Count"
  119. v-model.number="childCount"
  120. type="number"
  121. min="0"
  122. outlined
  123. />
  124. </div>
  125. <div class="col-11 col-sm-4 q-pr-md">
  126. <q-input
  127. label="Infant Count(less than 2 years old)"
  128. v-model.number="infantCount"
  129. type="number"
  130. min="0"
  131. outlined
  132. />
  133. </div>
  134. </div>
  135. <div
  136. v-if="productTypeId === LOCALSPECIALTYPRODUCTTYPE"
  137. class="row col-12 q-pr-md q-mt-md"
  138. >
  139. <div class="col-4 q-pr-md">
  140. <q-input
  141. label="Count"
  142. v-model.number="buyCount"
  143. type="number"
  144. min="1"
  145. outlined
  146. />
  147. </div>
  148. </div>
  149. <div class="row col-12" style="height: 50px"></div>
  150. <div
  151. class="row col-12 q-pr-md q-mt-md"
  152. style="background-color: #e9e9e9; min-height: 50px"
  153. >
  154. <div
  155. class="col-4 text-blue-6 text-h5 flex"
  156. style="align-items: center; height: 50px"
  157. >
  158. CNY
  159. </div>
  160. <div
  161. v-if="
  162. productTypeId != LOCALSPECIALTYPRODUCTTYPE &&
  163. productTypeId != HOTELPRODUCTTYPE
  164. "
  165. class="col-4 col-sm-3 flex"
  166. style="align-items: center; height: 50px"
  167. >
  168. {{
  169. adultCount * adultUnitPrice +
  170. childCount * childUnitPrice +
  171. infantCount * infantUnitPrice
  172. }}
  173. </div>
  174. <div
  175. v-if="
  176. productTypeId == LOCALSPECIALTYPRODUCTTYPE ||
  177. productTypeId == HOTELPRODUCTTYPE
  178. "
  179. class="col-4 col-sm-3 flex"
  180. style="align-items: center; height: 50px"
  181. >
  182. {{ generalPrice * buyCount }}
  183. </div>
  184. <div
  185. class="col-7 col-sm-3 flex"
  186. style="align-items: center; height: 50px"
  187. >
  188. <q-btn
  189. class="glossy"
  190. rounded
  191. color="deep-orange"
  192. @click="goPage('/contact')"
  193. label="Pre-book Consult"
  194. />
  195. </div>
  196. <div
  197. class="col-5 col-sm-2 flex"
  198. style="align-items: center; height: 50px"
  199. >
  200. <q-btn
  201. class="glossy"
  202. @click="collectConfigAndGoPage()"
  203. rounded
  204. color="blue-6"
  205. label="Book Now"
  206. />
  207. </div>
  208. </div>
  209. </div>
  210. </div>
  211. </div>
  212. <div
  213. class="row q-pa-md"
  214. style="min-height: 500px; background-color: #d9d9d9"
  215. >
  216. <div
  217. class="col-12"
  218. style="background-color: white"
  219. v-html="productDescription"
  220. ></div>
  221. </div>
  222. </q-page>
  223. </template>
  224. <script>
  225. import { ref, onMounted, nextTick, getCurrentInstance } from "vue";
  226. import { api } from "boot/axios";
  227. import { useSeoMeta } from "unhead";
  228. import { useQuasar } from "quasar";
  229. import { useRoute, useRouter } from "vue-router";
  230. import Datepicker from "vuejs3-datepicker";
  231. import { bookParamStore } from "stores/bookParamStore";
  232. export default {
  233. name: "ProductDetailPage",
  234. components: {
  235. Datepicker,
  236. },
  237. setup() {
  238. const store = bookParamStore();
  239. const instance = getCurrentInstance();
  240. const app = instance.appContext.app;
  241. const gp = app.config.globalProperties;
  242. const $q = useQuasar();
  243. const route = useRoute();
  244. const router = useRouter();
  245. const buyCount = ref(1);
  246. const adultCount = ref(1);
  247. const childCount = ref(0);
  248. const infantCount = ref(0);
  249. const skusInGroup = { skus: [] };
  250. const productName = ref("");
  251. const productDescription = ref("");
  252. const productTypeId = ref("");
  253. const productTypeName = ref("");
  254. const packageCategories = ref([]);
  255. const imageList = ref([]);
  256. const days = ref("");
  257. const imageContainer = { imageList: [] };
  258. const activeCategory = ref("");
  259. const filteredSkuIndex = ref([]);
  260. const activeIndex = ref(0);
  261. const adultUnitPrice = ref(0);
  262. const generalPrice = ref(0);
  263. const childUnitPrice = ref(0);
  264. const infantUnitPrice = ref(0);
  265. const singleMatchedSku = ref({});
  266. const selectedDate = ref(new Date());
  267. const maxNum = ref(1000000);
  268. const renderComponent = ref(true);
  269. const totalPrice = ref(0);
  270. const TYPEOFPACKAGEPROP = "11cd8b32-c4f6-47db-8b8a-486c992bf43b";
  271. const LOCALSPECIALTYPRODUCTTYPE = "fd264cab-ee8d-4571-a477-03d7e7c090b3";
  272. const HOTELPRODUCTTYPE = "a9f5adbe-c09b-49bc-a614-8a1c5d5e5337";
  273. const MAXNUM = "720f4f2e-e114-4003-9806-bc56a9366278";
  274. const PRODUCTIMAGEURLPROP = "2dea54f4-9b9c-413a-8b3a-0caf273283d2";
  275. const DAYSPROP = "8cc865ff-b30f-4f00-b426-9e64418e5100";
  276. const AVAILABLEDATEPROP = "f0b807e5-d1a6-4454-a400-7905a4fea492";
  277. const TOURPRODUCTTYPE = "3a53caed-b788-4290-896d-7922532ad769";
  278. const FLIGHTHOTELPRODUCTTYPE = "e05d07a3-a717-45b8-b009-47a349890e41";
  279. const FLIGHTPRODUCTTYPE = "d7b95089-e278-4522-8f71-dacac41ba32f";
  280. const GENERALPRICE = "e16df480-b17d-4442-91c2-d6c30d0d7ab0";
  281. const ADULTPRICEPROP = "e228b843-e054-41f8-91dd-19663460df54";
  282. const CHILDPRICEPROP = "c4c845a7-4bef-46d8-a5ad-d72a5464e8b1";
  283. const INFANTPRICEPROP = "448406cb-b68f-439e-9da8-148d78ae8404";
  284. const forceRerender = async () => {
  285. // Remove MyComponent from the DOM
  286. renderComponent.value = false;
  287. // Wait for the change to get flushed to the DOM
  288. await nextTick();
  289. // Add the component back in
  290. renderComponent.value = true;
  291. };
  292. function getTotalPrice() {
  293. if (
  294. productTypeId.value != LOCALSPECIALTYPRODUCTTYPE &&
  295. productTypeId.value != HOTELPRODUCTTYPE
  296. ) {
  297. totalPrice.value =
  298. adultCount.value * adultUnitPrice.value +
  299. childCount.value * childUnitPrice.value +
  300. infantCount.value * infantUnitPrice.value;
  301. } else {
  302. totalPrice.value = generalPrice.value * buyCount.value;
  303. }
  304. console.log("this is the total price:");
  305. console.log(totalPrice.value);
  306. return totalPrice.value;
  307. }
  308. function collectConfigAndGoPage() {
  309. if (singleMatchedSku.value == null) {
  310. gp.$generalNotify($q, false, "Not all required config are selected");
  311. return;
  312. }
  313. var params = {};
  314. params.productTypeId = productTypeId.value;
  315. params.productName = productName.value;
  316. params.productSkuId =
  317. singleMatchedSku.value["hichinaProductBasicDTO"]["skuId"];
  318. params.productSkuGroupId = route.params.skuGroupId;
  319. params.packageCategory = activeCategory.value;
  320. params.productTypeName = productTypeName.value;
  321. params.profileImageUrl = extractAttributeValueFromProductPropertyBag(
  322. singleMatchedSku.value,
  323. PRODUCTIMAGEURLPROP
  324. );
  325. params.totalPrice = getTotalPrice();
  326. //params.totalPrice = 1;
  327. if (productTypeId.value != LOCALSPECIALTYPRODUCTTYPE) {
  328. params.adultCount = adultCount.value;
  329. params.childCount = childCount.value;
  330. params.infantCount = infantCount.value;
  331. }
  332. if (LOCALSPECIALTYPRODUCTTYPE != productTypeId.value) {
  333. params.selectedDate = selectedDate.value.toISOString().split("T")[0];
  334. }
  335. if (
  336. productTypeId.value == LOCALSPECIALTYPRODUCTTYPE ||
  337. productTypeId.value == HOTELPRODUCTTYPE
  338. ) {
  339. params.buyCount = buyCount.value;
  340. }
  341. console.log("params collected from product");
  342. console.log(params);
  343. // gp.$goPageWithParams(val, params);
  344. // router.push({ name: val, state: params });
  345. gp.$goPage("/book");
  346. store.setOrderDetail(params);
  347. }
  348. function handleSelectDate(dt) {
  349. console.log("dt");
  350. console.log(dt);
  351. var matchedIndex = -1;
  352. for (var i in filteredSkuIndex.value) {
  353. var index = filteredSkuIndex.value[i];
  354. var availableDatesInString =
  355. extractAttributeValueFromProductPropertyBag(
  356. skusInGroup.skus[index],
  357. AVAILABLEDATEPROP
  358. );
  359. var dateObjArray = multiDateString2DateObjectArray(
  360. availableDatesInString
  361. );
  362. console.log("dateObjArray");
  363. console.log(dateObjArray);
  364. if (dateObjArray.some((e) => e.getDate() == dt.getDate())) {
  365. matchedIndex = index;
  366. break;
  367. }
  368. }
  369. console.log("matchedIndex");
  370. console.log(matchedIndex);
  371. singleMatchedSku.value = skusInGroup.skus[matchedIndex];
  372. maxNum.value = extractAttributeValueFromProductPropertyBag(
  373. singleMatchedSku.value,
  374. MAXNUM
  375. );
  376. console.log("maxNum");
  377. console.log(maxNum.value);
  378. setPrice(singleMatchedSku.value);
  379. }
  380. var state = {
  381. disabledDates: {
  382. to: new Date(2023, 3, 15), // Disable all dates up to specific date
  383. from: new Date(2023, 4, 20), // Disable all dates after specific date
  384. dates: [
  385. // Disable an array of dates
  386. new Date(2016, 9, 16),
  387. new Date(2016, 9, 17),
  388. new Date(2016, 9, 18),
  389. ],
  390. preventDisableDateSelection: true,
  391. },
  392. };
  393. function logPv() {
  394. api
  395. .post(
  396. "/api/public/pagestats/pv/product-detail-" + route.params.skuGroupId
  397. )
  398. .then((res) => {
  399. console.log("log pv:");
  400. console.log(res.data);
  401. })
  402. .catch((err) => {
  403. console.error("Error:", err);
  404. });
  405. }
  406. function logView() {
  407. api
  408. .post("/api/public/pagestats/view-product/" + route.params.skuGroupId)
  409. .then((res) => {
  410. console.log("view cnt of this product:");
  411. console.log(res.data);
  412. })
  413. .catch((err) => {
  414. console.error("Error:", err);
  415. });
  416. }
  417. function extractAttributeValueFromProductPropertyBag(inputObject, attrId) {
  418. var valArray = inputObject.productPropertyBag.filter((obj) => {
  419. return obj.attributeId == attrId;
  420. });
  421. if (valArray.length > 0) {
  422. return valArray[0].attributeValue;
  423. }
  424. return null;
  425. }
  426. function getFilteredSkuIndexAndSetActiveValue(item, index) {
  427. activeCategory.value = item;
  428. filteredSkuIndex.value = [];
  429. for (var i in skusInGroup.skus) {
  430. var sku = skusInGroup.skus[i];
  431. var selectedSkuPropertyBags = sku["productPropertyBag"].filter(
  432. (obj) => {
  433. return obj.attributeId == TYPEOFPACKAGEPROP;
  434. }
  435. );
  436. if (selectedSkuPropertyBags[0].attributeValue == item) {
  437. filteredSkuIndex.value.push(i);
  438. }
  439. }
  440. activeIndex.value = index;
  441. }
  442. function multiDateString2DateObjectArray(candidateAvailableDates) {
  443. var dateObjArray = [];
  444. var datestringArray = candidateAvailableDates.split(";");
  445. for (var i in datestringArray) {
  446. var datestr = datestringArray[i];
  447. if (datestr != null && datestr.length > 0) {
  448. var dateObj = new Date(datestr);
  449. // console.log("...converting string to date:"+ datestr)
  450. // console.log(dateObj)
  451. dateObjArray.push(dateObj);
  452. }
  453. }
  454. return dateObjArray;
  455. }
  456. function compareDate(a, b) {
  457. if (a.getDate() < b.getDate()) {
  458. return -1;
  459. }
  460. if (a.getDate() > b.getDate()) {
  461. return 1;
  462. }
  463. return 0;
  464. }
  465. function setCandidateAvailableDates(indexArray) {
  466. var candidateAvailableDates = "";
  467. for (var i in indexArray) {
  468. var availableDates = extractAttributeValueFromProductPropertyBag(
  469. skusInGroup.skus[indexArray[i]],
  470. AVAILABLEDATEPROP
  471. );
  472. candidateAvailableDates = candidateAvailableDates + availableDates;
  473. }
  474. var dateObjArray = multiDateString2DateObjectArray(
  475. candidateAvailableDates
  476. );
  477. dateObjArray.sort(compareDate);
  478. var minDate = dateObjArray[0];
  479. var maxDate = dateObjArray.slice(-1)[0];
  480. state.disabledDates.to = minDate;
  481. var nextDayOfMax = new Date(maxDate);
  482. nextDayOfMax.setDate(nextDayOfMax.getDate() + 1);
  483. state.disabledDates.from = nextDayOfMax;
  484. var segmentDisabledDates = [];
  485. var pointer = new Date(minDate);
  486. while (pointer < maxDate) {
  487. // check contains
  488. if (!dateObjArray.some((e) => e.getDate() == pointer.getDate())) {
  489. segmentDisabledDates.push(new Date(pointer));
  490. }
  491. // update pointer
  492. pointer.setDate(pointer.getDate() + 1);
  493. }
  494. state.disabledDates.dates = segmentDisabledDates;
  495. forceRerender();
  496. }
  497. function setPrice(sku) {
  498. if (sku == null) {
  499. if (
  500. productTypeId.value == LOCALSPECIALTYPRODUCTTYPE ||
  501. productTypeId.value == HOTELPRODUCTTYPE
  502. ) {
  503. console.log("001");
  504. generalPrice.value = 0;
  505. } else {
  506. adultUnitPrice.value = 0;
  507. childUnitPrice.value = 0;
  508. infantUnitPrice.value = 0;
  509. }
  510. } else {
  511. if (
  512. productTypeId.value == LOCALSPECIALTYPRODUCTTYPE ||
  513. productTypeId.value == HOTELPRODUCTTYPE
  514. ) {
  515. console.log("003");
  516. generalPrice.value = extractAttributeValueFromProductPropertyBag(
  517. sku,
  518. GENERALPRICE
  519. );
  520. } else {
  521. console.log("004");
  522. adultUnitPrice.value = extractAttributeValueFromProductPropertyBag(
  523. sku,
  524. ADULTPRICEPROP
  525. );
  526. childUnitPrice.value = extractAttributeValueFromProductPropertyBag(
  527. sku,
  528. CHILDPRICEPROP
  529. );
  530. infantUnitPrice.value = extractAttributeValueFromProductPropertyBag(
  531. sku,
  532. INFANTPRICEPROP
  533. );
  534. }
  535. }
  536. }
  537. function setActiveDescription() {
  538. var indexToFilter =
  539. filteredSkuIndex.value.length < 1 ? 0 : filteredSkuIndex.value[0];
  540. productDescription.value =
  541. skusInGroup.skus[indexToFilter]["hichinaProductBasicDTO"][
  542. "productContent"
  543. ];
  544. }
  545. function setActiveCate(item, index) {
  546. console.log("picking package cate: " + item);
  547. console.log("index of it is: " + index);
  548. getFilteredSkuIndexAndSetActiveValue(item, index);
  549. setCandidateAvailableDates(filteredSkuIndex.value);
  550. setPrice(null);
  551. selectedDate.value = new Date();
  552. singleMatchedSku.value = null;
  553. setActiveDescription();
  554. }
  555. function setTourProductData(inputArray) {
  556. packageCategories.value = [];
  557. imageList.value = [];
  558. for (var index in inputArray) {
  559. var packageCat = extractAttributeValueFromProductPropertyBag(
  560. inputArray[index],
  561. TYPEOFPACKAGEPROP
  562. );
  563. if (packageCat != null) {
  564. packageCategories.value.push(packageCat);
  565. }
  566. var url = extractAttributeValueFromProductPropertyBag(
  567. inputArray[index],
  568. PRODUCTIMAGEURLPROP
  569. );
  570. if (url != null) {
  571. imageContainer.imageList.push(url);
  572. }
  573. // this if means only need to calculate days once because all this property in the same sku group should be same
  574. if (days.value == "") {
  575. days.value = extractAttributeValueFromProductPropertyBag(
  576. inputArray[index],
  577. DAYSPROP
  578. );
  579. }
  580. }
  581. console.log("imageContainer");
  582. console.log(imageContainer);
  583. // trick: remove duplicates
  584. packageCategories.value = [...new Set(packageCategories.value)];
  585. // force select the first package category on entering page
  586. setActiveCate(packageCategories.value[0], 0);
  587. }
  588. function labelValuePair(valArray) {
  589. var ret = [];
  590. valArray.forEach((x, i) => {
  591. var obj = { label: x, value: i };
  592. ret.push(obj);
  593. });
  594. return ret;
  595. }
  596. function processSkuGroups(inputArray) {
  597. if (inputArray.length > 0) {
  598. productName.value =
  599. inputArray[0]["hichinaProductBasicDTO"]["productName"];
  600. productTypeId.value =
  601. inputArray[0]["hichinaProductBasicDTO"]["productTypeId"];
  602. productTypeName.value =
  603. inputArray[0]["hichinaProductBasicDTO"]["productTypeName"];
  604. useSeoMeta({
  605. title: productName.value,
  606. description: productName.value,
  607. ogDescription: productName.value,
  608. ogTitle: productName.value,
  609. ogImage: "https://www.hichinatravel.com/static/png/name-67280b81.png",
  610. twitterCard: "summary_large_image",
  611. });
  612. if (productTypeId.value === TOURPRODUCTTYPE) {
  613. // 跟团游,则按照跟团游的页面模板来设置各个参数
  614. setTourProductData(inputArray);
  615. } else if (productTypeId.value === FLIGHTHOTELPRODUCTTYPE) {
  616. // 机票酒店套餐
  617. setFlightHotelProductData(inputArray);
  618. } else if (productTypeId.value === FLIGHTPRODUCTTYPE) {
  619. // 机票
  620. setFligtProductData(inputArray);
  621. } else if (productTypeId.value === HOTELPRODUCTTYPE) {
  622. // 酒店
  623. setHotelProductData(inputArray);
  624. } else if (productTypeId.value === LOCALSPECIALTYPRODUCTTYPE) {
  625. // 本地土特产
  626. setLocalSpecialtyProductData(inputArray);
  627. }
  628. }
  629. }
  630. function loadSkusInGroup() {
  631. var params = {};
  632. params.skuGroupId = route.params.skuGroupId;
  633. api
  634. .get("/api/public/productsku/bygroupidwithpropertybag", {
  635. params: params,
  636. })
  637. .then(function (response) {
  638. skusInGroup.skus = response.data.data;
  639. processSkuGroups(skusInGroup.skus);
  640. })
  641. .catch(function (error) {
  642. console.log(error);
  643. });
  644. }
  645. onMounted(() => {
  646. logPv();
  647. logView();
  648. loadSkusInGroup();
  649. });
  650. return {
  651. productTypeName,
  652. productName,
  653. productTypeId,
  654. days,
  655. slide: ref(1),
  656. autoplay: ref(true),
  657. imageContainer,
  658. productDescription,
  659. handleSelectDate,
  660. selectedDate,
  661. state,
  662. renderComponent,
  663. LOCALSPECIALTYPRODUCTTYPE,
  664. FLIGHTPRODUCTTYPE,
  665. HOTELPRODUCTTYPE,
  666. packageCategories,
  667. labelValuePair,
  668. setActiveCate,
  669. activeIndex,
  670. adultCount,
  671. childCount,
  672. infantCount,
  673. adultUnitPrice,
  674. childUnitPrice,
  675. infantUnitPrice,
  676. generalPrice,
  677. buyCount,
  678. collectConfigAndGoPage,
  679. };
  680. },
  681. };
  682. </script>