From 519e18f20cd74e77bd81507742260c8f0c57d410 Mon Sep 17 00:00:00 2001 From: luo <17530855@qq.com> Date: Sat, 17 Jun 2023 18:15:56 +0800 Subject: [PATCH] 服务项目门店搜索 --- packageA/pages/goodsInfo/goodsInfo.js | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- packageA/pages/goodsInfo/goodsInfo.wxml | 6 ++++++ packageA/pages/goodsInfo/goodsInfo.wxss | 25 ++++++++++++++++++++++++- 3 files changed, 121 insertions(+), 3 deletions(-) diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js index 94ec55b..579f008 100644 --- a/packageA/pages/goodsInfo/goodsInfo.js +++ b/packageA/pages/goodsInfo/goodsInfo.js @@ -11,7 +11,7 @@ var t = require("../../../utils/util.js"), let self = null; -//评价加载更多 +//评价加载更多 var more = function(e) { return e && e.__esModule ? e : { default: e @@ -212,7 +212,9 @@ Page({ hiddenCS: true, //控制客服操作菜单显示和控制 - openSpecModal_flash_normal: 0, + openSpecModal_flash_normal: 0, + keyword:'', //门店搜索 + sec_i:-1,//选中分类门店 下标 }, //------初始化加载---------- @@ -1758,6 +1760,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 + }) + } + + + } + }, //------------处理门店--------------- diff --git a/packageA/pages/goodsInfo/goodsInfo.wxml b/packageA/pages/goodsInfo/goodsInfo.wxml index c93b2fd..f9d9df5 100644 --- a/packageA/pages/goodsInfo/goodsInfo.wxml +++ b/packageA/pages/goodsInfo/goodsInfo.wxml @@ -802,6 +802,12 @@ + + + + 搜索 + + diff --git a/packageA/pages/goodsInfo/goodsInfo.wxss b/packageA/pages/goodsInfo/goodsInfo.wxss index 0c694bc..30cece2 100644 --- a/packageA/pages/goodsInfo/goodsInfo.wxss +++ b/packageA/pages/goodsInfo/goodsInfo.wxss @@ -2968,5 +2968,28 @@ button.custom-service::after{ left: -1000px; 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; +} -- libgit2 0.21.4