import{a as e,x as a,a1 as s,O as l,o as t,e as o,h as u,w as n,i,F as r,u as c,G as _,j as v,I as d,k as f,z as p,s as m,H as y,B as h,J as x,p as k,l as b}from"./index-d4baa715.js";import{_ as g}from"./uv-navbar.5b015b6c.js";import{_ as j}from"./uv-search.9e74c183.js";import{_ as C}from"./layout.53ff64f8.js";import{h as w,b as S,c as L}from"./product.280a3345.js";import{M as B}from"./index.b68f4c8d.js";import{C as D,D as T,E as I}from"./images.f0a6f614.js";import{_ as V}from"./_plugin-vue_export-helper.1b428a4d.js";import"./uv-status-bar.c500a724.js";/* empty css                                                                      */import"./uv-icon.b5ddbe11.js";import"./uv-icon.vue_vue_type_style_index_0_scoped_23936b10_lang.7145f5b2.js";import"./uv-navbar.vue_vue_type_style_index_0_scoped_4c301e25_lang.553ed1e6.js";/* empty css                                                               */import"./index.dcf9623e.js";const E=V({__name:"search",setup(V){const{push:E,goBack:F,getParams:G}=c();e(),e("");const M=e(""),P=e([]),z=async()=>{P.value=await w(0,10)},A=e([]),H=e(!1),J=async()=>{let e=await S();A.value=e.slice(0,20)},O=e(),R=e(0),U=a((()=>["您确定要清空搜索记录吗？","您确定要删除这一条记录吗？"][R.value]));function W(){[Z][R.value]()}async function Z(){await L(),await J()}const q=e("");function K(e){q.value=e,N()}function N(){if(!q.value&&!M.value)return m({title:"请输入要搜索内容！",duration:2e3,icon:"none"});E({url:"/pages/goodsList/goodsList"},{data:{keyword:q.value||M.value}})}const Q=()=>{};return s((()=>{Promise.all([z(),J()])})),l((e=>{const a=G(e);M.value=a.key})),(e,a)=>{const s=_(y("uv-navbar"),g),l=_(y("uv-search"),j),c=h,m=x,w=k,S=_(y("layout"),C);return t(),o(r,null,[u(S,null,{default:n((()=>[u(s,{fixed:!1,title:"搜索","left-arrow":"",onLeftClick:i(F)},null,8,["onLeftClick"]),u(c,{class:"search-bar"},{default:n((()=>[u(l,{modelValue:q.value,"onUpdate:modelValue":a[0]||(a[0]=e=>q.value=e),shape:"round",placeholder:M.value||"搜索商品",actionText:"搜索","show-action":"",onClear:Q,onCustom:N,onSearch:N,onCancel:Q},null,8,["modelValue","placeholder"])])),_:1}),P.value.length>0?(t(),v(c,{key:0,class:"hotSearchBox tipsBox"},{default:n((()=>[u(c,{class:"boxTitle mar-leftgetList-30"},{default:n((()=>[u(m,null,{default:n((()=>[d("热门搜索")])),_:1}),u(w,{class:"seeIcon hotSearchListSee-icon",src:H.value?i(T):i(D),onClick:a[1]||(a[1]=e=>H.value=!H.value)},null,8,["src"])])),_:1}),H.value?(t(),v(c,{key:1,class:"notSeeContent"},{default:n((()=>[d("当前热门搜索已隐藏 ")])),_:1})):(t(),v(c,{key:0,class:"hot-flex-list"},{default:n((()=>[(t(!0),o(r,null,f(P.value,((e,a)=>(t(),v(c,{key:a,class:"historySearDel-box flex-items-plus"},{default:n((()=>[u(c,{class:"boxContent",onClick:a=>K(e)},{default:n((()=>[d(b(e),1)])),_:2},1032,["onClick"])])),_:2},1024)))),128))])),_:1}))])),_:1})):p("",!0),A.value.length>0?(t(),v(c,{key:1,class:"historyBox tipsBox"},{default:n((()=>[u(c,{class:"boxTitle"},{default:n((()=>[u(m,{class:"title"},{default:n((()=>[d("历史搜索")])),_:1}),u(w,{class:"historyDel-icon",onClick:a[2]||(a[2]=e=>{return a=0,R.value=a,console.log(O.value),void i(O).show();var a}),src:i(I)},null,8,["src"])])),_:1}),u(c,{class:"historySear-box hot-flex-list"},{default:n((()=>[(t(!0),o(r,null,f(A.value,((e,a)=>(t(),v(c,{key:a,class:"historySearDel-box flex-items-plus"},{default:n((()=>[u(c,{class:"boxContent historyText line1",onClick:a=>K(e)},{default:n((()=>[d(b(e),1)])),_:2},1032,["onClick"])])),_:2},1024)))),128))])),_:1})])),_:1})):p("",!0)])),_:1}),u(B,{ref_key:"modalRef",ref:O,content:i(U),onConfirm:W},null,8,["content"])],64)}}},[["__scopeId","data-v-5435b1c3"]]);export{E as default};
