diff --git a/common/api/shop.js b/common/api/shop.js index aea37d9..fb05bd6 100644 --- a/common/api/shop.js +++ b/common/api/shop.js @@ -294,8 +294,8 @@ export default { }) }, // 搜索发现列表 - searchwordlist() { - return vm.$u.post('ShopSearch/searchwordlist') + searchwordlist({type}) { + return vm.$u.post('ShopSearch/searchWordList',{type}) }, // 提交试穿订单 saveGoodsTry({ member_name, member_mobile, area_info, address_detail, goods_id, num, store_id, appointment_time }) { @@ -332,6 +332,13 @@ export default { fav_id: fid, type: type }) + }, + //店铺列表 + storeList({ page, name_search }) { + return vm.$u.post('shop/storeList',{ + page, + name_search: name_search + }) } } } diff --git a/pageB/follow/index.vue b/pageB/follow/index.vue index 57c8711..32aa774 100644 --- a/pageB/follow/index.vue +++ b/pageB/follow/index.vue @@ -5,7 +5,7 @@ 输入达人名称 - + diff --git a/pageB/search/index.vue b/pageB/search/index.vue index 30263d2..816dc2e 100644 --- a/pageB/search/index.vue +++ b/pageB/search/index.vue @@ -21,7 +21,7 @@ export default { // type: 2 商品 1: 其他 onLoad(option) { this.type = option.type; - if(option.type == 2) this.getWordList(); + this.getWordList(); }, // 点击搜索按钮 onNavigationBarButtonTap(e) { @@ -37,8 +37,10 @@ export default { }, methods:{ getWordList() { - this.$u.api.searchwordlist().then(res => { - this.searchwordlist = res.data; + this.$u.api.searchwordlist({type:this.type}).then(res => { + console.log(res) + this.searchwordlist = res.data; + }) }, search(value){ @@ -52,14 +54,17 @@ export default { type: this.type, } if(this.type == 2) { - Object.assign(params, { - order: 'goods_salenum' - }) - } - this.$u.route({ - url: "/pageB/search/out", - params: params, - }) + this.$u.route({ + url: "/pageB/search/out", + params: params, + }) + }else{ + this.$u.route({ + url: "/pageB/search/searchGoods", + params: params, + }) + } + } } } diff --git a/pageB/search/out.vue b/pageB/search/out.vue index c471d84..bb497ac 100644 --- a/pageB/search/out.vue +++ b/pageB/search/out.vue @@ -1,59 +1,276 @@ + \ No newline at end of file diff --git a/pageB/search/searchGoods.vue b/pageB/search/searchGoods.vue index 10661a6..845b1f4 100644 --- a/pageB/search/searchGoods.vue +++ b/pageB/search/searchGoods.vue @@ -36,24 +36,29 @@ export default { goodsList: [], scrollHeight: '', loadStatus: 'loadmore', - timer: true, // 防止上拉加载短时间内多次调用 + timer: true, // 防止上拉加载短时间内多次调用, + value:"" } }, watch: { current(value) { this.page = 1; - this.goodsListByClassId({ laod: 'reload' }); + this.ShopSearch({ laod: 'reload' }); }, priceOrderAsc(value) { this.page = 1; - this.goodsListByClassId({ laod: 'reload' }); + this.ShopSearch({ laod: 'reload' }); } }, onLoad(option) { - this.cid = option.cid; - this.goodsListByClassId({ load: 'reload' }); + this.value = option.value this.setViewHeight(); - this.setTitle(option.cname); + this.ShopSearch() + }, + onNavigationBarSearchInputConfirmed(value) { + this.value = value.text + this.ShopSearch() + }, methods: { setOrderSort() { @@ -69,10 +74,10 @@ export default { return sort; }, // 排序方式 goods_salenum:销量 evaluation_count:评价 goods_price_asc:价格从低到高 goods_price_desc:价格从高到低 - async goodsListByClassId({ load = 'reload' } = {}) { + async ShopSearch({ load = 'reload' } = {}) { const sort = this.setOrderSort(); - const res = await this.$u.api.goodsListByClassId({ - gc_id: this.cid, + const res = await this.$u.api.ShopSearch({ + keyword: this.value, page: this.page, order: sort, }) @@ -88,7 +93,7 @@ export default { if(!this.timer) return false; this.loadStatus = "loading"; this.page++; - this.goodsListByClassId({ load: 'loadmore' }).then(length => { + this.ShopSearch({ load: 'loadmore' }).then(length => { if(length == 0) { this.page--; this.loadStatus = 'nomore'; @@ -101,22 +106,17 @@ export default { }) }, switchCurrent(current) { + this.ShopSearch() if(current == 1 && this.current == 1) this.priceOrderAsc = !this.priceOrderAsc; this.current = current; }, setViewHeight() { const res = uni.getSystemInfoSync(); - this.scrollHeight = res.windowHeight - (90 / 2) + 'px'; - }, - setTitle(title) { - uni.setNavigationBarTitle({ - title: title - }); + this.scrollHeight = res.windowHeight - res.windowWidth / 750 * 90 + 'px'; }, toDetailsPage(id) { this.$u.route('/pageB/sdetails/index', { - id: id, - type: 1 // 商品详情 商品类型 1普通 2拼团 3秒杀 4优惠券 + id: id }); } } diff --git a/pages/index/index.vue b/pages/index/index.vue index 0a2bff4..dae60c4 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -442,7 +442,7 @@ }, goSearch() { this.$u.route("/pageB/search/index", { - type: 1, + type: 2, }); } }, diff --git a/pages/shop/index.vue b/pages/shop/index.vue index 62f61ca..6cccac4 100644 --- a/pages/shop/index.vue +++ b/pages/shop/index.vue @@ -114,7 +114,7 @@ this.$u.route({ url: "pageB/search/index", params: { - type: 2, + type: 1, } }) },