Commit fd021984 authored by 刘玉宏's avatar 刘玉宏
parents 4f691bbe 6313c6be
......@@ -6,21 +6,25 @@
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 value = ref('');
const formatValue = ref('');
const params = {
current: 1,
size: 10,
......@@ -34,15 +38,20 @@ 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));
});
};
function handleConfirm4({ value }) {
formatValue.value = new Date(value).toString();
}
</script>
<style lang="scss" scoped>
......
......@@ -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,20 @@ const getPopular = () => {
popularRouterData.value = res.data.records;
});
};
// 智能排序
const sortParams = (sortMode) => {
sortType.value = sortMode;
console.log(sortType.value, 211);
getProd();
};
// 出发日期
const dataParams = (item) => {
console.log(item, 333);
dateType.value = item;
getProd();
};
// 景点
const placeParams = (id) => {
console.log(id, 444);
attractionId.value = id;
console.log(attractionId.value, 211);
getProd();
};
// 查询列表
......@@ -232,14 +239,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