import{c as B}from"./elementPlus.4833989a.js";import T from"./PopoverFilter.c3f0e511.js";import U from"./PopoverFilterParent.19920a1d.js";import{g as j}from"./api.419aab55.js";import{e as s}from"./emitter.bff31cdd.js";import{d as N,r as c,k as O,j as A,A as I,ai as a,o as p,c as h,U as l,O as o,F as M,a8 as $,M as b,a as d,u as D,Q as E,S as x}from"./vue.adf17aba.js";const L={style:{"max-width":"350px"}},Q={class:"flex justify-between"},q=d("div",{class:"pb-3 font-bold text-slate-950 text-base"},"搜索",-1),z={class:"flex justify-end mt-2"},Y=N({__name:"TopFilter",setup(G){const n=c(!1),m=c(""),u=c("请选择推广商品"),r=c(""),v=c([]);s.on("PopoverFilter-sendSearchItem",e=>{e.value.length===1?u.value=e.value[0]:e.value.length===0?u.value="请选择推广商品":e.value.length>1&&(u.value=`${e.value[0]} +${e.value.length-1}`)});async function F(){try{const e=await j();v.value=e.data,r.value=e.data[0].value}catch(e){console.log("error:",e)}}function y(){n.value=!0,s.emit("TopFilter",{isVisible:n,productFilterSelect:r})}function f(){n.value=!1,s.emit("TopFilter",n)}function C(){n.value=!1,s.emit("TopFilter-confirm",{confirm:!0})}const k=O(()=>{switch(r.value){case"pAsin":return U;case"sku":case"asin":return T;default:return null}});return A(()=>{F()}),I(()=>{s.all.clear()}),(e,i)=>{const V=a("el-option"),g=a("el-select"),w=a("el-input"),P=a("el-icon"),_=a("el-button"),S=a("el-popover");return p(),h("div",L,[l(S,{visible:n.value,placement:"bottom-start",width:1200},{reference:o(()=>[l(w,{modelValue:m.value,"onUpdate:modelValue":i[1]||(i[1]=t=>m.value=t),onClick:y,style:{width:"350px"},placeholder:u.value},{prepend:o(()=>[l(g,{modelValue:r.value,"onUpdate:modelValue":i[0]||(i[0]=t=>r.value=t),placeholder:"Select",style:{width:"100px"}},{default:o(()=>[(p(!0),h(M,null,$(v.value,t=>(p(),b(V,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue","placeholder"])]),default:o(()=>[d("div",Q,[q,l(P,{class:"cursor-pointer",onClick:f},{default:o(()=>[l(D(B))]),_:1})]),(p(),b(E(k.value))),d("div",z,[l(_,{onClick:f},{default:o(()=>[x("取消")]),_:1}),l(_,{type:"primary",color:"#3c58af",onClick:C},{default:o(()=>[x("应用")]),_:1})])]),_:1},8,["visible"])])}}});export{Y as _};
