import{i as F,L as D}from"./echarts.72dc8373.js";import{T as P}from"./index.05a2d588.js";import{g as J}from"./api.3faa3eba.js";import{c as V}from"./dropdowndisable.88660b16.js";import{b}from"./enum.e566fd6e.js";import{u as Q,a as Y}from"./index.ad3efb29.js";import{ay as K,r,j as Z,w as $,k,ai as B,aq as ee,P as ae,o as le,c as te,U as m,O as I,a as f,u as R,D as L}from"./vue.adf17aba.js";import"./_plugin-vue_export-helper.c27b6911.js";import"./elementPlus.4833989a.js";const oe={style:{"margin-left":"45%"}},se=f("span",{style:{background:"#3a83f7",width:"18px",height:"10px","margin-top":"8px",display:"inline-block","border-radius":"3px"}},null,-1),re=f("span",{style:{background:"#f19a37",width:"18px",height:"10px","margin-top":"8px","margin-left":"20px",display:"inline-block","border-radius":"3px"}},null,-1),ne={__name:"adStruct",setup(ie,{expose:M}){const S=Q(),E=Y(),{dateRange:c}=K(E);K(S);let i=r();r();const h=r(),d=r(!0),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 l=r(x[0].value);const O=[{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(O[2].value);Z(async()=>{i=F(h.value),window.addEventListener("resize",v),setTimeout(()=>{v()},0),await q(),H()});let g=null;async function y(){return g=await J({startDate:c.value[0],endDate:c.value[1],profileId:S.profile.profile_id}),g.data}let n=null,T=null,A,C,w,_;async function q(){T=await y(),n=T,A=n.map(e=>e.ACOS),C=n.map(e=>e.Spend),w=n.map(e=>e.matchType);const a={BROAD:"关键词-广泛",category:"品类",EXACT:"关键词-精准",asin:"商品",PHRASE:"关键词-词组","close-match":"紧密匹配","loose-match":"广泛匹配",substitutes:"同类商品",complements:"关联商品"};_=w.map(e=>a[e]),d.value=!1}r();let o;function z(a){l.value=a,U()}function G(a){t.value=a,U()}function U(){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)}$(c,async()=>{if(c.value){d.value=!0;const a=await y();N(a),d.value=!1}});function N(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 W=k(()=>V(x,t.value,l.value)),j=k(()=>V(O,l.value,t.value));function H(){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:_}],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:A,yAxisIndex:0,itemStyle:{color:new D(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:C,yAxisIndex:1,itemStyle:{color:new D(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 M({resizeChart:v}),(a,e)=>{const s=B("el-col"),u=B("el-row"),X=ee("loading");return ae((le(),te("div",null,[m(u,{gutter:5},{default:I(()=>[m(s,{span:24},{default:I(()=>[f("div",oe,[se,m(P,{modelValue:R(l),"onUpdate:modelValue":e[0]||(e[0]=p=>L(l)?l.value=p:l=p),options:W.value,onChange:z,style:{"margin-top":"5px","margin-left":"8px"}},null,8,["modelValue","options"]),re,m(P,{modelValue:R(t),"onUpdate:modelValue":e[1]||(e[1]=p=>L(t)?t.value=p:t=p),options:j.value,onChange:G,style:{"margin-top":"5px","margin-left":"8px"}},null,8,["modelValue","options"])]),f("div",{ref_key:"bar",ref:h,style:{height:"400px"}},null,512)]),_:1})]),_:1})])),[[X,d.value]])}}},he=ne;export{he as default};
