From 6079671c5c448f6abb4d9d9ff9a9943491589618 Mon Sep 17 00:00:00 2001 From: luo <17530855@qq.com> Date: Fri, 16 Jun 2023 15:17:30 +0800 Subject: [PATCH] 门店搜索 --- packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml | 6 ++++++ packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss | 23 +++++++++++++++++++++++ 3 files changed, 118 insertions(+), 0 deletions(-) diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js index bf256a7..01e6bc2 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js @@ -285,6 +285,8 @@ Page({ hiddenCS: true, is_get_guide:0, + keyword:'', //门店搜索 + sec_i:-1,//选中分类门店 下标 }, //------初始化加载---------- @@ -3247,7 +3249,93 @@ Page({ }, 200) }, + //获取搜索门店输入的值 + input_store: function(e) { + this.setData({ + keyword: e.detail.value + }) + }, + //搜索门店 + searchfn(){ + let choice_sort_store = this.data.choice_sort_store + if (choice_sort_store==0) { //全局搜索 + let all_pick_list = this.data.all_pick_list + let def_pickpu_list = this.data.def_pickpu_list + let keyword = this.data.keyword + if (keyword) { + let arr=all_pick_list.filter( item =>{ + let i = item.pickup_name.indexOf(keyword) + if (i > -1) { + return true + }else{ + return false + } + }) + if (arr && arr.length>0) { + if(this.data.is_show_sto_cat==1){ + this.setData({ + def_pickpu_list:arr + }) + }else{ + this.setData({ + only_pk:arr + }) + } + }else{ + wx.showToast({ + title: '没有搜索到门店', + icon: 'none', + duration: 2000 + }) + } + }else{ + if (this.data.is_show_sto_cat==1) { + this.setData({ + def_pickpu_list:all_pick_list.slice(0,10) + }) + }else{ + this.setData({ + only_pk:all_pick_list + }) + } + } + }else{ //分类下搜索 + let sec_i=this.data.sec_i + let all_sto = this.data.all_sto + let sec_sto= this.data.sec_sto + let sec_arr = sec_sto.s_arr + let keyword = this.data.keyword + let text='sec_sto.s_arr' + if (keyword) { + let arr=sec_arr.filter( item =>{ + let i = item.pickup_name.indexOf(keyword) + if (i > -1) { + return true + }else{ + return false + } + }) + if (arr && arr.length>0) { + this.setData({ + [text]:arr + }) + }else{ + wx.showToast({ + title: '没有搜索到门店', + icon: 'none', + duration: 2000 + }) + } + }else{ + this.setData({ + [text]:all_sto[sec_i].s_arr + }) + } + + + } + }, //------------处理门店--------------- deal_pickup(e) { @@ -5921,6 +6009,7 @@ Page({ sort_store: 0, choice_sort_store: 1, sec_sto: item, + sec_i:index, sec_pick_index: 0 }); }, diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml index 8b166fc..ac6bb41 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml @@ -1342,6 +1342,12 @@ + + + + 搜索 + + diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss index 7d49f88..0b47843 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss @@ -3116,3 +3116,26 @@ button.custom-service::after{ overflow-y: auto; } + .searchbar { + height: 95rpx; + border-bottom: 2rpx solid rgb(238, 238, 238); +} +.storeListpadd { + padding: 0rpx 31rpx; +} +.search { + width: 125rpx; + height: 45rpx; + line-height: 45rpx; + background-color: rgb(219, 27, 52); + border-radius: 30rpx; + color: rgb(255, 255, 255); +} +.inputstore { + width: 510rpx; + height: 43rpx; + line-height: 43rpx; + border-radius: 30rpx; + border: 2rpx solid rgb(238, 238, 238); + padding-left: 30rpx; +} -- libgit2 0.21.4