Commit 6079671c5c448f6abb4d9d9ff9a9943491589618
1 parent
6356e780
门店搜索
Showing
3 changed files
with
118 additions
and
0 deletions
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... | ... | @@ -285,6 +285,8 @@ Page({ |
285 | 285 | |
286 | 286 | hiddenCS: true, |
287 | 287 | is_get_guide:0, |
288 | + keyword:'', //门店搜索 | |
289 | + sec_i:-1,//选中分类门店 下标 | |
288 | 290 | }, |
289 | 291 | |
290 | 292 | //------初始化加载---------- |
... | ... | @@ -3247,7 +3249,93 @@ Page({ |
3247 | 3249 | }, 200) |
3248 | 3250 | |
3249 | 3251 | }, |
3252 | + //获取搜索门店输入的值 | |
3253 | + input_store: function(e) { | |
3254 | + this.setData({ | |
3255 | + keyword: e.detail.value | |
3256 | + }) | |
3257 | + }, | |
3258 | + //搜索门店 | |
3259 | + searchfn(){ | |
3260 | + let choice_sort_store = this.data.choice_sort_store | |
3261 | + if (choice_sort_store==0) { //全局搜索 | |
3262 | + let all_pick_list = this.data.all_pick_list | |
3263 | + let def_pickpu_list = this.data.def_pickpu_list | |
3264 | + let keyword = this.data.keyword | |
3265 | + if (keyword) { | |
3266 | + let arr=all_pick_list.filter( item =>{ | |
3267 | + let i = item.pickup_name.indexOf(keyword) | |
3268 | + if (i > -1) { | |
3269 | + return true | |
3270 | + }else{ | |
3271 | + return false | |
3272 | + } | |
3273 | + }) | |
3274 | + if (arr && arr.length>0) { | |
3275 | + if(this.data.is_show_sto_cat==1){ | |
3276 | + this.setData({ | |
3277 | + def_pickpu_list:arr | |
3278 | + }) | |
3279 | + }else{ | |
3280 | + this.setData({ | |
3281 | + only_pk:arr | |
3282 | + }) | |
3283 | + } | |
3284 | + }else{ | |
3285 | + wx.showToast({ | |
3286 | + title: '没有搜索到门店', | |
3287 | + icon: 'none', | |
3288 | + duration: 2000 | |
3289 | + }) | |
3290 | + } | |
3291 | + }else{ | |
3292 | + if (this.data.is_show_sto_cat==1) { | |
3293 | + this.setData({ | |
3294 | + def_pickpu_list:all_pick_list.slice(0,10) | |
3295 | + }) | |
3296 | + }else{ | |
3297 | + this.setData({ | |
3298 | + only_pk:all_pick_list | |
3299 | + }) | |
3300 | + } | |
3250 | 3301 | |
3302 | + } | |
3303 | + }else{ //分类下搜索 | |
3304 | + let sec_i=this.data.sec_i | |
3305 | + let all_sto = this.data.all_sto | |
3306 | + let sec_sto= this.data.sec_sto | |
3307 | + let sec_arr = sec_sto.s_arr | |
3308 | + let keyword = this.data.keyword | |
3309 | + let text='sec_sto.s_arr' | |
3310 | + if (keyword) { | |
3311 | + let arr=sec_arr.filter( item =>{ | |
3312 | + let i = item.pickup_name.indexOf(keyword) | |
3313 | + if (i > -1) { | |
3314 | + return true | |
3315 | + }else{ | |
3316 | + return false | |
3317 | + } | |
3318 | + }) | |
3319 | + if (arr && arr.length>0) { | |
3320 | + this.setData({ | |
3321 | + [text]:arr | |
3322 | + }) | |
3323 | + }else{ | |
3324 | + wx.showToast({ | |
3325 | + title: '没有搜索到门店', | |
3326 | + icon: 'none', | |
3327 | + duration: 2000 | |
3328 | + }) | |
3329 | + } | |
3330 | + }else{ | |
3331 | + this.setData({ | |
3332 | + [text]:all_sto[sec_i].s_arr | |
3333 | + }) | |
3334 | + } | |
3335 | + | |
3336 | + | |
3337 | + } | |
3338 | + }, | |
3251 | 3339 | |
3252 | 3340 | //------------处理门店--------------- |
3253 | 3341 | deal_pickup(e) { |
... | ... | @@ -5921,6 +6009,7 @@ Page({ |
5921 | 6009 | sort_store: 0, |
5922 | 6010 | choice_sort_store: 1, |
5923 | 6011 | sec_sto: item, |
6012 | + sec_i:index, | |
5924 | 6013 | sec_pick_index: 0 |
5925 | 6014 | }); |
5926 | 6015 | }, | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
... | ... | @@ -1342,6 +1342,12 @@ |
1342 | 1342 | </view> |
1343 | 1343 | </view> |
1344 | 1344 | </view> |
1345 | + <view class="searchbar flex-vertical-between storeListpadd"> | |
1346 | + <input class="inputstore fs28" placeholder="输入要搜索的门店" value="{{keyword}}" placeholder-class="fs28" maxlength="16" bindinput="input_store" bindconfirm="searchfn" /> | |
1347 | + <view class="search flex-center" bindtap="searchfn"> | |
1348 | + <view class="fs28">搜索</view> | |
1349 | + </view> | |
1350 | + </view> | |
1345 | 1351 | <!-- 门店列表,最外层的门店列表,一开始 --> |
1346 | 1352 | <view class="store-list"> |
1347 | 1353 | <!-- 如果还没有点击更多门店的时候 --> | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss
... | ... | @@ -3116,3 +3116,26 @@ button.custom-service::after{ |
3116 | 3116 | overflow-y: auto; |
3117 | 3117 | } |
3118 | 3118 | |
3119 | + .searchbar { | |
3120 | + height: 95rpx; | |
3121 | + border-bottom: 2rpx solid rgb(238, 238, 238); | |
3122 | +} | |
3123 | +.storeListpadd { | |
3124 | + padding: 0rpx 31rpx; | |
3125 | +} | |
3126 | +.search { | |
3127 | + width: 125rpx; | |
3128 | + height: 45rpx; | |
3129 | + line-height: 45rpx; | |
3130 | + background-color: rgb(219, 27, 52); | |
3131 | + border-radius: 30rpx; | |
3132 | + color: rgb(255, 255, 255); | |
3133 | +} | |
3134 | +.inputstore { | |
3135 | + width: 510rpx; | |
3136 | + height: 43rpx; | |
3137 | + line-height: 43rpx; | |
3138 | + border-radius: 30rpx; | |
3139 | + border: 2rpx solid rgb(238, 238, 238); | |
3140 | + padding-left: 30rpx; | |
3141 | +} | ... | ... |