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

乡村旅居筛选

parent ffa6035b
<template> <template>
<view class="sort" :style="{ width: width }"> <view class="sort" :style="{ width: width }">
<view class="date">筛选</view> <view class="date">出发城市</view>
<ul class="ul"> <ul class="ul">
<li <li
v-for="(item, index) in items" v-for="(item, index) in screenList"
:key="index" :key="index"
:class="{ active: selectedItem === index }" :class="{ active: selectedItem === index }"
@tap="selectItem(index)" @tap="selectItem(index, item, 'screen')"
> >
{{ item }} {{ item.tripCity }}
</li>
</ul>
<view class="date">服务承诺</view>
<ul class="ul">
<li
v-for="(item, index) in serveList"
:key="index"
:class="{ active: selectedItem1 === index }"
@tap="selectItem(index, item, 'serve')"
>
{{ item.labelName }}
</li>
</ul>
<view class="date">适用人群</view>
<ul class="ul">
<li
v-for="(item, index) in peopleList"
:key="index"
:class="{ active: selectedItem2 === index }"
@tap="selectItem(index, item, 'people')"
>
{{ item.labelName }}
</li> </li>
</ul> </ul>
</view> </view>
</template> </template>
<script setup> <script setup>
import { defineProps } from 'vue'; import { defineProps, onMounted, ref } from 'vue';
const items = reactive([ import { screeningConditions } from '@/api/assistingAgriculture/village';
'智能排序', const emit = defineEmits(['screenParams']);
'距离优先',
'好评优先',
'销量优先',
'低价优先',
'低价优先',
'距离优先',
'好评优先',
'销量优先',
'低价优先',
'距离优先',
]);
const selectedItem = ref(null); const selectedItem = ref(null);
const selectedItem1 = ref(null);
const selectedItem2 = ref(null);
const screenList = ref([]);
const serveList = ref([]);
const peopleList = ref([]);
const props = defineProps({ const props = defineProps({
width: { width: {
type: String, type: String,
default: '100%', default: '100%',
}, },
}); });
const selectItem = (selectItem) => { onMounted(async () => {
selectedItem.value = selectItem; getScreeningConditions();
});
const selectItem = (index, item, type) => {
if (type === 'screen') {
selectedItem.value = index;
} else if (type === 'serve') {
selectedItem1.value = index;
} else if (type === 'people') {
selectedItem2.value = index;
}
emit('screenParams', item, type);
};
// 查询出发日期
const getScreeningConditions = () => {
screeningConditions().then((res) => {
screenList.value = res.data.startCityList;
serveList.value = res.data.serviceList;
peopleList.value = res.data.forPeopleList;
});
}; };
</script> </script>
...@@ -68,7 +102,6 @@ const selectItem = (selectItem) => { ...@@ -68,7 +102,6 @@ const selectItem = (selectItem) => {
letter-spacing: 0em; letter-spacing: 0em;
font-variation-settings: 'opsz' auto; font-variation-settings: 'opsz' auto;
font-feature-settings: 'kern' on; font-feature-settings: 'kern' on;
color: #fa5151;
margin-left: 44rpx; margin-left: 44rpx;
margin-top: 20rpx; margin-top: 20rpx;
} }
......
...@@ -32,3 +32,11 @@ export function getStartDate(data) { ...@@ -32,3 +32,11 @@ export function getStartDate(data) {
data, data,
}); });
} }
// 查询筛选
export function screeningConditions(data) {
return request({
url: `/sgyrdd/prod/screeningConditions/list`,
method: 'GET',
data,
});
}
...@@ -55,7 +55,12 @@ ...@@ -55,7 +55,12 @@
:scroll-with-animation="true" :scroll-with-animation="true"
@scroll="scroll" @scroll="scroll"
> >
<view class="foodCard" v-for="(item, index) in popularRouterData" :key="index"> <view
class="foodCard"
v-for="(item, index) in popularRouterData"
:key="index"
@tap="toRouteDetails(item)"
>
<!-- <img--> <!-- <img-->
<!-- class="img-icon"--> <!-- class="img-icon"-->
<!-- src="/static/assistingAgriculture/rural/icon.png"--> <!-- src="/static/assistingAgriculture/rural/icon.png"-->
...@@ -120,7 +125,7 @@ ...@@ -120,7 +125,7 @@
class="card-detail" class="card-detail"
v-for="(item, index) in cardList" v-for="(item, index) in cardList"
:key="index" :key="index"
@tap="toRouteDetails" @tap="toRouteDetails(item)"
> >
<img class="card-img" :src="item.img" style="width: 248rpx; height: 240rpx" /> <img class="card-img" :src="item.img" style="width: 248rpx; height: 240rpx" />
<view class="detail-text"> <view class="detail-text">
...@@ -173,7 +178,10 @@ const cardList = ref([]); ...@@ -173,7 +178,10 @@ const cardList = ref([]);
const popularRouterData = ref([]); const popularRouterData = ref([]);
const sortType = ref(null); const sortType = ref(null);
const attractionId = ref(null); const attractionId = ref(null);
const startCity = ref(null);
const dateType = ref(null); const dateType = ref(null);
const serviceCommitment = ref(null);
const labelId = ref(null);
const locationFiltering = (index) => { const locationFiltering = (index) => {
switch (index) { switch (index) {
case 0: case 0:
...@@ -223,7 +231,6 @@ const sortParams = (sortMode) => { ...@@ -223,7 +231,6 @@ const sortParams = (sortMode) => {
}; };
// 出发日期 // 出发日期
const dataParams = (item) => { const dataParams = (item) => {
console.log(item, 333);
dateType.value = item; dateType.value = item;
getProd(); getProd();
}; };
...@@ -232,6 +239,18 @@ const placeParams = (id) => { ...@@ -232,6 +239,18 @@ const placeParams = (id) => {
attractionId.value = id; attractionId.value = id;
getProd(); getProd();
}; };
// 筛选
const screenParams = (item, type) => {
console.log(item, type, 111);
if (type === 'screen') {
startCity.value = item.tripCity;
} else if (type === 'serve') {
serviceCommitment.value = item.labelName;
} else if (type === 'people') {
labelId.value = item.labelName;
}
getProd();
};
// 查询列表 // 查询列表
const getProd = () => { const getProd = () => {
const params = { const params = {
...@@ -240,6 +259,9 @@ const getProd = () => { ...@@ -240,6 +259,9 @@ const getProd = () => {
...(sortType.value !== null && { sortType: sortType.value.sortMode }), ...(sortType.value !== null && { sortType: sortType.value.sortMode }),
...(attractionId.value !== null && { attractionId: attractionId.value.id }), ...(attractionId.value !== null && { attractionId: attractionId.value.id }),
...(dateType.value !== null && { dateType: dateType.value }), ...(dateType.value !== null && { dateType: dateType.value }),
...(startCity.value !== null && { startCity: startCity.value }),
...(serviceCommitment.value !== null && { serviceCommitment: serviceCommitment.value }),
...(labelId.value !== null && { labelId: labelId.value }),
}; };
getProdList(params).then((res) => { getProdList(params).then((res) => {
res.data.records.forEach((item) => { res.data.records.forEach((item) => {
...@@ -248,10 +270,11 @@ const getProd = () => { ...@@ -248,10 +270,11 @@ const getProd = () => {
cardList.value = res.data.records; cardList.value = res.data.records;
}); });
}; };
function toRouteDetails() { function toRouteDetails(item) {
console.log(item, 22222);
// TODO: 跳转到线路详情 // TODO: 跳转到线路详情
xma.navigateTo({ xma.navigateTo({
url: '/pages/assistingAgriculture/RouteDetails/RouteDetails', url: `/pages/assistingAgriculture/RouteDetails/RouteDetails?prodId=${item.prodId}`,
}); });
} }
function toSpecialOfferZoneList() { function toSpecialOfferZoneList() {
......
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