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