diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js index 47c0561..a9f2b3c 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.js +++ b/packageC/pages/presell/goodsInfo/goodsInfo.js @@ -257,6 +257,8 @@ Page({ hiddenCS: true, is_retail_price: 0, + keyword:'', //门店搜索 + sec_i:-1,//选中分类门店 下标 }, //------初始化加载---------- @@ -2009,7 +2011,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) { @@ -3886,6 +3974,7 @@ Page({ sort_store: 0, choice_sort_store: 1, sec_sto: item, + sec_i:index, sec_pick_index: 0 }); }, diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.wxml b/packageC/pages/presell/goodsInfo/goodsInfo.wxml index ca90d87..c4ccc95 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.wxml +++ b/packageC/pages/presell/goodsInfo/goodsInfo.wxml @@ -831,6 +831,12 @@ + + + + 搜索 + + diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.wxss b/packageC/pages/presell/goodsInfo/goodsInfo.wxss index 5c108f7..600205b 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.wxss +++ b/packageC/pages/presell/goodsInfo/goodsInfo.wxss @@ -2993,4 +2993,27 @@ button.custom-service::after{ top: -1000px; } +.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; +} diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index c333b80..12913d6 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -269,6 +269,7 @@ Page({ base_nor_goods_id:0, user_pre_buynum:0, //用户优惠促销参与次数 keyword:'', //门店搜索 + sec_i:-1,//选中分类门店 下标 }, //------初始化加载---------- @@ -3595,12 +3596,7 @@ Page({ }) }, - //获取搜索门店输入的值 - input_store: function(e) { - this.setData({ - keyword: e.detail.value - }) - }, + //---------拿出门店分类和门店------------ @@ -3650,10 +3646,7 @@ Page({ } clearInterval(timer_get); - //门店搜索关键字 - if (th.data.keyword) { - dd.keyword=th.data.keyword - } + //如果会员是有默认的门店话 @@ -3727,7 +3720,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) { @@ -6969,6 +7048,7 @@ Page({ sort_store: 0, choice_sort_store: 1, sec_sto: item, + sec_i:index, sec_pick_index: 0 }); }, diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index fed4c21..ab490f4 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -1601,8 +1601,8 @@ - - + + 搜索