import{t as C,b as T}from"./elementPlus.4833989a.js";import{b as A}from"./api.3f733443.js";import{e as k}from"./emitter.bff31cdd.js";import{d as D,B as S,r as b,Z as q,A as E,w as I,ai as h,aq as V,P as $,o,M as u,O as d,c as n,a8 as j,J as f,a as p,T as _,S as F,R as m,F as x,Q as L,u as g}from"./vue.adf17aba.js";const M={class:"text-2xl font-bold mb-1.5"},O={class:"font-medium text-2xl mb-1.5"},P={key:0},Q=p("span",{class:"mr-2 font-medium",style:{color:"#9ca3af"}},"较上期",-1),R={key:1,class:"font-medium"},H=D({__name:"IndicatorOverview",setup(z){const r=S("filter"),i=b(!1),v=b(null),l=q([{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"}};E(()=>{k.all.clear()}),k.on("QueryCondition-sendRequest",()=>{w()}),I(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.value[0],date_end:r.value.reportDate.value[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 A(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=V("loading");return $((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,j(l,(e,B)=>(o(),u(y,{key:B,"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",M,_(e.title||"暂无数据"),1),p("div",O,[F(_(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",P,"%")):m("",!0)]),p("div",null,[Q,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(L(Number(e.compare)>0?g(C):g(T))))]),_: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",R,"无数据"))])]),_:2},1032,["style"]))),128))]),_:1})),[[N,i.value]])}}});export{H as _};
