时味苏州
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

360 lines
7.4 KiB

<template>
<view class="bg" v-if="supplierInfo">
<!-- 搜索 -->
<view class="search-header" :style="{'height': height+'px','padding-top':statusBarHeight+'px'}">
<uni-icons type="left" size="20" @click="goBack" style="flex-shrink: 0;"></uni-icons>
<view class="input-model" >
<uni-icons style="height: 1.4rem;line-height: 1.4rem;" type="search" size="15" color="#ABAAAD" ></uni-icons>
<input class="input-text" v-model="searchText" placeholder="搜索"></text>
<view class="search-btn" @click="search()">搜索</view>
</view>
</view>
<div :style="{'height':height+'px','flex-shrink':0}"></div>
<view class="price-box supplier-box">
<image v-if="supplierInfo.headimg" class="supplier-image" :src="supplierInfo.headimg"></image>
<view class="supplier-content">
<view class="text-overflowRows">{{supplierInfo.shop_name}}</view>
<view class="tags" v-if="supplierInfo.display_tags">
<view class="tags-item" v-for="(item,i) in supplierInfo.display_tags.split(',')" :key="i">
{{item}}
</view>
</view>
</view>
</view>
<!-- 搜索 -->
<view class="data-container" style="height: 100rpx;flex: 1;">
<view class="no-data-zhanwei" v-if="list.length<=0">
<image src="https://static.ticket.sz-trip.com/uploads/20250618/0c2a469b4216f8cd570822b642d0a0fe.png"></image>
<view style="padding:50rpx 0 67rpx">暂无数据</view>
</view>
<scroll-view class="right-container no-scrollbar" :scroll-y="true" @scrolltolower="scrollLow()" v-else>
<view class="search-result" >
<view v-for="(item,i) in list" class="search-item" :key="i" @click="viewDetail(item)">
<image :src="showImg(item.headimg)" mode="aspectFill"></image>
<view class="search-result-container">
<view class="title text-overflowRows">{{item.title}}</view>
<view class="flex-between" style="padding-top: 20rpx;">
<view class="price">{{item.price/100}}</view>
<view class="btn">购买</view>
</view>
</view>
</view>
</view>
</scroll-view >
</view>
</view>
</template>
<script>
export default {
data() {
return {
height: 0,
statusBarHeight: 0,
id: null,
supplierInfo:null,
searchText: '',
list:[],
finished: false,
}
},
onLoad(options) {
this.id = options.id;
this.getSupplierInfo();
},
onReady() {
this.initRectInfo()
},
methods: {
initRectInfo () {
const sysInfo = uni.getSystemInfoSync()
this.statusBarHeight = sysInfo.statusBarHeight
// 默认高度
this.height = sysInfo.statusBarHeight + 40
},
getSupplierInfo () {
this.Post({supplier_id: this.id},
'/api/supplier/get_supplier_detail').then(res => {
if (res.code != 1) {
uni.showToast({
title: '店铺不存在',
icon: 'none'
})
setTimeout(() => {
this.goBack()
}, 2000)
return
}
this.supplierInfo = res.data;
this.search()
});
},
search () {
this.finished = false
this.list = []
this.getList()
},
// 根据产品分类获取产品列表
getList(){
let param = {}
this.Post({
title: this.searchText.trim(),
supplier_id: this.id,
offset: this.list.length,
limit: 10,
},'/api/supplier/get_product_by_supplier_id').then(res => {
this.list = [...this.list, ...res.data.list];
if (res.data.list.length < 10) {
this.finished = true
}
console.log(this.list)
})
},
scrollLow () {
if (!this.finished) {
this.getList()
}
},
viewDetail(item) {
// uni.navigateTo({
// url: '/subPackages/techan/detail?id=' + item.id
// })
this.gotoDetailByType(item)
},
},
onReachBottom() {
}
}
</script>
<style lang="scss" scoped>
view {
box-sizing: border-box;
}
.search-header{
width: 100%;
position: fixed;
top: 0;
left: 0;
right: 0;
display: flex;
align-items: center;
padding-left: 10rpx;
padding-right: 120px;
background: #fff;
// #ifdef H5
padding-right: 20rpx;
// #endif
.input-model{
flex: 1;
width: 1rpx;
height: 64rpx;
background: #F2F4F7;
border-radius: 55rpx;
margin-left: 12rpx;
display: flex;
align-items: center;
font-weight: 400;
font-size: 24rpx;
color: #999999;
padding-left: 24rpx;
}
.input-text{
height:19px;
padding-left: 14rpx;
font-weight: 400;
font-size: 24rpx;
color: #030000;
// #ifdef H5
width: 500rpx;
// #endif
}
.search-btn{
font-weight: 500;
font-size: 29rpx;
color: #6A8A2D;
padding-left: 25rpx;
width: 85rpx;
height: 50%;
line-height: 1;
border-left: 1px solid #CCCCCC;
}
}
.bg {
height: 100vh;
padding-bottom: 26rpx;
display: flex;
flex-direction: column;
background: #F8FAFB;
}
.data-container{
background: #F7F7F7;
display: flex;
flex-direction: column;
}
.right-container{
flex: 1;
width: 100%;
height: 1rpx;
.search-result{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
flex: 1;
flex-shrink: 0;
padding:30rpx 26rpx 0;
.search-item{
width: 335rpx;
height: 510rpx;
overflow: hidden;
background: #FFFFFF;
border-radius: 13rpx;
margin-bottom: 26rpx;
display: flex;
flex-direction: column;
image{
width: 335rpx;
height: 342rpx;
background: #87CD93;
border-radius: 13rpx 13rpx 0rpx 0rpx;
}
}
.search-result-container{
flex: 1;
padding:6rpx 12rpx 12rpx;
width: 100%;
height: 1rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.title{
font-weight: 500;
font-size: 29rpx;
color: #000000;
}
.price{
font-weight: 400;
font-size: 33rpx;
color: #C3282E;
}
.price:before{
content: "¥";
font-size: 23rpx;
}
.price:after{
content: "起";
font-size: 23rpx;
color: #999;
}
.btn{
width: 107rpx;
height: 47rpx;
background: #6A8A2D;
border-radius: 11rpx;
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
text-align: center;
line-height: 47rpx;
}
}
}
}
.placeholder-content{
background: white;
position: relative;
.btn-cover{
z-index: 200;
position: fixed;
bottom: 0;
width: 750rpx;
height: 148rpx;
background: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(6,0,1,0.1);
.btn{
width: 670rpx;
height: 78rpx;
text-align: center;
line-height: 78rpx;
background: #6A8A2D;
border-radius: 11rpx;
font-size: 34rpx;
font-family: PingFangSC;
font-weight: 500;
color: #FFFFFF;
}
}
}
.supplier-box{
display: flex;
align-items: center;
padding: 28rpx 23rpx;
width: 100%;
background: #ffffff;
flex-shrink: 0;
.supplier-image{
width: 113.07rpx;
height: 113.07rpx;
border-radius: 50%;
flex-shrink: 0 ;
}
.supplier-content{
flex: 1;
width: 1px;
padding: 0 50rpx 0 20rpx;
height: 113.07rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
font-weight: bold;
font-size: 32rpx;
color: #010101;
}
.tags{
display: flex;
width: 100%;
overflow: hidden;
.tags-item{
padding: 4rpx 10rpx;
font-weight: 500;
font-size: 24rpx;
color: #6A8A27;
border-radius: 5rpx 4rpx 4rpx 5rpx;
border: 1px solid #6A8A27;
margin-right: 15rpx;
}
}
}
</style>