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