import{M as s,c as e,r as a,D as t,$ as l,X as r,d as o,e as i,f as c,a as u,g as n,u as h,l as d,i as y,j as f,F as p,m,s as _,a0 as L,O as v,a1 as x,b,p as k,t as g,N as j}from"./index-45b322f7.js";import{_ as w}from"./uni-data-select.f353a149.js";import{_ as H}from"./uni-search-bar.48a9b35c.js";import{_ as T}from"./s-layout.940eafb4.js";import{i as V}from"./index.f474d5f6.js";import{_ as C}from"./_plugin-vue_export-helper.1b428a4d.js";import"./uni-cloud.es.7d5f2c52.js";import"./uni-icons.c22fa7d9.js";const F=C({__name:"search",setup(C){const F=s({historyList:[],hideHistory:!1}),$=e((()=>_.$store("searchTypes").searchTypeList)),z=a(""),O=a("");function S(s,e){s&&(!function(s){F.historyList.includes(s)&&F.historyList.splice(F.historyList.indexOf(s),1);F.historyList.unshift(s),F.historyList.length>=10&&(F.historyList.length=10);L("searchHistory",F.historyList)}(s),_.$router.go("/pages/goods/list",{keyword:s,searchType:e,typeFilter:!1}))}function U(){_.$router.back()}function A(){v({title:"删除确认",content:"确认删除全部历史记录？",success:function(s){s.confirm&&(F.historyList=[],x("searchHistory"))}})}function D(s){return null==s||null==s||""==s}return t((s=>{F.historyList=l("searchHistory")||[],D(s.keyword)||(O.value=s.keyword),D(s.searchType)?z.value=$.value[0].value:z.value=s.searchType})),r((()=>{F.historyList=l("searchHistory")||[]})),(s,e)=>{const a=u(b("uni-data-select"),w),t=k,l=u(b("uni-search-bar"),H),r=j,_=u(b("s-layout"),T);return o(),i(_,{class:"set-wrap",bgStyle:{color:"#F2F2F2"}},{default:c((()=>[n(t,{class:"ss-flex ss-col-center search-bar ss-p-l-24 ss-p-r-24"},{default:c((()=>[n(t,{class:"searchType"},{default:c((()=>[n(a,{localdata:h($),modelValue:z.value,"onUpdate:modelValue":e[0]||(e[0]=s=>z.value=s),clear:!1,class:"dataSelect ss-flex-1"},null,8,["localdata","modelValue"])])),_:1}),n(l,{class:"ss-flex-1 uni-searchbar",radius:"4",placeholder:"请输入关键字",modelValue:O.value,"onUpdate:modelValue":e[1]||(e[1]=s=>O.value=s),focus:!0,onConfirm:e[2]||(e[2]=s=>S(s.value,z.value)),onCancel:U},null,8,["modelValue"])])),_:1}),F.historyList.length>0?(o(),i(t,{key:0,class:"ss-p-x-24"},{default:c((()=>[n(t,{class:"history"},{default:c((()=>[n(t,{class:"ss-flex ss-row-between ss-col-center history-head"},{default:c((()=>[n(t,{class:"serach-history"},{default:c((()=>[d("历史搜索")])),_:1}),n(h(V),{onClick:A,size:"24",fill:"#999999"})])),_:1}),n(t,{class:"ss-flex ss-col-center ss-row-left ss-flex-wrap"},{default:c((()=>[F.hideHistory?m("",!0):(o(!0),y(p,{key:0},f(F.historyList,((s,e)=>(o(),i(r,{class:"history-btn ss-reset-button",onClick:e=>S(s,z.value),key:e},{default:c((()=>[d(g(s),1)])),_:2},1032,["onClick"])))),128))])),_:1})])),_:1})])),_:1})):m("",!0)])),_:1})}}},[["__scopeId","data-v-3880b757"]]);export{F as default};
