import{e as t}from"./operations-Bh9u6U-E.js";import{d as e,e as s,r as l,c as a,f as o,a as r,o as n,j as i,H as d,I as c,q as u,h as v,k as g}from"./index-BeZn6wgH.js";import{_ as x}from"./_plugin-vue_export-helper-BCo6x5W8.js";const m={class:"art-card h-140 p-5 mb-5 max-sm:mb-4"},p={class:"h-[calc(100%-40px)]"},f={class:"h-80 relative"},h={class:"flex items-center"},b={class:"w-8 h-8 rounded-full bg-white bg-opacity-20 flex items-center justify-center mr-3"},y={class:"text-lg"},w={class:"text-sm opacity-80"},_={class:"text-right"},j={class:"text-xl"},F={class:"text-sm opacity-80"},k={class:"mt-4 grid grid-cols-2 gap-4"},I={class:"bg-g-50 p-4 rounded-lg"},q={class:"text-2xl font-bold text-success"},P={class:"text-xs text-g-400 mt-1"},z={class:"bg-g-50 p-4 rounded-lg"},C={class:"text-lg font-bold text-danger"},H={class:"text-xs text-g-400 mt-1"},M=x(e({__name:"order-funnel",setup(e){const x=s([]),M=l(!1),R=a(()=>{var t,e;const s=(null==(t=x[0])?void 0:t.count)||0,l=(null==(e=x[2])?void 0:e.count)||0;return s<=0?0:parseFloat((l/s*100).toFixed(1))}),S=a(()=>{var t,e,s;const l=(null==(t=x[0])?void 0:t.count)||0,a=(null==(e=x[1])?void 0:e.count)||0,o=(null==(s=x[2])?void 0:s.count)||0;if(l<=0||a<0||o<0)return"-";return(l>0?1-a/l:0)>=(a>0?1-o/a:0)?"下单用户":"支付用户"}),$=a(()=>{var t,e,s;const l=(null==(t=x[0])?void 0:t.count)||0,a=(null==(e=x[1])?void 0:e.count)||0,o=(null==(s=x[2])?void 0:s.count)||0,r=l>0?1-a/l:0,n=a>0?1-o/a:0,i=Math.max(r,n);return parseFloat((100*i).toFixed(1))}),A=a(()=>{const t=R.value;return t>=20?"转化表现优秀":t>=15?"转化表现良好":t>=10?"转化表现一般":"需要优化转化流程"}),B=t=>["bg-gradient-to-r from-blue-500 to-blue-400","bg-gradient-to-r from-green-500 to-green-400","bg-gradient-to-r from-yellow-500 to-yellow-400","bg-gradient-to-r from-red-500 to-red-400"][t]||"bg-gradient-to-r from-gray-500 to-gray-400",D=t=>t>=1e4?(t/1e4).toFixed(1)+"w":t>=1e3?(t/1e3).toFixed(1)+"k":t.toString(),E=()=>{return e=this,s=null,l=function*(){M.value=!0;try{const e=yield t("7d");x.splice(0,x.length,...e)}catch(e){}finally{M.value=!1}},new Promise((t,a)=>{var o=t=>{try{n(l.next(t))}catch(e){a(e)}},r=t=>{try{n(l.throw(t))}catch(e){a(e)}},n=e=>e.done?t(e.value):Promise.resolve(e.value).then(o,r);n((l=l.apply(e,s)).next())});var e,s,l};return o(()=>{E()}),(t,e)=>(n(),r("div",m,[e[2]||(e[2]=i("div",{class:"art-card-header"},[i("div",{class:"title"},[i("h4",null,"订单转化漏斗"),i("p",null,"识别支付瓶颈,提升营收转化")])],-1)),i("div",p,[i("div",f,[(n(!0),r(d,null,c(x,(t,e)=>(n(),r("div",{key:t.stage,class:g(["funnel-stage absolute left-0 right-0 flex items-center justify-between px-6 text-white font-medium transition-all duration-300 hover:opacity-90",B(e)]),style:v({top:70*e+"px",height:"60px",zIndex:10-e})},[i("div",h,[i("div",b,u(e+1),1),i("div",null,[i("div",y,u(t.stage),1),i("div",w,u(D(t.count))+"人",1)])]),i("div",_,[i("div",j,u(t.rate)+"%",1),i("div",F,u(e>0?`流失${D(t.lostCount)}人`:"基准"),1)])],6))),128))]),i("div",k,[i("div",I,[e[0]||(e[0]=i("div",{class:"text-g-500 text-sm"},"整体转化率",-1)),i("div",q,u(R.value)+"%",1),i("div",P,u(A.value),1)]),i("div",z,[e[1]||(e[1]=i("div",{class:"text-g-500 text-sm"},"主要流失环节",-1)),i("div",C,u(S.value),1),i("div",H,"流失率: "+u($.value)+"%",1)])])])]))}}),[["__scopeId","data-v-e1a74e9b"]]);export{M as default};