您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

carouselSection.vue 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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"
  16. >REGION</label
  17. >
  18. <select
  19. class="form-control uniSelect"
  20. name="region"
  21. id="region"
  22. v-model="searchParams.region"
  23. @change="regionChange"
  24. >
  25. <option v-for="(region, r) in regions" :key="r">{{ region.regionName }}</option>
  26. </select>
  27. </div>
  28. <br />
  29. <label>DATE FROM</label>
  30. <input
  31. type="date"
  32. name="arrival-to"
  33. class="form-control my-1 uniSelect"
  34. id="arrival-to"
  35. placeholder="Date From"
  36. v-model="filter.date"
  37. />
  38. </div>
  39. <div class="form-group col-md-6">
  40. <div class="input-group">
  41. <label
  42. v-if="!searchParams.resort"
  43. class="uniSelectLabel"
  44. for="weekInfoResortSelect"
  45. >RESORT</label
  46. >
  47. <select
  48. id="weekInfoResortSelect"
  49. class="form-control uniSelect"
  50. v-model="searchParams.resort"
  51. >
  52. <option
  53. v-for="(resort, r) in filteredResort"
  54. :key="r"
  55. :value="resort"
  56. @change="resortChange"
  57. >
  58. {{ resort.resortName }}
  59. </option>
  60. </select>
  61. </div>
  62. <br />
  63. <label>DATE TO</label>
  64. <input
  65. type="date"
  66. name="arrival-to"
  67. class="form-control my-1 uniSelect"
  68. id="arrival-to"
  69. placeholder="Date To"
  70. v-model="filter.ddate"
  71. />
  72. </div>
  73. </div>
  74. <button class="btn-solid-blue" @click="Search()">
  75. <i class="fa fa-search"></i> SEARCH
  76. </button>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. <carousel
  82. :nav="false"
  83. :dots="false"
  84. :items="1"
  85. :autoplay="true"
  86. :loop="true"
  87. id="intro-carousel"
  88. style="margin-top:-50px"
  89. :responsive="{ 0: { items: 1, nav: false }, 600: { items: 1, nav: false } }"
  90. >
  91. <img class="item" src="/img/intro-carousel/timeshare-1.jpg" style="object-fit: cover" alt />
  92. <img class="item" src="/img/intro-carousel/timeshare-2.jpg" style="object-fit: cover" alt />
  93. <img class="item" src="/img/intro-carousel/timeshare-3.jpg" style="object-fit: cover" alt />
  94. <img class="item" src="/img/intro-carousel/timeshare-4.jpg" style="object-fit: cover" alt />
  95. <img class="item" src="/img/intro-carousel/timeshare-5.jpg" style="object-fit: cover" alt />
  96. <img class="item" src="/img/intro-carousel/timeshare-6.jpg" style="object-fit: cover" alt />
  97. </carousel>
  98. <div id="intro-carousel" class="owl-carousel"></div>
  99. </section>
  100. </template>
  101. <script>
  102. /* eslint-disable */
  103. import carousel from "vue-owl-carousel";
  104. import { mapState, mapActions, mapGetters } from "vuex";
  105. export default {
  106. components: {
  107. carousel
  108. },
  109. data() {
  110. return {
  111. regionObj: {},
  112. resortObj: {},
  113. region: "",
  114. resort: "",
  115. priceMin: undefined,
  116. priceMax: undefined
  117. };
  118. },
  119. methods: {
  120. ...mapActions("timeshare", ["initTimeshare", "onResortChange", "saveWeek"]),
  121. ...mapActions("resort", ["getResortWithListings"]),
  122. regionChange(item) {
  123. let reg = this.regions.find(r => r.regionName === item.target.value);
  124. this.regionObj = reg;
  125. },
  126. resortChange(item) {
  127. let res = this.resorts.find(r => r.resortName === item.target.value);
  128. this.resortObj = res;
  129. },
  130. Search() {
  131. if (this.searchParams.price) {
  132. this.filter.minPrice = this.searchParams.price;
  133. }
  134. if (this.searchParams.week) {
  135. this.filter.keyword = this.week;
  136. }
  137. if (!this.searchParams.resort) {
  138. this.searchParams.regionObj = this.regionObj;
  139. this.$router.push("/timeshareToByResults");
  140. } else {
  141. this.$router.push(`/resort/${this.searchParams.resort.resortId}`);
  142. }
  143. }
  144. },
  145. computed: {
  146. ...mapState("timeshare", ["resorts", "regions", "detailedRegion"]),
  147. ...mapState("weekList", ["searchParams", "filter"]),
  148. ...mapState("resort", ["resortsWithListings"]),
  149. filteredResort() {
  150. let list = [];
  151. var itemList = [];
  152. if (this.searchParams.region && this.searchParams.region !== "") {
  153. this.resortsWithListings.forEach(resortListing => {
  154. if (
  155. resortListing.resortRegion[0].code.toUpperCase() ===
  156. this.regionObj.regionCode.toUpperCase()
  157. ) {
  158. itemList.push(resortListing);
  159. }
  160. });
  161. if (itemList.length > 0) {
  162. list = itemList;
  163. } else {
  164. list[0] = {
  165. resortName: " - No Listings - "
  166. };
  167. }
  168. } else {
  169. list = this.resortsWithListings;
  170. }
  171. return _.sortBy(list, x => x.resortName);
  172. }
  173. // filteredResort() {
  174. // let list = [];
  175. // if (this.searchParams.region && this.searchParams.region !== "") {
  176. // const item = this.detailedRegion.find(
  177. // region => region.region.regionCode === this.regionObj.regionCode
  178. // );
  179. // if (item) {
  180. // list = item.children;
  181. // }
  182. // } else {
  183. // list = this.resorts;
  184. // }
  185. // return _.sortBy(list, x => x.resortName);
  186. // }
  187. },
  188. created() {
  189. this.initTimeshare(this.weekId);
  190. this.getResortWithListings();
  191. },
  192. mounted() {
  193. this.searchParams.region = null;
  194. this.searchParams.resort = null;
  195. this.filter.date = null;
  196. this.filter.ddate = null;
  197. }
  198. };
  199. </script>
  200. <style lang="scss" scoped></style>