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

搜索跳转

parent ecfa5dfb
...@@ -302,7 +302,7 @@ const screenParams = (selectedItems, type) => { ...@@ -302,7 +302,7 @@ const screenParams = (selectedItems, type) => {
// 搜索 // 搜索
// 搜索 // 搜索
const toSearch = () => { const toSearch = () => {
xma.navigateTo({ url: '/pages/assistingAgriculture/searchPage/searchPage?prodType=10' }); xma.navigateTo({ url: '/pages/assistingAgriculture/searchPage/searchPage?prodTypes=10' });
}; };
// 查询列表 // 查询列表
......
...@@ -176,7 +176,7 @@ onMounted(async () => { ...@@ -176,7 +176,7 @@ onMounted(async () => {
// 搜索 // 搜索
const toSearch = () => { const toSearch = () => {
xma.navigateTo({ url: '/pages/assistingAgriculture/searchPage/searchPage?prodType=7' }); xma.navigateTo({ url: '/pages/assistingAgriculture/searchPage/searchPage?prodTypes=7' });
}; };
// 获取购物车列表 // 获取购物车列表
const getshoppingCartListFn = () => { const getshoppingCartListFn = () => {
......
...@@ -120,7 +120,7 @@ const getPresale = () => { ...@@ -120,7 +120,7 @@ const getPresale = () => {
}; };
// 搜索 // 搜索
const toSearch = () => { const toSearch = () => {
xma.navigateTo({ url: '/pages/assistingAgriculture/searchPage/searchPage?prodType=[7,10]' }); xma.navigateTo({ url: '/pages/assistingAgriculture/searchPage/searchPage?prodTypes=7,10' });
}; };
const onChange = (e) => { const onChange = (e) => {
// console.log(e); // console.log(e);
......
...@@ -161,7 +161,7 @@ onMounted(async () => { ...@@ -161,7 +161,7 @@ onMounted(async () => {
}); });
// 搜索 // 搜索
const toSearch = () => { const toSearch = () => {
xma.navigateTo({ url: '/pages/assistingAgriculture/searchPage/searchPage?prodType=7' }); xma.navigateTo({ url: '/pages/assistingAgriculture/searchPage/searchPage?prodTypes=7' });
}; };
// 获取购物车列表 // 获取购物车列表
const getshoppingCartListFn = () => { const getshoppingCartListFn = () => {
......
...@@ -28,7 +28,12 @@ ...@@ -28,7 +28,12 @@
<block v-for="(item, index) in tabs" :key="index"> <block v-for="(item, index) in tabs" :key="index">
<wd-tab :title="item"> <wd-tab :title="item">
<view class="content1" v-show="tab === 0"> <view class="content1" v-show="tab === 0">
<view class="shopitem" v-for="(item, index) in commoditys" :key="index"> <view
class="shopitem"
v-for="(item, index) in commoditys"
:key="index"
@tap="toDetail(item)"
>
<image class="img" :src="item.imgUrl" mode="aspectFill" /> <image class="img" :src="item.imgUrl" mode="aspectFill" />
<view class="middle"> <view class="middle">
<text class="text">{{ item.prodName }}</text> <text class="text">{{ item.prodName }}</text>
...@@ -61,9 +66,10 @@ ...@@ -61,9 +66,10 @@
</template> </template>
<script setup> <script setup>
import { useRoute } from 'vue-router';
import { searchCommodity, searchBusiness } from '@/api/assistingAgriculture/search'; import { searchCommodity, searchBusiness } from '@/api/assistingAgriculture/search';
const tab = ref(0); const tab = ref(0);
const tabs = ref(['商品', '店铺']); const tabs = ref(['商品']);
const value = ref(5); const value = ref(5);
const commoditys = ref([]); const commoditys = ref([]);
const shops = ref([]); const shops = ref([]);
...@@ -76,12 +82,15 @@ const back = () => { ...@@ -76,12 +82,15 @@ const back = () => {
delta: 1, delta: 1,
}); });
}; };
const router = useRoute();
// 搜索 // 搜索
const toSearch = (data) => { const toSearch = (data) => {
const keyword = data.detail.value; const keyword = data.detail.value;
const params = { const params = {
current: 1, current: 1,
size: 100, size: 100,
prodTypes: router.query.prodTypes.split(','),
}; };
const params2 = { const params2 = {
current: 1, current: 1,
...@@ -96,15 +105,29 @@ const toSearch = (data) => { ...@@ -96,15 +105,29 @@ const toSearch = (data) => {
}); });
commoditys.value = res.data.data; commoditys.value = res.data.data;
}); });
// 店铺搜索 // // 店铺搜索
params2.keyword = keyword; // params2.keyword = keyword;
searchBusiness(params2).then((res) => { // searchBusiness(params2).then((res) => {
res.data.content.forEach((item) => { // res.data.content.forEach((item) => {
item.shopLogo = baseImgurl + item.shopLogo; // item.shopLogo = baseImgurl + item.shopLogo;
}); // });
shops.value = res.data.content; // shops.value = res.data.content;
}); // });
}; };
// 跳转详情
function toDetail(item) {
if (item.prodType === '7') {
// TODO: 跳转到筑农详情页
xma.navigateTo({
url: `/pages/assistingAgriculture/detail/detail?prodId=${item.prodId}`,
});
} else if (item.prodType === '10') {
// TODO: 跳转到旅居详情页
xma.navigateTo({
url: `/pages/assistingAgriculture/RouteDetails/RouteDetails?shopId=${item.shopId}&prodId=${item.prodId}`,
});
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
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