|
@ -4,7 +4,7 @@ |
|
|
<uni-icons type="left" size="20" @click="goBack" style="flex-shrink: 0;"></uni-icons> |
|
|
<uni-icons type="left" size="20" @click="goBack" style="flex-shrink: 0;"></uni-icons> |
|
|
<view class="input-model"> |
|
|
<view class="input-model"> |
|
|
<uni-icons style="height: 1.4rem;line-height: 1.4rem;" type="search" size="15" color="#ABAAAD" ></uni-icons> |
|
|
<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" @confirm="search()" @keyup.enter="search()"></text> |
|
|
<input class="input-text" placeholder="请输入商品名称" v-model="searchText" @confirm="search(false)" @keyup.enter="search(false)"></text> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
@ -45,17 +45,17 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<!-- 搜索 --> |
|
|
<!-- 搜索 --> |
|
|
<view v-else> |
|
|
<view v-else style="flex: 1;"> |
|
|
<view v-if="searchList.length<=0" class="flex-center" style="width: 100%;height: 100%;flex-direction: column;"> |
|
|
<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> --> |
|
|
<image style="width: 328rpx;height: 450.67rpx;" :src="showImg('/uploads/20250514/0e5f4c089ba2f3a86d3c6f9d8d818d5b.png')"></image> |
|
|
<view style="font-weight: 500;font-size: 28rpx;color: #666666; |
|
|
<view style="font-weight: 500;font-size: 28rpx;color: #666666; |
|
|
text-align: center;margin-top: 67rpx;">暂无搜索结果</view> |
|
|
text-align: center;margin-top: 67rpx;padding-bottom: 300rpx;">暂无搜索结果</view> |
|
|
</view> |
|
|
</view> |
|
|
<view style="padding:0 26rpx;background: #FFFFFF;" v-else> |
|
|
<view style="padding:0 26rpx;background: #FFFFFF;min-height: 100%;" v-else> |
|
|
<view class="flex" style="justify-content: space-between;"> |
|
|
<view class="flex" style="justify-content: space-between;"> |
|
|
<view class="search-result" > |
|
|
<view class="search-result" > |
|
|
<view v-for="(item,i) in searchList" > |
|
|
<view v-for="(item,i) in searchList" > |
|
|
<view v-if="i%2==1" class="search-item" :key="i" @click="viewDetail(item.goods)"> |
|
|
<view v-if="i%2==0" class="search-item" :key="i" @click="viewDetail(item.goods)"> |
|
|
<image :src="showImg(item.goods.image)" mode="widthFix"></image> |
|
|
<image :src="showImg(item.goods.image)" mode="widthFix"></image> |
|
|
<view class="search-container"> |
|
|
<view class="search-container"> |
|
|
<view class="title text-overflowRows">{{item.goods.title}}</view> |
|
|
<view class="title text-overflowRows">{{item.goods.title}}</view> |
|
@ -72,7 +72,7 @@ |
|
|
</view> |
|
|
</view> |
|
|
<view class="search-result" > |
|
|
<view class="search-result" > |
|
|
<view v-for="(item,i) in searchList"> |
|
|
<view v-for="(item,i) in searchList"> |
|
|
<view class="search-item" v-if="i%2==0" :key="i" @click="viewDetail(item.goods)"> |
|
|
<view class="search-item" v-if="i%2==1" :key="i" @click="viewDetail(item.goods)"> |
|
|
<image :src="showImg(item.goods.image)" mode="widthFix"></image> |
|
|
<image :src="showImg(item.goods.image)" mode="widthFix"></image> |
|
|
<view class="search-container"> |
|
|
<view class="search-container"> |
|
|
<view class="title text-overflowRows">{{item.goods.title}}</view> |
|
|
<view class="title text-overflowRows">{{item.goods.title}}</view> |
|
@ -376,16 +376,38 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//搜索 |
|
|
//搜索 |
|
|
search () { |
|
|
search (isMore) { |
|
|
this.searchFinish = false |
|
|
if (this.searchText.trim().length<=0) { |
|
|
this.searchList = [] |
|
|
uni.showToast({ |
|
|
// todo 请求 |
|
|
title:'请输入搜索关键字', |
|
|
this.searchList = [...this.list,...this.list,...this.list,...this.list] |
|
|
icon:'none' |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if (!isMore) { |
|
|
|
|
|
this.searchList = [] |
|
|
|
|
|
this.searchFinish = false |
|
|
|
|
|
} |
|
|
|
|
|
this.Post({ |
|
|
|
|
|
name: this.searchText.trim(), |
|
|
|
|
|
offset: this.searchList.length, |
|
|
|
|
|
// type: 'pgoods', |
|
|
|
|
|
limit: 10, |
|
|
|
|
|
}, '/api/search/search').then(res => { |
|
|
|
|
|
let resData = (res.data || []).map(v=> {return {id: v.id, goods: v.search_data}}) |
|
|
|
|
|
console.log(resData) |
|
|
|
|
|
this.searchList = [...this.searchList, ...resData]; |
|
|
|
|
|
this.searchFinish = false |
|
|
|
|
|
console.log(resData, this.searchList) |
|
|
|
|
|
if (res.data.length<10) { |
|
|
|
|
|
this.searchFinish = true |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
onReachBottom() { |
|
|
onReachBottom() { |
|
|
if (!this.searchFinish) { |
|
|
if (!this.searchFinish) { |
|
|
this.search() |
|
|
this.search(true) |
|
|
} |
|
|
} |
|
|
console.log(1) |
|
|
console.log(1) |
|
|
} |
|
|
} |
|
|