import{t as B,b as A}from"./elementPlus.346c766a.js";import{b as D}from"./api.27ea0e8d.js";import{e as k}from"./emitter.d780df30.js";import{d as T,q as E,r as b,Q as I,p as S,w as q,a9 as h,af as L,H as V,o,E as u,G as d,c as n,a0 as $,A as f,a as p,L as _,K as j,J as m,F as x,I as F,u as g}from"./vue.6daa721c.js";const Q={class:"text-2xl font-bold mb-1.5"},z={class:"font-medium text-2xl mb-1.5"},G={key:0},H=p("span",{class:"mr-2 font-medium",style:{color:"#9ca3af"}},"较上期",-1),J={key:1,class:"font-medium"},U=T({__name:"IndicatorOverview",setup(K){const r=E("filter"),i=b(!1),v=b(null),l=I([{title:"",value:"",compare:"",color:"#edf6fd"},{title:"",value:"",compare:"",color:"#eefdf0"},{title:"",value:"",compare:"",color:"#fff7ed"},{title:"",value:"",compare:"",color:"#f0f0fe"}]),s={imp:{title:"曝光量",key:0,kw:"Impressions"},click:{title:"点击率",key:1,kw:"Clicks"},cart_add:{title:"加购份额",key:2,kw:"Cart_Adds"},purchases:{title:"购买份额",key:3,kw:"Purchases"}};S(()=>{k.all.clear()}),k.on("QueryCondition-sendRequest",()=>{w()}),q(v,t=>{if(t){for(const a in s)if(t[a]){const c=s[a].key;l[c].title=s[a].title,l[c].value=t[a][`${s[a].kw+"_A_B_Share"}`],l[c].compare=t[a][`diff_${s[a].kw+"_A_B_Share"}`]}}else l.forEach(a=>{a.title="暂无数据",a.value="--",a.compare="--"})});async function w(){i.value=!0;const t={date_start:r.value.reportDate[0],date_end:r.value.reportDate[1],layer_type:r.value.layerType,search_term:r.value.searchTerm,report_range:r.value.reportType,[r.value.layerType.split("_")[0]]:r.value.variable};try{const a=await D(t);v.value=a.data}catch(a){console.error("==Error==",a)}finally{i.value=!1}}return(t,a)=>{const c=h("el-icon"),y=h("el-card"),N=L("loading");return V((o(),u(y,{shadow:"hover","body-class":"flex justify-between w-full",style:{border:"none","margin-bottom":"10px"}},{default:d(()=>[(o(!0),n(x,null,$(l,(e,C)=>(o(),u(y,{key:C,"body-class":"flex flex-col items-center",class:"flex-1 mx-1",style:f({background:e.color?`linear-gradient(to top, ${e.color}, transparent)`:"linear-gradient(to top, #fff, transparent)"})},{default:d(()=>[p("div",Q,_(e.title||"暂无数据"),1),p("div",z,[j(_(e.value!==null&&e.value!==void 0&&e.value!==""?e.value:"--")+" ",1),e.value!==null&&e.value!==void 0&&e.value!==""&&e.value!=="--"?(o(),n("span",G,"%")):m("",!0)]),p("div",null,[H,e.compare!=="-"?(o(),n(x,{key:0},[e.compare&&e.compare!=="--"?(o(),u(c,{key:0,color:Number(e.compare)>0?"#59b939":"#e36f53",style:{display:"inline-block","padding-top":"2px"}},{default:d(()=>[(o(),u(F(Number(e.compare)>0?g(B):g(A))))]),_:2},1032,["color"])):m("",!0),p("span",{class:"font-medium",style:f({color:e.compare&&e.compare!=="--"?Number(e.compare)>0?"#59b939":Number(e.compare)<0?"#e36f53":"":""})},_(e.compare!==null&&e.compare!==void 0&&e.compare!==""?e.compare:"--"),5),e.compare&&e.compare!=="--"?(o(),n("span",{key:1,style:f({color:Number(e.compare)>0?"#59b939":Number(e.compare)<0?"#e36f53":""})},"%",4)):m("",!0)],64)):(o(),n("span",J,"无数据"))])]),_:2},1032,["style"]))),128))]),_:1})),[[N,i.value]])}}});export{U as _};
