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

乡村旅居出发日期筛选传参

parent 8aa495e2
......@@ -6,20 +6,22 @@
v-for="(item, index) in dataList"
:key="index"
:class="{ active: selectedItem === index }"
@tap="selectItem(index)"
@tap="selectItem(index, item)"
>
{{ item }}
</li>
<li>选择日期</li>
<wd-calendar use-default-slot v-model="value" @confirm="handleConfirm4">
<li>选择日期</li>
</wd-calendar>
</ul>
</view>
</template>
<script setup>
import { defineProps, onMounted } from 'vue';
import { getStartDate, getTour } from '@/api/assistingAgriculture/village';
const items = reactive(['日期不限', '今天', '明天', '一周内', '一月内', '本周末', '七夕节']);
import { getStartDate } from '@/api/assistingAgriculture/village';
const selectedItem = ref(null);
const emit = defineEmits(['dataParams']);
const dataList = ref([]);
const params = {
current: 1,
......@@ -34,13 +36,15 @@ const props = defineProps({
onMounted(async () => {
getStartDateList();
});
const selectItem = (selectItem) => {
selectedItem.value = selectItem;
const selectItem = (index, item) => {
selectedItem.value = index;
emit('dataParams', item);
};
// 查询景点
// 查询出发日期
const getStartDateList = () => {
getStartDate(params).then((res) => {
dataList.value = res.data;
console.log(Object.keys(dataList.value, 232));
});
};
</script>
......
......@@ -111,9 +111,9 @@
</view>
</view>
<Sort v-show="rotate" @sortParams="sortParams" />
<DepartureDate v-show="rotate2" />
<DepartureDate v-show="rotate2" @dataParams="dataParams" />
<ScenicSpots v-show="rotate3" @placeParams="placeParams" />
<Screen v-show="rotate4" />
<Screen v-show="rotate4" @screenParams="screenParams" />
</view>
<view class="list-card">
<view
......@@ -173,6 +173,7 @@ const cardList = ref([]);
const popularRouterData = ref([]);
const sortType = ref(null);
const attractionId = ref(null);
const dateType = ref(null);
const locationFiltering = (index) => {
switch (index) {
case 0:
......@@ -203,6 +204,7 @@ const locationFiltering = (index) => {
if (index === 0) {
sortType.value = null;
attractionId.value = null;
dateType.value = null;
}
};
// 查询热门路线
......@@ -214,15 +216,21 @@ const getPopular = () => {
popularRouterData.value = res.data.records;
});
};
// 智能排序
const sortParams = (sortMode) => {
sortType.value = sortMode;
console.log(sortType.value, 211);
getProd();
};
// 出发日期
const dataParams = (data) => {
const { item, a } = data;
console.log(data, 444);
dateType.value = a;
getProd();
};
// 景点
const placeParams = (id) => {
console.log(id, 444);
attractionId.value = id;
console.log(attractionId.value, 211);
getProd();
};
// 查询列表
......@@ -232,14 +240,13 @@ const getProd = () => {
size: 10,
...(sortType.value !== null && { sortType: sortType.value.sortMode }),
...(attractionId.value !== null && { attractionId: attractionId.value.id }),
...(dateType.value !== null && { dateType: dateType.value }),
};
console.log(params, 222);
getProdList(params).then((res) => {
res.data.records.forEach((item) => {
item.img = import.meta.env.VITE_APP_IMG_URL + item.pic;
});
cardList.value = res.data.records;
console.log(res, 222);
});
};
function toRouteDetails() {
......
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