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.

carouselSection.vue 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <section id="intro">
  3. <div class="container">
  4. <div class="row">
  5. <div align="left" class="col-sm-12 col-md-8">
  6. <div class="intro-content box" style="margin-top:-5px">
  7. <h2>Find your Timeshare</h2>
  8. <p>
  9. Please specify one or more details to view the available weeks and then select the
  10. weeks that interest you on the resort page.
  11. </p>
  12. <div class="row">
  13. <div class="form-group col-md-6">
  14. <div class="input-group">
  15. <label v-if="!searchParams.region" class="uniSelectLabel" for="region">REGION</label>
  16. <select
  17. class="form-control uniSelect"
  18. name="region"
  19. id="region"
  20. v-model="searchParams.region"
  21. @change="regionChange"
  22. >
  23. <option v-for="(region, r) in regions" :key="r">{{ region.regionName }}</option>
  24. </select>
  25. </div>
  26. <br />
  27. <label>DATE FROM</label>
  28. <input
  29. type="date"
  30. name="arrival-to"
  31. class="form-control my-1 uniSelect"
  32. id="arrival-to"
  33. placeholder="Date From"
  34. v-model="filter.date"
  35. />
  36. </div>
  37. <div class="form-group col-md-6">
  38. <div class="input-group">
  39. <label
  40. v-if="!searchParams.resort"
  41. class="uniSelectLabel"
  42. for="weekInfoResortSelect"
  43. >RESORT</label>
  44. <select
  45. id="weekInfoResortSelect"
  46. class="form-control uniSelect"
  47. v-model="searchParams.resort"
  48. >
  49. <option
  50. v-for="(resort, r) in filteredResort"
  51. :key="r"
  52. :value="resort"
  53. @change="resortChange"
  54. >
  55. {{
  56. resort.resortName
  57. }}
  58. </option>
  59. </select>
  60. </div>
  61. <br />
  62. <label>DATE TO</label>
  63. <input
  64. type="date"
  65. name="arrival-to"
  66. class="form-control my-1 uniSelect"
  67. id="arrival-to"
  68. placeholder="Date To"
  69. v-model="filter.ddate"
  70. />
  71. </div>
  72. </div>
  73. <button class="btn-solid-blue" @click="Search()">
  74. <i class="fa fa-search"></i> SEARCH
  75. </button>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <carousel
  81. :nav="false"
  82. :dots="false"
  83. :items="1"
  84. :autoplay="true"
  85. :loop="true"
  86. id="intro-carousel"
  87. style="margin-top:-50px"
  88. :responsive="{ 0: { items: 1, nav: false }, 600: { items: 1, nav: false } }"
  89. >
  90. <img class="item" src="/img/intro-carousel/timeshare-1.jpg" style="object-fit: cover" alt />
  91. <img class="item" src="/img/intro-carousel/timeshare-2.jpg" style="object-fit: cover" alt />
  92. <img class="item" src="/img/intro-carousel/timeshare-3.jpg" style="object-fit: cover" alt />
  93. <img class="item" src="/img/intro-carousel/timeshare-4.jpg" style="object-fit: cover" alt />
  94. <img class="item" src="/img/intro-carousel/timeshare-5.jpg" style="object-fit: cover" alt />
  95. <img class="item" src="/img/intro-carousel/timeshare-6.jpg" style="object-fit: cover" alt />
  96. </carousel>
  97. <div id="intro-carousel" class="owl-carousel"></div>
  98. </section>
  99. </template>
  100. <script>
  101. /* eslint-disable */
  102. import carousel from "vue-owl-carousel";
  103. import { mapState, mapActions, mapGetters } from "vuex";
  104. export default {
  105. components: {
  106. carousel,
  107. },
  108. data() {
  109. return {
  110. regionObj: {},
  111. resortObj: {},
  112. region: "",
  113. resort: "",
  114. priceMin: undefined,
  115. priceMax: undefined,
  116. };
  117. },
  118. methods: {
  119. ...mapActions("timeshare", ["initTimeshare", "onResortChange", "saveWeek"]),
  120. regionChange(item) {
  121. let reg = this.regions.find((r) => r.regionName === item.target.value);
  122. this.regionObj = reg;
  123. },
  124. resortChange(item) {
  125. let res = this.resorts.find((r) => r.resortName === item.target.value);
  126. this.resortObj = res;
  127. },
  128. Search() {
  129. if (this.searchParams.price) {
  130. this.filter.minPrice = this.searchParams.price;
  131. }
  132. if (this.searchParams.week) {
  133. this.filter.keyword = this.week;
  134. }
  135. if (!this.searchParams.resort) {
  136. this.searchParams.regionObj = this.regionObj;
  137. this.$router.push("/timeshareToByResults");
  138. }
  139. this.$router.push(`/resort/${this.searchParams.resort.resortCode}`);
  140. },
  141. },
  142. computed: {
  143. ...mapState("timeshare", ["resorts", "regions", "detailedRegion"]),
  144. ...mapState("weekList", ["searchParams", "filter"]),
  145. filteredResort() {
  146. let list = [];
  147. if (this.searchParams.region && this.searchParams.region !== "") {
  148. const item = this.detailedRegion.find(
  149. (region) => region.region.regionCode === this.regionObj.regionCode
  150. );
  151. if (item) {
  152. list = item.children;
  153. }
  154. } else {
  155. list = this.resorts;
  156. }
  157. return _.sortBy(list, (x) => x.resortName);
  158. },
  159. },
  160. created() {
  161. this.initTimeshare(this.weekId);
  162. },
  163. mounted() {
  164. this.searchParams.region = null;
  165. this.searchParams.resort = null;
  166. this.filter.date = null;
  167. this.filter.ddate = null;
  168. },
  169. };
  170. </script>
  171. <style lang="scss" scoped></style>