Commit 6176d44f authored by 张娇(东信)'s avatar 张娇(东信)

乡村旅居筛选传参

parent bf88562b
<template> <template>
<view class="sort" :style="{ width: width }"> <view class="sort" :style="{ width: width }">
<view class="date">景点</view>
<ul class="ul"> <ul class="ul">
<li <li
v-for="(item, index) in placeList" v-for="(item, index) in placeList"
:key="index" :key="index"
:class="{ active: selectedItem === index }" :class="{ active: selectedItem === index }"
@tap="selectItem(index)" @tap="selectItem(index, item)"
> >
{{ item.attractionName }} {{ item.attractionName }}
</li> </li>
...@@ -18,7 +17,7 @@ ...@@ -18,7 +17,7 @@
import { defineProps, onMounted } from 'vue'; import { defineProps, onMounted } from 'vue';
import { getTour } from '@/api/assistingAgriculture/village'; import { getTour } from '@/api/assistingAgriculture/village';
const placeList = ref([]); const placeList = ref([]);
const emit = defineEmits(['sortParams']); const emit = defineEmits(['placeParams']);
const selectedItem = ref(null); const selectedItem = ref(null);
const props = defineProps({ const props = defineProps({
width: { width: {
...@@ -31,7 +30,7 @@ onMounted(async () => { ...@@ -31,7 +30,7 @@ onMounted(async () => {
}); });
const selectItem = (index, item) => { const selectItem = (index, item) => {
selectedItem.value = index; selectedItem.value = index;
emit('sortParams', item); emit('placeParams', item);
}; };
// 查询景点 // 查询景点
const getTourList = () => { const getTourList = () => {
......
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
</view> </view>
<Sort v-show="rotate" @sortParams="sortParams" /> <Sort v-show="rotate" @sortParams="sortParams" />
<DepartureDate v-show="rotate2" /> <DepartureDate v-show="rotate2" />
<ScenicSpots v-show="rotate3" /> <ScenicSpots v-show="rotate3" @placeParams="placeParams" />
<Screen v-show="rotate4" /> <Screen v-show="rotate4" />
</view> </view>
<view class="list-card"> <view class="list-card">
...@@ -172,6 +172,7 @@ const rotate4 = ref(false); ...@@ -172,6 +172,7 @@ const rotate4 = ref(false);
const cardList = ref([]); const cardList = ref([]);
const popularRouterData = ref([]); const popularRouterData = ref([]);
const sortType = ref(null); const sortType = ref(null);
const attractionId = ref(null);
const locationFiltering = (index) => { const locationFiltering = (index) => {
switch (index) { switch (index) {
case 0: case 0:
...@@ -201,6 +202,7 @@ const locationFiltering = (index) => { ...@@ -201,6 +202,7 @@ const locationFiltering = (index) => {
} }
if (index === 0) { if (index === 0) {
sortType.value = null; sortType.value = null;
attractionId.value = null;
} }
}; };
// 查询热门路线 // 查询热门路线
...@@ -217,12 +219,19 @@ const sortParams = (sortMode) => { ...@@ -217,12 +219,19 @@ const sortParams = (sortMode) => {
console.log(sortType.value, 211); console.log(sortType.value, 211);
getProd(); getProd();
}; };
const placeParams = (id) => {
console.log(id, 444);
attractionId.value = id;
console.log(attractionId.value, 211);
getProd();
};
// 查询列表 // 查询列表
const getProd = () => { const getProd = () => {
const params = { const params = {
current: 1, current: 1,
size: 10, size: 10,
...(sortType.value !== null && { sortType: sortType.value.sortMode }), ...(sortType.value !== null && { sortType: sortType.value.sortMode }),
...(attractionId.value !== null && { attractionId: attractionId.value.id }),
}; };
console.log(params, 222); console.log(params, 222);
getProdList(params).then((res) => { getProdList(params).then((res) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment