import{Ct as e,Ot as t,S as n,Tt as r,V as i,_ as a,b as o,d as s,g as c,nt as l,v as u,w as d,x as f,y as ee,z as p}from"./vue.runtime.esm-bundler-DQjudA8G.js";import{t as te}from"./Spinner-BbvbfTgK.js";import{W as m}from"./index-CcML0o3b.js";import"./Teleport-CLYBkdRb.js";import"./Button-2mdP_ygs.js";import{c as h,d as g,i as _,l as v,u as ne}from"./monisuo-admin.api-BMEy8kfy.js";import{t as y}from"./iconify-B5QdRg7l.js";import{r as re}from"./global-layout-BuXj6D-T.js";import{t as ie}from"./Card-Cv6HQPiQ.js";import{t as b}from"./CardContent-cvoMlP3H.js";import{t as x}from"./Badge-Df1MwAP1.js";var S={key:0,class:`flex items-center justify-center py-20`},C={key:1,class:`space-y-6`},w={class:`text-sm font-medium text-muted-foreground mb-3 flex items-center gap-2`},T={class:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`},E={class:`flex items-center justify-between mb-3`},D={class:`text-xs text-muted-foreground`},O={class:`text-xs text-muted-foreground`},k={class:`text-sm font-medium text-muted-foreground mb-3 flex items-center gap-2`},A={class:`grid gap-4 lg:grid-cols-3`},j={class:`text-sm font-medium text-muted-foreground mb-3 flex items-center gap-2`},M={class:`lg:col-span-2`},N={class:`text-sm font-medium text-muted-foreground mb-3 flex items-center gap-2`},P={class:`grid gap-4`},F={class:`grid gap-3 sm:grid-cols-4`},I={class:`text-xs text-muted-foreground`},L={class:`text-xl font-bold mt-1`},R={class:`grid gap-4 lg:grid-cols-2`},z={class:`text-sm font-medium text-muted-foreground mb-3 flex items-center gap-2`},ae={class:`grid gap-3 sm:grid-cols-2`},B={class:`flex items-center justify-between mb-2`},V={class:`text-sm font-medium`},H={class:`text-xs text-muted-foreground`},U={class:`flex items-baseline gap-2`},W={class:`text-sm font-medium text-muted-foreground mb-3 flex items-center gap-2`},G={class:`space-y-3`},K={class:`flex items-start gap-3`},q={class:`font-medium`},J={class:`text-sm text-muted-foreground mt-1`},Y=d({__name:`analytics`,setup(d){let{data:Y,isLoading:oe}=h(`month`),se=c(()=>{let e=Y.value?.data;return e?[{label:`交易手续费`,value:e.tradeFee,rate:e.tradeFeeRate,icon:`lucide:percent`,color:`text-green-600`},{label:`充提手续费`,value:e.fundFee,rate:e.fundFeeRate,icon:`lucide:credit-card`,color:`text-blue-600`},{label:`资金利差`,value:e.interestProfit,rate:e.interestRate,icon:`lucide:trending-up`,color:`text-purple-600`},{label:`本月收益`,value:e.totalProfit,rate:`+18.5%`,icon:`lucide:dollar-sign`,color:`text-orange-600`}]:[]}),{data:X,isLoading:ce}=ne(`week`),Z=c(()=>{let e=X.value?.data?.trend||[];return{tooltip:{trigger:`axis`},legend:{data:[`买入`,`卖出`],bottom:0},grid:{left:`3%`,right:`4%`,bottom:`15%`,top:`5%`,containLabel:!0},xAxis:{type:`category`,data:e.map(e=>e.date)},yAxis:{type:`value`},series:[{name:`买入`,type:`line`,smooth:!0,data:e.map(e=>e.buy),itemStyle:{color:`#10b981`}},{name:`卖出`,type:`line`,smooth:!0,data:e.map(e=>e.sell),itemStyle:{color:`#ef4444`}}]}}),{data:le}=_(`month`),ue=c(()=>{let e=le.value?.data||[],t=[`#f7931a`,`#627eea`,`#26a17b`,`#9ca3af`];return{tooltip:{trigger:`item`,formatter:`{b}: {d}%`},legend:{orient:`vertical`,right:`5%`,top:`center`},series:[{type:`pie`,radius:[`50%`,`75%`],center:[`35%`,`50%`],itemStyle:{borderRadius:8,borderColor:`#fff`,borderWidth:2},label:{show:!0,position:`inside`,formatter:`{d}%`,fontSize:11},data:e.map((e,n)=>({value:e.amount,name:e.coinCode,itemStyle:{color:t[n%t.length]}}))}]}}),{data:Q}=g(6),de=c(()=>{let e=Q.value?.data;return e?[{label:`新增用户`,value:e.monthNewUsers,change:`+15.3%`,up:!0},{label:`活跃用户`,value:e.activeUsersToday,change:`+8.7%`,up:!0},{label:`总用户`,value:e.totalUsers,change:`+12.1%`,up:!0},{label:`留存率`,value:`68%`,change:`+5.2%`,up:!0}]:[]}),fe=c(()=>{let e=Q.value?.data?.trend||[];return{tooltip:{trigger:`axis`},legend:{data:[`新增`,`活跃`],bottom:0},grid:{left:`3%`,right:`4%`,bottom:`15%`,top:`5%`,containLabel:!0},xAxis:{type:`category`,boundaryGap:!1,data:e.map(e=>e.month)},yAxis:{type:`value`},series:[{name:`新增`,type:`line`,smooth:!0,data:e.map(e=>e.newUsers),itemStyle:{color:`#8b5cf6`},areaStyle:{color:`rgba(139, 92, 246, 0.1)`}},{name:`活跃`,type:`line`,smooth:!0,data:e.map(e=>e.activeUsers),itemStyle:{color:`#06b6d4`},areaStyle:{color:`rgba(6, 182, 212, 0.1)`}}]}}),{data:$}=v(),pe=c(()=>{let e=$.value?.data;return e?[{label:`大额交易`,value:e.largeTransactions,threshold:e.largeTransactionThreshold,status:`normal`,color:`text-blue-600`,bgColor:`bg-blue-50`},{label:`异常提现`,value:e.abnormalWithdrawals,threshold:e.abnormalWithdrawalThreshold,status:e.abnormalWithdrawals>0?`warning`:`normal`,color:`text-red-600`,bgColor:`bg-red-50`},{label:`待审KYC`,value:e.pendingKyc,threshold:`身份验证`,status:`normal`,color:`text-yellow-600`,bgColor:`bg-yellow-50`},{label:`冻结账户`,value:e.frozenAccounts,threshold:`风险账户`,status:`normal`,color:`text-gray-600`,bgColor:`bg-gray-50`}]:[]}),me=c(()=>{let e=Y.value?.data,t=$.value?.data,n=[];return e&&e.totalProfit>0&&n.push({type:`success`,icon:`lucide:check-circle`,title:`盈利健康`,desc:`本月总收益 ¥${e.totalProfit.toFixed(2)},收益趋势良好`,color:`border-green-500 bg-green-50 dark:bg-green-950/20`}),t&&t.abnormalWithdrawals>0&&n.push({type:`warning`,icon:`lucide:alert-circle`,title:`关注风险`,desc:`检测到 ${t.abnormalWithdrawals} 笔异常提现申请,建议加强风控审核`,color:`border-yellow-500 bg-yellow-50 dark:bg-yellow-950/20`}),X.value?.data&&n.push({type:`info`,icon:`lucide:info`,title:`交易分析`,desc:`本周交易活跃,用户参与度良好`,color:`border-blue-500 bg-blue-50 dark:bg-blue-950/20`}),n}),he=c(()=>oe.value||ce.value);function ge(e){return e?e>=1e4?`¥${(e/1e4).toFixed(1)}万`:`¥${e.toLocaleString()}`:`¥0`}return(c,d)=>{let h=te,g=b,_=ie,v=x;return p(),u(e(re),{title:`业务分析`,description:`多维度数据洞察,辅助业务决策`},{default:l(()=>[e(he)?(p(),o(`div`,S,[n(h,{class:`w-8 h-8`})])):(p(),o(`div`,C,[a(`section`,null,[a(`h2`,w,[n(e(y),{icon:`lucide:dollar-sign`,class:`size-4`}),d[0]||=f(` 盈利分析 `,-1)]),a(`div`,T,[(p(!0),o(s,null,i(e(se),i=>(p(),u(_,{key:i.label,class:`hover:shadow-sm transition-shadow`},{default:l(()=>[n(g,{class:`pt-6`},{default:l(()=>[a(`div`,E,[n(e(y),{icon:i.icon,class:r([`size-5`,i.color])},null,8,[`icon`,`class`]),a(`span`,D,t(i.rate),1)]),a(`p`,O,t(i.label),1),a(`p`,{class:r([`text-2xl font-bold font-mono mt-1`,i.color])},t(ge(i.value)),3)]),_:2},1024)]),_:2},1024))),128))])]),a(`section`,null,[a(`h2`,k,[n(e(y),{icon:`lucide:trending-up`,class:`size-4`}),d[1]||=f(` 交易分析 `,-1)]),n(_,null,{default:l(()=>[n(g,{class:`pt-6`},{default:l(()=>[n(e(m),{option:e(Z),autoresize:``,style:{height:`280px`}},null,8,[`option`])]),_:1})]),_:1})]),a(`div`,A,[a(`section`,null,[a(`h2`,j,[n(e(y),{icon:`lucide:pie-chart`,class:`size-4`}),d[2]||=f(` 币种交易分布 `,-1)]),n(_,null,{default:l(()=>[n(g,{class:`pt-6`},{default:l(()=>[n(e(m),{option:e(ue),autoresize:``,style:{height:`240px`}},null,8,[`option`])]),_:1})]),_:1})]),a(`section`,M,[a(`h2`,N,[n(e(y),{icon:`lucide:users`,class:`size-4`}),d[3]||=f(` 用户分析 `,-1)]),a(`div`,P,[a(`div`,F,[(p(!0),o(s,null,i(e(de),e=>(p(),u(_,{key:e.label,class:`hover:shadow-sm transition-shadow`},{default:l(()=>[n(g,{class:`pt-4 pb-4`},{default:l(()=>[a(`p`,I,t(e.label),1),a(`p`,L,t(e.value),1),a(`p`,{class:r([`text-xs mt-1`,e.up?`text-green-600`:`text-red-600`])},t(e.change),3)]),_:2},1024)]),_:2},1024))),128))]),n(_,null,{default:l(()=>[n(g,{class:`pt-6`},{default:l(()=>[n(e(m),{option:e(fe),autoresize:``,style:{height:`180px`}},null,8,[`option`])]),_:1})]),_:1})])])]),a(`div`,R,[a(`section`,null,[a(`h2`,z,[n(e(y),{icon:`lucide:shield`,class:`size-4`}),d[4]||=f(` 风险指标 `,-1)]),a(`div`,ae,[(p(!0),o(s,null,i(e(pe),e=>(p(),u(_,{key:e.label,class:`hover:shadow-sm transition-shadow`},{default:l(()=>[n(g,{class:`pt-6`},{default:l(()=>[a(`div`,B,[a(`p`,V,t(e.label),1),a(`span`,H,t(e.threshold),1)]),a(`div`,U,[a(`p`,{class:r([`text-3xl font-bold`,e.color])},t(e.value),3),e.status===`warning`?(p(),u(v,{key:0,variant:`destructive`},{default:l(()=>[...d[5]||=[f(`需关注`,-1)]]),_:1})):ee(``,!0)])]),_:2},1024)]),_:2},1024))),128))])]),a(`section`,null,[a(`h2`,W,[n(e(y),{icon:`lucide:lightbulb`,class:`size-4`}),d[6]||=f(` 决策建议 `,-1)]),a(`div`,G,[(p(!0),o(s,null,i(e(me),i=>(p(),o(`div`,{key:i.title,class:r([`p-4 rounded-lg border-l-4`,i.color])},[a(`div`,K,[n(e(y),{icon:i.icon,class:`size-5 mt-0.5`},null,8,[`icon`]),a(`div`,null,[a(`p`,q,t(i.title),1),a(`p`,J,t(i.desc),1)])])],2))),128))])])])]))]),_:1})}}});export{Y as default};