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

Merge remote-tracking branch 'origin/master'

parents fe727bf0 61a12582
import { request } from '../../utils/request';
// 店铺分类商品列表/商品搜索
export function searchCommodity(data) {
return request({
url: `/sgyrdd/search/prod/page`,
method: 'POST',
data,
});
}
// 商家列表分页-搜索列表
export function searchBusiness(data) {
return request({
url: `/sgyrdd/shop/page`,
method: 'POST',
data,
});
}
<template> <template>
<view class="search-page"> <view class="search-page">
<view class="search" :style="{ background: '#FF0101' }"> <view
class="search"
style="background: linear-gradient(180deg, #71c456 0%, rgba(243, 243, 243, 0) 100%)"
>
<wd-icon <wd-icon
name="thin-arrow-left" name="thin-arrow-left"
class="icon" class="icon"
...@@ -21,20 +24,82 @@ ...@@ -21,20 +24,82 @@
</view> </view>
</view> </view>
</view> </view>
<wd-tabs v-model="tab"> <wd-tabs custom-class="tabss" v-model="tab">
<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="content" v-show="tab === 0">内容1</view> <view class="content1" v-show="tab === 0">
<view class="content" v-show="tab === 1">内容2</view> <view class="shopitem" v-for="(item, index) in commoditys" :key="index">
<image class="img" :src="item.imgUrl" mode="aspectFill" />
<view class="middle">
<text class="text">{{ item.prodName }}</text>
<text class="text2">{{ item.price }}</text>
<text class="collection">月销量{{ item.soldNum }}</text>
</view>
</view>
</view>
<view class="content2" v-show="tab === 1">
<view class="shopitem" v-for="(item, index) in shops" :key="index">
<view class="left">
<image class="img" :src="item.shopLogo" mode="aspectFill" />
<view class="middle">
<text class="text">{{ item.shopName }}</text>
<wd-rate
custom-class="icon-statr"
active-color="linear-gradient(180deg, rgba(255,238,0,1) 0%,rgba(250,176,21,1) 100%)"
size="24rpx"
v-model="item.grade"
/>
<text class="collection">{{ item.privateIntFcount }}人收藏</text>
</view>
</view>
<view class="btn">进店看看</view>
</view>
</view>
</wd-tab> </wd-tab>
</block> </block>
</wd-tabs> </wd-tabs>
</template> </template>
<script setup> <script setup>
function toSearch(keyword) {} 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 commoditys = ref([]);
const shops = ref([]);
const baseImgurl = import.meta.env.VITE_APP_IMG_URL;
function changeValue({ value }) {
console.log(value);
}
// 搜索
const toSearch = (data) => {
const keyword = data.detail.value;
const params = {
current: 1,
size: 100,
};
const params2 = {
current: 1,
size: 100,
};
// 商品搜索
params.prodName = keyword;
searchCommodity(params).then((res) => {
res.data.data.forEach((item) => {
const imgs = item.imgs.split(',');
item.imgUrl = baseImgurl + imgs[0];
});
commoditys.value = res.data.data;
});
// 店铺搜索
params2.keyword = keyword;
searchBusiness(params2).then((res) => {
res.data.content.forEach((item) => {
item.shopLogo = baseImgurl + item.shopLogo;
});
shops.value = res.data.content;
});
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -78,20 +143,113 @@ page { ...@@ -78,20 +143,113 @@ page {
} }
} }
} }
.content {
display: flex;
flex-direction: column;
align-content: center;
gap: 20rpx;
}
} }
:deep(.wd-tabs__line) { :deep(.wd-tabs__line) {
background-color: #e9231b; background-color: #2fb641;
bottom: 2px; bottom: 2px;
} }
.content { .content1 {
line-height: 120px;
text-align: center;
background: #f6f6f6; background: #f6f6f6;
box-sizing: border-box;
.shopitem {
padding: 0 20rpx;
display: flex;
height: 200rpx;
background-color: white;
align-items: center;
border-bottom: 1rpx solid rgb(225, 223, 223);
.img {
width: 200rpx;
height: 150rpx;
border-radius: 16rpx;
flex-shrink: 0;
}
.middle {
height: 150rpx;
margin-left: 20rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
.text {
font-weight: bold;
font-size: 26rpx;
}
.text2 {
font-weight: bold;
font-size: 22rpx;
color: red;
}
.collection {
font-size: 22rpx;
color: rgb(147, 145, 145);
}
}
.btn {
text-align: center;
border-radius: 50rpx;
background: #2fb641;
font-size: 22rpx;
padding: 8rpx 15rpx;
color: white;
box-sizing: border-box;
}
}
}
.content2 {
background: #f6f6f6;
padding: 10rpx 15rpx;
box-sizing: border-box;
.shopitem {
padding: 0 20rpx;
display: flex;
height: 150rpx;
background-color: white;
border-radius: 16rpx;
align-items: center;
justify-content: space-between;
margin-bottom: 10rpx;
.left {
display: flex;
align-items: center;
height: 100rpx;
.img {
width: 100rpx;
height: 100rpx;
border-radius: 16rpx;
}
.middle {
height: 100%;
margin-left: 20rpx;
display: flex;
flex-direction: column;
justify-content: center;
.text {
font-weight: bold;
font-size: 26rpx;
margin-bottom: 8rpx;
}
.icon-statr {
:deep(.wd-icon-star-on) {
display: block !important;
}
}
.collection {
font-size: 22rpx;
}
}
}
.btn {
text-align: center;
border-radius: 50rpx;
background: #2fb641;
font-size: 22rpx;
padding: 8rpx 15rpx;
color: white;
box-sizing: border-box;
}
}
} }
</style> </style>
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
<!-- 底部 --> <!-- 底部 -->
<view class="bottom-operation-bar"> <view class="bottom-operation-bar">
<view class="start" @click="collectionFn"> <view class="start" @click="collectionFn">
<image v-if="shopInfo.isCollect === 0" src="@/static/shop/start.png"></image> <wd-icon v-if="shopInfo.isCollect === 0" name="star" size="22px"></wd-icon>
<wd-icon v-else color="red" name="star-on" size="22px"></wd-icon> <wd-icon v-else color="red" name="star-on" size="22px"></wd-icon>
{{ shopInfo.privateIntFcount || 0 }} {{ shopInfo.privateIntFcount || 0 }}
</view> </view>
...@@ -1014,6 +1014,7 @@ page { ...@@ -1014,6 +1014,7 @@ page {
padding: 20rpx 20rpx 96rpx 42rpx; padding: 20rpx 20rpx 96rpx 42rpx;
position: fixed; position: fixed;
justify-content: space-between; justify-content: space-between;
align-items: center;
bottom: 0; bottom: 0;
.start { .start {
font-size: 11 * 2rpx; font-size: 11 * 2rpx;
...@@ -1033,7 +1034,7 @@ page { ...@@ -1033,7 +1034,7 @@ page {
background: #fa5151; background: #fa5151;
box-sizing: border-box; box-sizing: border-box;
padding: 20rpx 208rpx; padding: 20rpx 208rpx;
max-height: 72rpx; height: 72rpx;
} }
} }
} }
......
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