|
|
@ -1,34 +1,38 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<div class="search-list">
|
|
|
|
<div class="search-list">
|
|
|
|
<nav-bar v-model="value" @handleSearch="handleSearch" />
|
|
|
|
<nav-bar v-model="curSearchText" @handleSearch="handleSearch" />
|
|
|
|
<filter-bar @changeGoods="changeGoods($event)" />
|
|
|
|
<div v-if="searchText == curSearchText">
|
|
|
|
|
|
|
|
<filter-bar @changeGoods="changeGoods($event)" />
|
|
|
|
<van-list
|
|
|
|
<van-list
|
|
|
|
v-model="loading"
|
|
|
|
v-model="loading"
|
|
|
|
:finished="finished"
|
|
|
|
:finished="finished"
|
|
|
|
finished-text="没有更多了"
|
|
|
|
finished-text="没有更多了"
|
|
|
|
:immediate-check="false"
|
|
|
|
:immediate-check="false"
|
|
|
|
@load="onReachBottom"
|
|
|
|
@load="onReachBottom"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<div class="main">
|
|
|
|
<div class="main">
|
|
|
|
<goods-item
|
|
|
|
<goods-item
|
|
|
|
v-for="(item,idx) in list"
|
|
|
|
v-for="(item,idx) in list"
|
|
|
|
:key="idx"
|
|
|
|
:key="idx"
|
|
|
|
:goods-id="item.id"
|
|
|
|
:goods-id="item.id"
|
|
|
|
:img="item.picUrl"
|
|
|
|
:img="item.picUrl"
|
|
|
|
:title="item.name"
|
|
|
|
:title="item.name"
|
|
|
|
:desc="item.brief"
|
|
|
|
:desc="item.brief"
|
|
|
|
:price="item.retailPrice"
|
|
|
|
:price="item.retailPrice"
|
|
|
|
:discount="item.counterPrice"
|
|
|
|
:discount="item.counterPrice"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</van-list>
|
|
|
|
</van-list>
|
|
|
|
<van-empty v-if="list && list.length <=0 " description="没有搜索到商品" />
|
|
|
|
<van-empty v-if="list && list.length <=0 " description="没有搜索到商品" />
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!--联想建议-->
|
|
|
|
|
|
|
|
<search-suggestion v-else :search-text="curSearchText" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
import { getSearchList } from '@/api/search'
|
|
|
|
import { getSearchList } from '@/api/search'
|
|
|
|
|
|
|
|
import SearchSuggestion from './modules/Suggest'
|
|
|
|
import NavBar from './modules/NavBar'
|
|
|
|
import NavBar from './modules/NavBar'
|
|
|
|
import FilterBar from './modules/FilterBar'
|
|
|
|
import FilterBar from './modules/FilterBar'
|
|
|
|
import GoodsItem from '@/components/GoodsItem'
|
|
|
|
import GoodsItem from '@/components/GoodsItem'
|
|
|
@ -37,12 +41,14 @@ export default {
|
|
|
|
name: 'SearchList',
|
|
|
|
name: 'SearchList',
|
|
|
|
components: {
|
|
|
|
components: {
|
|
|
|
NavBar,
|
|
|
|
NavBar,
|
|
|
|
|
|
|
|
SearchSuggestion,
|
|
|
|
FilterBar,
|
|
|
|
FilterBar,
|
|
|
|
GoodsItem
|
|
|
|
GoodsItem
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
value: '',
|
|
|
|
searchText: '',
|
|
|
|
|
|
|
|
curSearchText: '',
|
|
|
|
list: [],
|
|
|
|
list: [],
|
|
|
|
pageSize: 10,
|
|
|
|
pageSize: 10,
|
|
|
|
pageNum: 1,
|
|
|
|
pageNum: 1,
|
|
|
@ -66,7 +72,8 @@ export default {
|
|
|
|
duration: 0
|
|
|
|
duration: 0
|
|
|
|
})
|
|
|
|
})
|
|
|
|
const { keyword } = this.$route.query
|
|
|
|
const { keyword } = this.$route.query
|
|
|
|
this.value = keyword
|
|
|
|
this.searchText = keyword
|
|
|
|
|
|
|
|
this.curSearchText = keyword
|
|
|
|
this.keyword = keyword
|
|
|
|
this.keyword = keyword
|
|
|
|
this.getList()
|
|
|
|
this.getList()
|
|
|
|
},
|
|
|
|
},
|
|
|
|