import{i as H,L as U}from"./echarts.72dc8373.js";import{c as D}from"./dropdowndisable.88660b16.js";import{T as V}from"./index.05a2d588.js";import{u as X}from"./index.ad3efb29.js";import{g as F}from"./api.0c2b52c8.js";import{b}from"./enum.e566fd6e.js";import{r,B as J,j as Q,w as Y,k as P,ai as B,aq as Z,P as $,o as ee,c as ae,U as m,O as K,a as f,u as k,D as I}from"./vue.adf17aba.js";import"./_plugin-vue_export-helper.c27b6911.js";import"./elementPlus.4833989a.js";const le={style:{"margin-left":"45%"}},te=f("span",{style:{background:"#3a83f7",width:"18px",height:"10px","margin-top":"8px",display:"inline-block","border-radius":"3px"}},null,-1),oe=f("span",{style:{background:"#f19a37",width:"18px",height:"10px","margin-top":"8px","margin-left":"20px",display:"inline-block","border-radius":"3px"}},null,-1),se={__name:"adStruct",setup(re,{expose:R}){const L=X();let i=r();r();const S=r(),d=r(!0),c=J("dateRange"),h=[{value:"ACOS",label:"ACOS"},{value:"ROAS",label:"ROAS"},{value:"Spend",label:"花费",units:"$"},{value:"TotalSales",label:"销售额"},{value:"TotalPurchases",label:"订单数"},{value:"TotalUnitOrdered",label:"销量"},{value:"CPC",label:"点击成本"},{value:"CPA",label:"订单成本"},{value:"Impression",label:"曝光量"},{value:"Click",label:"点击量"},{value:"qwe",label:"点击率"},{value:"转化率",label:"转化率"},{value:"TotalSalesSameSKU",label:"推广商品销售额"},{value:"TotalSalesOtherSKU",label:"其他商品销售额"},{value:"TotalPurchasesSameSKU",label:"推广商品订单数"},{value:"TotalPurchasesOtherSKU",label:"其他商品订单数"},{value:"TotalUnitOrderedSameSKU",label:"推广商品销量"},{value:"TotalUnitOrderedOtherSKU",label:"其他商品销量"},{value:"TopOfSearchImpressionShare",label:"搜索结果顶部展示份额"}];let l=r(h[0].value);const x=[{value:"ACOS",label:"ACOS"},{value:"ROAS",label:"ROAS"},{value:"Spend",label:"花费",units:"$"},{value:"TotalSales",label:"销售额"},{value:"TotalPurchases",label:"订单数"},{value:"TotalUnitOrdered",label:"销量"},{value:"CPC",label:"点击成本"},{value:"CPA",label:"订单成本"},{value:"Impression",label:"曝光量"},{value:"Click",label:"点击量"},{value:"qwe",label:"点击率"},{value:"转化率",label:"转化率"},{value:"TotalSalesSameSKU",label:"推广商品销售额"},{value:"TotalSalesOtherSKU",label:"其他商品销售额"},{value:"TotalPurchasesSameSKU",label:"推广商品订单数"},{value:"TotalPurchasesOtherSKU",label:"其他商品订单数"},{value:"TotalUnitOrderedSameSKU",label:"推广商品销量"},{value:"TotalUnitOrderedOtherSKU",label:"其他商品销量"},{value:"TopOfSearchImpressionShare",label:"搜索结果顶部展示份额"}];let t=r(x[2].value);Q(async()=>{i=H(S.value),window.addEventListener("resize",v),setTimeout(()=>{v()},0),await M(),N()});let O=null;async function g(){return O=await F({startDate:c.value[0],endDate:c.value[1],profileId:L.profile.profile_id}),O.data}let n=null,y=null,C,A,T,w;async function M(){y=await g(),n=y,C=n.map(e=>e.ACOS),A=n.map(e=>e.Spend),T=n.map(e=>e.Classification);const a={BROAD:"关键词-广泛",category:"品类",EXACT:"关键词-精准",asin:"商品",PHRASE:"关键词-词组","close-match":"紧密匹配","loose-match":"广泛匹配",substitutes:"同类商品",complements:"关联商品"};w=T.map(e=>a[e]),d.value=!1}r();let o;function E(a){l.value=a,_()}function q(a){t.value=a,_()}function _(){const a=n.map(s=>s[l.value]),e=n.map(s=>s[t.value]);o.series[0].data=a,o.series[1].data=e,o.series[0].name=b[l.value]||l.value,o.series[1].name=b[t.value]||t.value,i.setOption(o)}Y(c,async()=>{if(c.value){d.value=!0;const a=await g();z(a),d.value=!1}});function z(a){const e=a.map(u=>u[l.value]),s=a.map(u=>u[t.value]);o.series[0].data=e,o.series[1].data=s,i.setOption(o)}const j=P(()=>D(h,t.value,l.value)),G=P(()=>D(x,l.value,t.value));function N(){o={tooltip:{trigger:"axis",axisPointer:{type:"shadow",label:{backgroundColor:"#6a7985"}}},toolbox:{feature:{saveAsImage:{yAxisIndex:"none"}}},grid:{top:50,right:60,bottom:50,left:60},xAxis:[{type:"category",boundaryGap:!0,data:w}],yAxis:[{type:"value",axisLine:{show:!0,lineStyle:{color:"#3a83f7"}}},{type:"value",splitLine:{show:!1},axisLine:{show:!0,lineStyle:{color:"#f19a37"}}}],series:[{name:b[l.value],type:"bar",barWidth:"3%",data:C,yAxisIndex:0,itemStyle:{color:new U(0,0,0,1,[{offset:0,color:"#3a83f7"},{offset:1,color:"rgb(111, 209, 206)"}]),borderRadius:[6,6,6,6]}},{name:b[t.value],type:"bar",barWidth:"3%",data:A,yAxisIndex:1,itemStyle:{color:new U(0,0,0,1,[{offset:0,color:"#f19a37"},{offset:1,color:"rgb(234,207,135)"}]),borderRadius:[6,6,6,6]}}]},i.setOption(o),v()}function v(){i.resize()}return R({resizeChart:v}),(a,e)=>{const s=B("el-col"),u=B("el-row"),W=Z("loading");return $((ee(),ae("div",null,[m(u,{gutter:5},{default:K(()=>[m(s,{span:24},{default:K(()=>[f("div",le,[te,m(V,{modelValue:k(l),"onUpdate:modelValue":e[0]||(e[0]=p=>I(l)?l.value=p:l=p),options:j.value,onChange:E,style:{"margin-top":"5px","margin-left":"8px"}},null,8,["modelValue","options"]),oe,m(V,{modelValue:k(t),"onUpdate:modelValue":e[1]||(e[1]=p=>I(t)?t.value=p:t=p),options:G.value,onChange:q,style:{"margin-top":"5px","margin-left":"8px"}},null,8,["modelValue","options"])]),f("div",{ref_key:"bar",ref:S,style:{height:"400px"}},null,512)]),_:1})]),_:1})])),[[W,d.value]])}}},fe=se;export{fe as default};
