diff --git a/pages/goods_search/goods_search.vue b/pages/goods_search/goods_search.vue index 790bf22..ce4c483 100644 --- a/pages/goods_search/goods_search.vue +++ b/pages/goods_search/goods_search.vue @@ -7,7 +7,7 @@ - + @@ -29,8 +29,9 @@ + - @@ -41,16 +42,15 @@ - - - - - - - {{item.name}} + + + + + {{item.name}} + + {{tip}} - {{tip}} @@ -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) },