import{c as S}from"./elementPlus.58179425.js";import T from"./PopoverFilter.8cbb8fcc.js";import j from"./PopoverFilterParent.04aac68c.js";import{g as I}from"./api.b9c9f63f.js";import{e as s}from"./emitter.c997c4ad.js";import{d as N,r as c,k as U,j as $,p as E,a8 as a,o as p,c as h,M as l,G as o,F as M,$ as O,E as b,a as d,u as A,I as D,K as x}from"./vue.95e072e2.js";const G={style:{"max-width":"350px"}},K={class:"flex justify-between"},L=d("div",{class:"pb-3 font-bold text-slate-950 text-base"},"搜索",-1),q={class:"flex justify-end mt-2"},Y=N({__name:"TopFilter",setup(z){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 I();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=U(()=>{switch(r.value){case"pAsin":return j;case"sku":case"asin":return T;default:return null}});return $(()=>{F()}),E(()=>{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"),B=a("el-popover");return p(),h("div",G,[l(B,{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,O(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",K,[L,l(P,{class:"cursor-pointer",onClick:f},{default:o(()=>[l(A(S))]),_:1})]),(p(),b(D(k.value))),d("div",q,[l(_,{onClick:f},{default:o(()=>[x("取消")]),_:1}),l(_,{type:"primary",color:"#3c58af",onClick:C},{default:o(()=>[x("应用")]),_:1})])]),_:1},8,["visible"])])}}});export{Y as _};
