Commit 9fc608eb authored by 陈宗胤(贵阳日报)'s avatar 陈宗胤(贵阳日报)
parents 2b11bf80 bf88562b
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<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 dataList"
:key="index" :key="index"
:class="{ active: selectedItem === index }" :class="{ active: selectedItem === index }"
@tap="selectItem(index)" @tap="selectItem(index)"
...@@ -16,18 +16,33 @@ ...@@ -16,18 +16,33 @@
</template> </template>
<script setup> <script setup>
import { defineProps } from 'vue'; import { defineProps, onMounted } from 'vue';
import { getStartDate, getTour } from '@/api/assistingAgriculture/village';
const items = reactive(['日期不限', '今天', '明天', '一周内', '一月内', '本周末', '七夕节']); const items = reactive(['日期不限', '今天', '明天', '一周内', '一月内', '本周末', '七夕节']);
const selectedItem = ref(null); const selectedItem = ref(null);
const dataList = ref([]);
const params = {
current: 1,
size: 10,
};
const props = defineProps({ const props = defineProps({
width: { width: {
type: String, type: String,
default: '100%', default: '100%',
}, },
}); });
onMounted(async () => {
getStartDateList();
});
const selectItem = (selectItem) => { const selectItem = (selectItem) => {
selectedItem.value = selectItem; selectedItem.value = selectItem;
}; };
// 查询景点
const getStartDateList = () => {
getStartDate(params).then((res) => {
dataList.value = res.data;
});
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
:class="{ active: selectedItem === index }" :class="{ active: selectedItem === index }"
@tap="selectItem(index)" @tap="selectItem(index)"
> >
{{ item.brief }} {{ item.attractionName }}
</li> </li>
</ul> </ul>
</view> </view>
...@@ -35,7 +35,7 @@ const selectItem = (index, item) => { ...@@ -35,7 +35,7 @@ const selectItem = (index, item) => {
}; };
// 查询景点 // 查询景点
const getTourList = () => { const getTourList = () => {
getTour({ prodId: 0 }).then((res) => { getTour().then((res) => {
placeList.value = res.data; placeList.value = res.data;
}); });
}; };
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
v-for="(item, index) in items" v-for="(item, index) in items"
:key="index" :key="index"
:class="{ active: selectedItem === index }" :class="{ active: selectedItem === index }"
@tap="selectItem(index)" @tap="selectItem(index, item)"
> >
{{ item.name }} {{ item.name }}
</li> </li>
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
<script setup> <script setup>
import { defineProps } from 'vue'; import { defineProps } from 'vue';
const items = ref([ const items = ref([
{ name: '距离优先', sortModel: 1 }, { name: '距离优先', sortMode: 1 },
{ name: '好评优先', sortModel: 2 }, { name: '好评优先', sortMode: 2 },
{ name: '销量优先', sortModel: 3 }, { name: '销量优先', sortMode: 3 },
{ name: '低价优先', sortModel: 4 }, { name: '低价优先', sortMode: 4 },
{ name: '高价优先', sortModel: 5 }, { name: '高价优先', sortMode: 5 },
]); ]);
const emit = defineEmits(['sortParams']); const emit = defineEmits(['sortParams']);
const selectedItem = ref(null); const selectedItem = ref(null);
......
...@@ -3,7 +3,7 @@ import { request } from '../../utils/request'; ...@@ -3,7 +3,7 @@ import { request } from '../../utils/request';
// 查询景点 // 查询景点
export function getTour(data) { export function getTour(data) {
return request({ return request({
url: `/sgyrdd/znprod/tour/list`, url: `/sgyrdd/znprod/attraction/list`,
method: 'GET', method: 'GET',
data, data,
}); });
...@@ -24,3 +24,11 @@ export function getProdList(data) { ...@@ -24,3 +24,11 @@ export function getProdList(data) {
data, data,
}); });
} }
// 查询出发日期
export function getStartDate(data) {
return request({
url: `/sgyrdd/prod/startDate/page`,
method: 'GET',
data,
});
}
...@@ -171,10 +171,6 @@ const rotate3 = ref(false); ...@@ -171,10 +171,6 @@ const rotate3 = ref(false);
const rotate4 = ref(false); const rotate4 = ref(false);
const cardList = ref([]); const cardList = ref([]);
const popularRouterData = ref([]); const popularRouterData = ref([]);
const params = ref({
current: 1,
size: 10,
});
const sortType = ref(null); const sortType = ref(null);
const locationFiltering = (index) => { const locationFiltering = (index) => {
switch (index) { switch (index) {
...@@ -203,6 +199,9 @@ const locationFiltering = (index) => { ...@@ -203,6 +199,9 @@ const locationFiltering = (index) => {
rotate3.value = false; rotate3.value = false;
break; break;
} }
if (index === 0) {
sortType.value = null;
}
}; };
// 查询热门路线 // 查询热门路线
const getPopular = () => { const getPopular = () => {
...@@ -213,9 +212,20 @@ const getPopular = () => { ...@@ -213,9 +212,20 @@ const getPopular = () => {
popularRouterData.value = res.data.records; popularRouterData.value = res.data.records;
}); });
}; };
const sortParams = (sortMode) => {
sortType.value = sortMode;
console.log(sortType.value, 211);
getProd();
};
// 查询列表 // 查询列表
const getProd = () => { const getProd = () => {
getProdList({ current: 1, size: 10 }).then((res) => { const params = {
current: 1,
size: 10,
...(sortType.value !== null && { sortType: sortType.value.sortMode }),
};
console.log(params, 222);
getProdList(params).then((res) => {
res.data.records.forEach((item) => { res.data.records.forEach((item) => {
item.img = import.meta.env.VITE_APP_IMG_URL + item.pic; item.img = import.meta.env.VITE_APP_IMG_URL + item.pic;
}); });
......
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