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

乡村旅居筛选传参

parent bf88562b
<template>
<view class="sort" :style="{ width: width }">
<view class="date">景点</view>
<ul class="ul">
<li
v-for="(item, index) in placeList"
:key="index"
:class="{ active: selectedItem === index }"
@tap="selectItem(index)"
@tap="selectItem(index, item)"
>
{{ item.attractionName }}
</li>
......@@ -18,7 +17,7 @@
import { defineProps, onMounted } from 'vue';
import { getTour } from '@/api/assistingAgriculture/village';
const placeList = ref([]);
const emit = defineEmits(['sortParams']);
const emit = defineEmits(['placeParams']);
const selectedItem = ref(null);
const props = defineProps({
width: {
......@@ -31,7 +30,7 @@ onMounted(async () => {
});
const selectItem = (index, item) => {
selectedItem.value = index;
emit('sortParams', item);
emit('placeParams', item);
};
// 查询景点
const getTourList = () => {
......
......@@ -112,7 +112,7 @@
</view>
<Sort v-show="rotate" @sortParams="sortParams" />
<DepartureDate v-show="rotate2" />
<ScenicSpots v-show="rotate3" />
<ScenicSpots v-show="rotate3" @placeParams="placeParams" />
<Screen v-show="rotate4" />
</view>
<view class="list-card">
......@@ -172,6 +172,7 @@ const rotate4 = ref(false);
const cardList = ref([]);
const popularRouterData = ref([]);
const sortType = ref(null);
const attractionId = ref(null);
const locationFiltering = (index) => {
switch (index) {
case 0:
......@@ -201,6 +202,7 @@ const locationFiltering = (index) => {
}
if (index === 0) {
sortType.value = null;
attractionId.value = null;
}
};
// 查询热门路线
......@@ -217,12 +219,19 @@ const sortParams = (sortMode) => {
console.log(sortType.value, 211);
getProd();
};
const placeParams = (id) => {
console.log(id, 444);
attractionId.value = id;
console.log(attractionId.value, 211);
getProd();
};
// 查询列表
const getProd = () => {
const params = {
current: 1,
size: 10,
...(sortType.value !== null && { sortType: sortType.value.sortMode }),
...(attractionId.value !== null && { attractionId: attractionId.value.id }),
};
console.log(params, 222);
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