|
|
@ -4,25 +4,26 @@ |
|
|
|
<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" placeholder="请输入商品名称" v-model="searchText"></text> |
|
|
|
<input class="input-text" placeholder="请输入商品名称" v-model="searchText" @confirm="search()" @keyup.enter="search()"></text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<div :style="{'height':height+'px'}"></div> |
|
|
|
|
|
|
|
<div :style="{'height':height+'px','flex-shrink':0}"></div> |
|
|
|
|
|
|
|
<!-- 正常产品 --> |
|
|
|
<template v-if="searchText.trim().length<=0"> |
|
|
|
<img :src="showImg(headImg)" class="topImg" /> |
|
|
|
|
|
|
|
<view class="goods-container"> |
|
|
|
<scroll-view class="left-container no-scrollbar" :scroll-y="true"> |
|
|
|
<view :class="['type-item',typeIndex==i?'active':'']" |
|
|
|
v-for="(item,i) in typeParam" :key="i"> |
|
|
|
v-for="(item,i) in typeParam" :key="i" @click="changeType(item,i)"> |
|
|
|
味 | WEI |
|
|
|
<view class="active-type-bar" v-if="typeIndex==i"></view> |
|
|
|
</view> |
|
|
|
<view style="height: 148rpx;width: 1rpx;"></view> |
|
|
|
</scroll-view> |
|
|
|
<scroll-view class="right-container no-scrollbar" :scroll-y="true"> |
|
|
|
<scroll-view class="right-container no-scrollbar" :scroll-y="true" @scrolltolower="scrollLow()"> |
|
|
|
<view class="item" v-for="item in list" :key="item.goods.id" @click="viewDetail(item.goods)"> |
|
|
|
<image class="item-img" :src="showImg(item.goods.image)" mode=""></image> |
|
|
|
<view class="content"> |
|
|
@ -32,9 +33,7 @@ |
|
|
|
{{item.goods.money/100}} |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="buy-cart" @click.stop="showOrderCart(item.goods)"> |
|
|
|
<image :src="showImg('/uploads/20241104/0ac7eb782b73e60e3cfc8200b7934a4a.png')"></image> |
|
|
|
</view> |
|
|
|
<view class="buy-cart" @click.stop="showOrderCart(item.goods)">+</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -43,6 +42,55 @@ |
|
|
|
</scroll-view> |
|
|
|
|
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<!-- 搜索 --> |
|
|
|
<view v-else> |
|
|
|
<view v-if="searchList.length<=0" class="flex-center" style="width: 100%;height: 100%;flex-direction: column;"> |
|
|
|
<!-- <image style="width: 328rpx;height: 450.67rpx;"></image> --> |
|
|
|
<view style="font-weight: 500;font-size: 28rpx;color: #666666; |
|
|
|
text-align: center;margin-top: 67rpx;">暂无搜索结果</view> |
|
|
|
</view> |
|
|
|
<view style="padding:0 26rpx;background: #FFFFFF;" v-else> |
|
|
|
<view class="flex" style="justify-content: space-between;"> |
|
|
|
<view class="search-result" > |
|
|
|
<view v-for="(item,i) in searchList" > |
|
|
|
<view v-if="i%2==1" class="search-item" :key="i" @click="viewDetail(item.goods)"> |
|
|
|
<image :src="showImg(item.goods.image)" mode="widthFix"></image> |
|
|
|
<view class="search-container"> |
|
|
|
<view class="title text-overflowRows">{{item.goods.title}}</view> |
|
|
|
<view class="flex-between" style="padding-top: 20rpx;"> |
|
|
|
<view> |
|
|
|
<text class="price">{{item.goods.money/100}}</text> |
|
|
|
<text class="oldPrice">{{item.goods.price/100}}</text> |
|
|
|
</view> |
|
|
|
<view class="buy-cart" @click.stop="showOrderCart(item.goods)">+</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="search-result" > |
|
|
|
<view v-for="(item,i) in searchList"> |
|
|
|
<view class="search-item" v-if="i%2==0" :key="i" @click="viewDetail(item.goods)"> |
|
|
|
<image :src="showImg(item.goods.image)" mode="widthFix"></image> |
|
|
|
<view class="search-container"> |
|
|
|
<view class="title text-overflowRows">{{item.goods.title}}</view> |
|
|
|
<view class="flex-between" style="padding-top: 20rpx;"> |
|
|
|
<view> |
|
|
|
<text class="price">{{item.goods.money/100}}</text> |
|
|
|
<text class="oldPrice">{{item.goods.price/100}}</text> |
|
|
|
</view> |
|
|
|
<view class="buy-cart" @click.stop="showOrderCart(item.goods)">+</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view style="height: 148rpx;width: 1rpx;"></view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 购物车 --> |
|
|
|
<view class="btn-bottom" > |
|
|
@ -139,14 +187,13 @@ |
|
|
|
headImg: null, |
|
|
|
|
|
|
|
typeParam: [ |
|
|
|
{id: 1, title: ''},{id: 1, title: ''},{id: 1, title: ''}, |
|
|
|
{id: 60, title: ''},{id: 59, title: ''},{id: 60, title: ''}, |
|
|
|
{id: 1, title: ''},{id: 1, title: ''},{id: 1, title: ''}, |
|
|
|
{id: 1, title: ''},{id: 1, title: ''},{id: 1, title: ''}, |
|
|
|
{id: 1, title: ''},{id: 1, title: ''},{id: 1, title: ''}, |
|
|
|
{id: 1, title: ''},{id: 1, title: ''},{id: 1, title: ''}, |
|
|
|
], |
|
|
|
typeIndex: 0, |
|
|
|
|
|
|
|
list:[], |
|
|
|
finished: false, |
|
|
|
|
|
|
@ -159,7 +206,8 @@ |
|
|
|
cartDataVueShow: false, |
|
|
|
|
|
|
|
searchText: '', |
|
|
|
searchList: [] |
|
|
|
searchList: [], |
|
|
|
searchFinish: false, |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(options) { |
|
|
@ -178,10 +226,10 @@ |
|
|
|
this.height = sysInfo.statusBarHeight + 40 |
|
|
|
}, |
|
|
|
|
|
|
|
changeType (typeName, value) { |
|
|
|
if (this[typeName]!==value) { |
|
|
|
this[typeName]=value |
|
|
|
|
|
|
|
changeType (item, i) { |
|
|
|
if (this.typeIndex!== i) { |
|
|
|
this.typeIndex=i |
|
|
|
this.finished = false |
|
|
|
this.list = [] |
|
|
|
this.getList() |
|
|
|
} |
|
|
@ -190,7 +238,7 @@ |
|
|
|
// 根据产品分类获取产品列表 |
|
|
|
getList(){ |
|
|
|
this.Post({ |
|
|
|
tag_id: 60, |
|
|
|
tag_id: this.typeParam[this.typeIndex].id, |
|
|
|
offset: this.list.length, |
|
|
|
limit: 10, |
|
|
|
},'/api/tag/getGoodsByTagId').then(res => { |
|
|
@ -200,6 +248,11 @@ |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
scrollLow () { |
|
|
|
if (!this.finished) { |
|
|
|
this.getList() |
|
|
|
} |
|
|
|
}, |
|
|
|
viewDetail(item) { |
|
|
|
// this.goOtherDetail(item) |
|
|
|
if(!item.link_type) { |
|
|
@ -312,11 +365,20 @@ |
|
|
|
this.$refs.cartDataVueRef.goCartOrder() |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//搜索 |
|
|
|
search () { |
|
|
|
this.searchFinish = false |
|
|
|
this.searchList = [] |
|
|
|
// todo 请求 |
|
|
|
this.searchList = [...this.list,...this.list,...this.list,...this.list] |
|
|
|
}, |
|
|
|
}, |
|
|
|
onReachBottom() { |
|
|
|
setTimeout(() => { |
|
|
|
if (!this.finished) this.getList() |
|
|
|
},1000) |
|
|
|
if (!this.searchFinish) { |
|
|
|
this.search() |
|
|
|
} |
|
|
|
console.log(1) |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
@ -357,6 +419,7 @@ |
|
|
|
padding-left: 14rpx; |
|
|
|
font-weight: 400; |
|
|
|
font-size: 24rpx; |
|
|
|
color: #030000; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -452,16 +515,19 @@ |
|
|
|
font-size: 24rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
.buy-cart{ |
|
|
|
width: 44rpx; |
|
|
|
height: 44rpx; |
|
|
|
image{ |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
.buy-cart{ |
|
|
|
width: 44rpx; |
|
|
|
height: 44rpx; |
|
|
|
color: #FFFFFF; |
|
|
|
background: #74A5AA; |
|
|
|
line-height: 44rpx; |
|
|
|
font-size: 30rpx; |
|
|
|
text-align: center; |
|
|
|
border-radius: 50%; |
|
|
|
} |
|
|
|
|
|
|
|
.btn-list { |
|
|
|
z-index: 99; |
|
|
@ -676,5 +742,48 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.search-result{ |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
|
width: 100%; |
|
|
|
flex: 1; |
|
|
|
flex-shrink: 0; |
|
|
|
|
|
|
|
.search-item{ |
|
|
|
width: 337rpx; |
|
|
|
box-shadow: 0rpx 0rpx 9rpx 0rpx rgba(153,153,153,0.33); |
|
|
|
border-radius: 13rpx; |
|
|
|
flex-shrink: 0; |
|
|
|
margin-bottom: 20rpx; |
|
|
|
height: fit-content; |
|
|
|
image{ |
|
|
|
width: 100%; |
|
|
|
border-radius: 13rpx; |
|
|
|
} |
|
|
|
.search-container{ |
|
|
|
padding: 20rpx; |
|
|
|
.title{ |
|
|
|
font-weight: 500; |
|
|
|
font-size: 27rpx; |
|
|
|
color: #000000; |
|
|
|
} |
|
|
|
.price{ |
|
|
|
font-weight: 400; |
|
|
|
font-size: 33rpx; |
|
|
|
color: #D70000; |
|
|
|
} |
|
|
|
.price:before{ |
|
|
|
content: "¥"; |
|
|
|
font-size: 23rpx; |
|
|
|
} |
|
|
|
.oldPrice{ |
|
|
|
font-weight: 400; |
|
|
|
font-size: 21rpx; |
|
|
|
color: #999999; |
|
|
|
text-decoration-line: line-through; |
|
|
|
padding-left: 12rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|