1 line
9.1 KiB
JavaScript
1 line
9.1 KiB
JavaScript
import{I as e,Q as t,R as n,_ as r,b as i,g as a,h as o,l as s,m as c,v as l,wt as u,x as d,xt as f,y as p,yt as m}from"./vue.runtime.esm-bundler-DS0mm12S.js";import{t as ee}from"./Spinner-DJesLX-i.js";import{lt as h,yt as g}from"./index-CttsYBU1.js";import"./Teleport-BYXRojrn.js";import"./button-DQxx5HZh.js";import{d as _,f as v,m as y,p as b,s as te}from"./monisuo-admin.api-Dg8NF95Z.js";import{t as ne}from"./Card-BGPZ9IQg.js";import{t as re}from"./CardContent-3txdLIvu.js";import{r as ie}from"./global-layout-ClhXB0lc.js";import{t as ae}from"./Badge-DhrfBGVq.js";import{t as x}from"./decimal-D-GwDzHI.js";var S={key:0,class:`flex items-center justify-center py-20`},C={key:1,class:`grid gap-6`},w={class:`space-y-3`},T={class:`text-sm font-medium text-muted-foreground flex items-center gap-2`},E={class:`grid gap-3 grid-cols-2 sm:grid-cols-4`},D={class:`flex items-center justify-between mb-2`},O={class:`text-xs text-muted-foreground`},k={class:`text-xs text-muted-foreground truncate`},A={class:`space-y-3`},j={class:`text-sm font-medium text-muted-foreground flex items-center gap-2`},M={class:`grid gap-6 lg:grid-cols-5`},N={class:`space-y-3 lg:col-span-2`},P={class:`text-sm font-medium text-muted-foreground flex items-center gap-2`},F={class:`space-y-3 lg:col-span-3`},I={class:`text-sm font-medium text-muted-foreground flex items-center gap-2`},L={class:`space-y-3`},R={class:`grid gap-3 grid-cols-2 sm:grid-cols-4`},z={class:`text-xs text-muted-foreground truncate`},B={class:`text-lg sm:text-xl font-bold mt-1`},V={class:`grid gap-6 lg:grid-cols-2`},H={class:`space-y-3`},U={class:`text-sm font-medium text-muted-foreground flex items-center gap-2`},W={class:`grid gap-3 grid-cols-2`},oe={class:`flex items-center justify-between mb-2`},G={class:`text-xs font-medium truncate`},K={class:`text-xs text-muted-foreground shrink-0`},q={class:`flex items-baseline gap-2`},se={class:`space-y-3`},ce={class:`text-sm font-medium text-muted-foreground flex items-center gap-2`},le={class:`space-y-3`},ue={class:`flex items-start gap-3`},de={class:`min-w-0`},fe={class:`font-medium text-sm`},pe={class:`text-xs sm:text-sm text-muted-foreground mt-1`},J=d({__name:`analytics`,setup(d){function J(e,t){if(t===0)return e>0?`+100%`:`0%`;let n=new x(e).minus(t).div(t).mul(100).toDecimalPlaces(1);return`${n.gte(0)?`+`:``}${n}%`}let{data:Y,isLoading:me}=_(`month`),he=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:`本月`,icon:`lucide:dollar-sign`,color:`text-orange-600`}]:[]}),{data:X,isLoading:ge}=b(`week`),_e=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:ve}=te(`month`),Z=c(()=>{let e=ve.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}=y(6),ye=c(()=>{let e=Q.value?.data;if(!e)return[];let t=e.trend||[],n=t.length,r=n>=1?t[n-1]:null,i=n>=2?t[n-2]:null,a=r&&i?J(r.newUsers,i.newUsers):`+0%`,o=r&&i?J(r.activeUsers,i.activeUsers):`+0%`,s=n>=2&&r?e.totalUsers-r.newUsers:e.totalUsers,c=J(e.totalUsers,s);return[{label:`新增用户`,value:e.monthNewUsers,change:a,up:!a.startsWith(`-`)},{label:`活跃用户`,value:e.activeUsersToday,change:o,up:!o.startsWith(`-`)},{label:`总用户`,value:e.totalUsers,change:c,up:!c.startsWith(`-`)},{label:`留存率`,value:`-`,change:`-`,up:!0}]}),be=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(),xe=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`}]:[]}),Se=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}),Ce=c(()=>me.value||ge.value);function we(e){return e?e>=1e4?`¥${(e/1e4).toFixed(1)}万`:`¥${e.toLocaleString()}`:`¥0`}return(c,d)=>{let _=ee,v=re,y=ne,b=ae;return e(),a(m(ie),{title:`业务分析`,description:`多维度数据洞察,辅助业务决策`},{default:t(()=>[m(Ce)?(e(),l(`div`,S,[i(_,{class:`w-8 h-8`})])):(e(),l(`div`,C,[o(`section`,w,[o(`h2`,T,[i(m(g),{icon:`lucide:dollar-sign`,class:`size-4`}),d[0]||=p(` 盈利分析 `,-1)]),o(`div`,E,[(e(!0),l(s,null,n(m(he),n=>(e(),a(y,{key:n.label,class:`hover:shadow-sm transition-shadow`},{default:t(()=>[i(v,{class:`p-4`},{default:t(()=>[o(`div`,D,[i(m(g),{icon:n.icon,class:f([`size-4`,n.color])},null,8,[`icon`,`class`]),o(`span`,O,u(n.rate),1)]),o(`p`,k,u(n.label),1),o(`p`,{class:f([`text-lg sm:text-xl font-bold font-mono mt-1 truncate`,n.color])},u(we(n.value)),3)]),_:2},1024)]),_:2},1024))),128))])]),o(`section`,A,[o(`h2`,j,[i(m(g),{icon:`lucide:trending-up`,class:`size-4`}),d[1]||=p(` 交易分析 `,-1)]),i(y,null,{default:t(()=>[i(v,{class:`p-4`},{default:t(()=>[i(m(h),{option:m(_e),autoresize:``,style:{height:`260px`}},null,8,[`option`])]),_:1})]),_:1})]),o(`div`,M,[o(`section`,N,[o(`h2`,P,[i(m(g),{icon:`lucide:pie-chart`,class:`size-4`}),d[2]||=p(` 币种交易分布 `,-1)]),i(y,{class:`h-[calc(100%-2rem)]`},{default:t(()=>[i(v,{class:`p-4`},{default:t(()=>[i(m(h),{option:m(Z),autoresize:``,style:{height:`220px`}},null,8,[`option`])]),_:1})]),_:1})]),o(`section`,F,[o(`h2`,I,[i(m(g),{icon:`lucide:users`,class:`size-4`}),d[3]||=p(` 用户分析 `,-1)]),o(`div`,L,[o(`div`,R,[(e(!0),l(s,null,n(m(ye),n=>(e(),a(y,{key:n.label,class:`hover:shadow-sm transition-shadow`},{default:t(()=>[i(v,{class:`p-4`},{default:t(()=>[o(`p`,z,u(n.label),1),o(`p`,B,u(n.value),1),o(`p`,{class:f([`text-xs mt-1`,n.up?`text-green-600`:`text-red-600`])},u(n.change),3)]),_:2},1024)]),_:2},1024))),128))]),i(y,null,{default:t(()=>[i(v,{class:`p-4`},{default:t(()=>[i(m(h),{option:m(be),autoresize:``,style:{height:`160px`}},null,8,[`option`])]),_:1})]),_:1})])])]),o(`div`,V,[o(`section`,H,[o(`h2`,U,[i(m(g),{icon:`lucide:shield`,class:`size-4`}),d[4]||=p(` 风险指标 `,-1)]),o(`div`,W,[(e(!0),l(s,null,n(m(xe),n=>(e(),a(y,{key:n.label,class:`hover:shadow-sm transition-shadow`},{default:t(()=>[i(v,{class:`p-4`},{default:t(()=>[o(`div`,oe,[o(`p`,G,u(n.label),1),o(`span`,K,u(n.threshold),1)]),o(`div`,q,[o(`p`,{class:f([`text-2xl font-bold truncate`,n.color])},u(n.value),3),n.status===`warning`?(e(),a(b,{key:0,variant:`destructive`,class:`shrink-0`},{default:t(()=>[...d[5]||=[p(` 需关注 `,-1)]]),_:1})):r(``,!0)])]),_:2},1024)]),_:2},1024))),128))])]),o(`section`,se,[o(`h2`,ce,[i(m(g),{icon:`lucide:lightbulb`,class:`size-4`}),d[6]||=p(` 决策建议 `,-1)]),o(`div`,le,[(e(!0),l(s,null,n(m(Se),t=>(e(),l(`div`,{key:t.title,class:f([`p-3 sm:p-4 rounded-lg border-l-4`,t.color])},[o(`div`,ue,[i(m(g),{icon:t.icon,class:`size-4 sm:size-5 mt-0.5 shrink-0`},null,8,[`icon`]),o(`div`,de,[o(`p`,fe,u(t.title),1),o(`p`,pe,u(t.desc),1)])])],2))),128))])])])]))]),_:1})}}});export{J as default}; |