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

乡村旅居热门路线接口联调

parent 4d8c1287
...@@ -8,27 +8,17 @@ ...@@ -8,27 +8,17 @@
:class="{ active: selectedItem === index }" :class="{ active: selectedItem === index }"
@tap="selectItem(index)" @tap="selectItem(index)"
> >
{{ item }} {{ item.name }}
</li> </li>
</ul> </ul>
</view> </view>
</template> </template>
<script setup> <script setup>
import { defineProps } from 'vue'; import { defineProps, onMounted } from 'vue';
const items = reactive([ import { getTour } from '@/api/assistingAgriculture/village';
'智能排序', const items = ref([]);
'距离优先', const emit = defineEmits(['sortParams']);
'好评优先',
'销量优先',
'低价优先',
'低价优先',
'距离优先',
'好评优先',
'销量优先',
'低价优先',
'距离优先',
]);
const selectedItem = ref(null); const selectedItem = ref(null);
const props = defineProps({ const props = defineProps({
width: { width: {
...@@ -36,8 +26,18 @@ const props = defineProps({ ...@@ -36,8 +26,18 @@ const props = defineProps({
default: '100%', default: '100%',
}, },
}); });
const selectItem = (selectItem) => { onMounted(async () => {
selectedItem.value = selectItem; getTourList();
});
const selectItem = (index, item) => {
selectedItem.value = index;
emit('sortParams', item);
};
// 查询景点
const getTourList = () => {
getTour().then((res) => {
console.log(res, 111);
});
}; };
</script> </script>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
:class="{ active: selectedItem === index }" :class="{ active: selectedItem === index }"
@tap="selectItem(index)" @tap="selectItem(index)"
> >
{{ item }} {{ item.name }}
</li> </li>
</ul> </ul>
</view> </view>
...@@ -15,7 +15,14 @@ ...@@ -15,7 +15,14 @@
<script setup> <script setup>
import { defineProps } from 'vue'; import { defineProps } from 'vue';
const items = reactive(['智能排序', '距离优先', '好评优先', '销量优先', '低价优先', '低价优先']); const items = ref([
{ name: '距离优先', sortName: 'distance' },
{ name: '好评优先', sortName: 'grade' },
{ name: '销量优先', sortName: 'monthSoldNum' },
{ name: '低价优先', sortName: 'lowPrice' },
{ name: '高价优先', sortName: 'highPrice' },
]);
const emit = defineEmits(['sortParams']);
const selectedItem = ref(null); const selectedItem = ref(null);
const props = defineProps({ const props = defineProps({
width: { width: {
...@@ -23,8 +30,9 @@ const props = defineProps({ ...@@ -23,8 +30,9 @@ const props = defineProps({
default: '100%', default: '100%',
}, },
}); });
const selectItem = (selectItem) => { const selectItem = (index, item) => {
selectedItem.value = selectItem; selectedItem.value = index;
emit('sortParams', item);
}; };
</script> </script>
......
import { request } from '../../utils/request';
// 查询景点
export function getTour(data) {
return request({
url: `/sgyrdd/znprod/tour/list`,
method: 'GET',
data,
});
}
// 查询热门路线
export function getPopularList(data) {
return request({
url: `/sgyrdd/prod/popular`,
method: 'GET',
data,
});
}
// 查询商品列表
export function getProdList(data) {
return request({
url: `/sgyrdd/prod/prodList`,
method: 'GET',
data,
});
}
...@@ -55,17 +55,13 @@ ...@@ -55,17 +55,13 @@
:scroll-with-animation="true" :scroll-with-animation="true"
@scroll="scroll" @scroll="scroll"
> >
<view class="foodCard" v-for="(item, index) in 5" :key="index"> <view class="foodCard" v-for="(item, index) in popularRouterData" :key="index">
<!-- <img--> <!-- <img-->
<!-- class="img-icon"--> <!-- class="img-icon"-->
<!-- src="/static/assistingAgriculture/rural/icon.png"--> <!-- src="/static/assistingAgriculture/rural/icon.png"-->
<!-- style="width: 118rpx; height: 32rpx"--> <!-- style="width: 118rpx; height: 32rpx"-->
<!-- />--> <!-- />-->
<image <image class="test5" :src="item.imgUrl" mode="widthFix" />
class="test5"
src="/static/assistingAgriculture/rural/img4.png"
mode="widthFix"
/>
</view> </view>
</scroll-view> </scroll-view>
<!-- 列表--> <!-- 列表-->
...@@ -162,7 +158,13 @@ import Sort from '../../../components/assistingAgriculture/index/Sort.vue'; ...@@ -162,7 +158,13 @@ import Sort from '../../../components/assistingAgriculture/index/Sort.vue';
import DepartureDate from '../../../components/assistingAgriculture/index/DepartureDate.vue'; import DepartureDate from '../../../components/assistingAgriculture/index/DepartureDate.vue';
import ScenicSpots from '../../../components/assistingAgriculture/index/ScenicSpots.vue'; import ScenicSpots from '../../../components/assistingAgriculture/index/ScenicSpots.vue';
import Screen from '../../../components/assistingAgriculture/index/Screen.vue'; import Screen from '../../../components/assistingAgriculture/index/Screen.vue';
import { getPopularList, getProdList, getTour } from '@/api/assistingAgriculture/village';
import { getPresaleList } from '@/api/assistingAgriculture/building';
import { onMounted } from 'vue';
onMounted(async () => {
getProd();
getPopular();
});
const rotate = ref(false); const rotate = ref(false);
const rotate2 = ref(false); const rotate2 = ref(false);
const rotate3 = ref(false); const rotate3 = ref(false);
...@@ -209,6 +211,7 @@ const cardList = ref([ ...@@ -209,6 +211,7 @@ const cardList = ref([
price: '299.00', price: '299.00',
}, },
]); ]);
const popularRouterData = ref([]);
const locationFiltering = (index) => { const locationFiltering = (index) => {
switch (index) { switch (index) {
case 0: case 0:
...@@ -237,6 +240,21 @@ const locationFiltering = (index) => { ...@@ -237,6 +240,21 @@ const locationFiltering = (index) => {
break; break;
} }
}; };
// 查询热门路线
const getPopular = () => {
getPopularList({ current: 1, size: 10 }).then((res) => {
res.data.records.forEach((item) => {
item.imgUrl = import.meta.env.VITE_APP_IMG_URL + item.pic;
});
popularRouterData.value = res.data.records;
});
};
// 查询商品列表
const getProd = () => {
getProdList({ current: 1, size: 10 }).then((res) => {
console.log(res, 222);
});
};
function toRouteDetails() { function toRouteDetails() {
// TODO: 跳转到线路详情 // TODO: 跳转到线路详情
xma.navigateTo({ xma.navigateTo({
......
...@@ -148,7 +148,6 @@ const params = { ...@@ -148,7 +148,6 @@ const params = {
const tabsList = ref([]); const tabsList = ref([]);
onMounted(async () => { onMounted(async () => {
getPresale(); getPresale();
// getPresaleProd();
presaleSortList(); presaleSortList();
}); });
// 预售板块轮播图 // 预售板块轮播图
......
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