优化搜索
This commit is contained in:
parent
b5ec6d2014
commit
56cfb89387
@ -29,8 +29,9 @@
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<view class="content">
|
||||
<mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
|
||||
<mescroll-uni v-if="!isCate" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
|
||||
:up="upOption" :down="{auto: false}" :fixed="false">
|
||||
<view class="goods-list">
|
||||
<view v-show="sortConfig.goodsType == 'double'" class="double">
|
||||
@ -41,16 +42,15 @@
|
||||
</view>
|
||||
</view>
|
||||
</mescroll-uni>
|
||||
</view>
|
||||
|
||||
<view class="list" v-if="showList">
|
||||
<view class="search-block" v-for="(item, index) in list" :key="index">
|
||||
<view class="flex search-list" @click="toPage(item.id)">
|
||||
<u-icon name="search" size="24"></u-icon>
|
||||
<view class="m-l-10">{{item.name}}</view>
|
||||
<view class="list" v-if="isCate">
|
||||
<view class="search-block" v-for="(item, index) in list" :key="index">
|
||||
<view class="flex search-list" @click="toPage(item.id)">
|
||||
<u-icon name="search" size="24"></u-icon>
|
||||
<view class="m-l-10">{{item.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="list == ''" class="m-t-10 bold text-center">{{tip}}</view>
|
||||
</view>
|
||||
<view v-if="list == ''" class="m-t-10 bold text-center">{{tip}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@ -100,7 +100,8 @@
|
||||
price_type: 0,
|
||||
showList: false,
|
||||
list: [],
|
||||
tip: ''
|
||||
tip: '',
|
||||
isCate: false
|
||||
};
|
||||
},
|
||||
|
||||
@ -222,10 +223,20 @@
|
||||
}
|
||||
},
|
||||
onSearch() {
|
||||
this.showHistory = false
|
||||
this.showList = false
|
||||
this.$nextTick(() => {
|
||||
this.onRefresh()
|
||||
if (this.isCate) {
|
||||
searchGoods({shop_name: this.keyword}).then((res) => {
|
||||
if (res.code == 1) {
|
||||
this.list = res.data
|
||||
if (res.data == '') {
|
||||
this.tip = '没有搜索到相关商品'
|
||||
}
|
||||
}
|
||||
uni.hideLoading()
|
||||
})
|
||||
} else {
|
||||
this.onRefresh()
|
||||
}
|
||||
})
|
||||
},
|
||||
onRefresh() {
|
||||
@ -245,13 +256,12 @@
|
||||
|
||||
getShop(e) {
|
||||
// TODO 搜索展现出商品列表, 暂时隐藏 u-searh @change="getShop"
|
||||
this.showList = true
|
||||
let shop_name = e
|
||||
uni.showLoading({
|
||||
title: '搜索中',
|
||||
mask: true
|
||||
})
|
||||
|
||||
this.isCate = true
|
||||
setTimeout(() => {
|
||||
searchGoods({shop_name}).then((res) => {
|
||||
if (res.code == 1) {
|
||||
@ -262,6 +272,7 @@
|
||||
}
|
||||
uni.hideLoading()
|
||||
})
|
||||
uni.hideLoading()
|
||||
}, 200)
|
||||
},
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user