1 line
8.8 KiB
JavaScript
1 line
8.8 KiB
JavaScript
import{At as e,C as t,D as n,Dt as r,E as i,H as a,S as o,T as s,Tt as c,W as l,a as u,b as d,h as f,it as p,kt as m,w as h,x as g}from"./iconify-DYZHDLa8.js";import"./vue-vendor-DjtlKxRy.js";import{q as ee,z as _}from"./index-Uji7rFqr.js";import"./Teleport-BIYegdAM.js";import"./button-BuRmTYve.js";import{_ as v,f as y,h as b,l as te,u as ne}from"./monisuo-admin.api-dPrln-7F.js";import{r as re}from"./global-layout-BGXP2p6j.js";import{t as ie}from"./Badge-RIbvVUq1.js";var ae={key:0,class:`flex items-center justify-center py-20`},x={key:1,class:`space-y-6`},S={class:`grid gap-3 grid-cols-2 sm:grid-cols-4`},C={class:`flex items-center justify-between`},w={class:`text-xs text-muted-foreground font-medium`},T={class:`text-[11px] text-muted-foreground truncate`},E={key:1},D={class:`rounded-lg border`},O={class:`px-4 pt-3 pb-1 border-b`},k={class:`text-sm font-semibold flex items-center gap-2`},A={class:`p-4`},j={class:`grid gap-4 lg:grid-cols-5`},M={class:`lg:col-span-3 rounded-lg border`},N={class:`px-4 pt-3 pb-1 border-b`},P={class:`text-sm font-semibold flex items-center gap-2`},F={class:`p-4`},I={key:0,class:`px-4 pb-3 border-t`},L={class:`grid grid-cols-3 gap-2 pt-2 text-xs text-center`},R={class:`text-muted-foreground`},z={class:`font-mono font-bold text-sm`},B={class:`text-muted-foreground`},V={class:`lg:col-span-2 space-y-4`},H={class:`rounded-lg border`},U={class:`px-4 pt-3 pb-1 border-b`},oe={class:`text-sm font-semibold flex items-center gap-2`},W={class:`p-3 space-y-2`},G={class:`font-medium w-12`},K={class:`flex-1 h-4 bg-muted/50 rounded-full overflow-hidden`},q={class:`font-mono text-xs w-16 text-right`},se={key:0,class:`text-xs text-muted-foreground text-center py-3`},ce={class:`rounded-lg border`},le={class:`px-4 pt-3 pb-1 border-b`},ue={class:`text-sm font-semibold flex items-center gap-2`},de={class:`divide-y`},fe={class:`text-sm font-medium`},pe={class:`text-[11px] text-muted-foreground ml-2`},me={class:`flex items-center gap-2`},he={class:`font-mono font-bold text-sm`},J=n({__name:`analytics`,setup(n){function J(e){return e?e>=1e4?`${(e/1e4).toFixed(2)}万`:e.toLocaleString(`zh-CN`,{minimumFractionDigits:2,maximumFractionDigits:2}):`0.00`}function Y(e,t){if(!t)return{text:e>0?`+∞`:`0%`,up:e>0};let n=((e-t)/t*100).toFixed(1);return{text:`${Number(n)>=0?`+`:``}${n}%`,up:Number(n)>=0}}let{data:ge,isLoading:_e}=y(),ve=d(()=>ge.value?.data),ye=d(()=>{let e=ve.value;if(!e)return[];let t=Y(e.monthlyDeposit,e.lastMonthDeposit),n=Y(e.monthlyWithdraw,e.lastMonthWithdraw);return[{label:`平台总资产`,value:J(e.totalUserAssets),sub:`资金 ${J(e.fundBalance)} | 持仓 ${J(e.tradeValue)}`,icon:`lucide:wallet`,color:`text-blue-600`,bgColor:`bg-blue-50 dark:bg-blue-950/20`},{label:`净资金流入`,value:J(e.netCapitalInflow),sub:`累计充值 ${J(e.grossDeposit)}`,icon:`lucide:arrow-down-to-line`,color:e.netCapitalInflow>=0?`text-green-600`:`text-red-600`,bgColor:e.netCapitalInflow>=0?`bg-green-50 dark:bg-green-950/20`:`bg-red-50 dark:bg-red-950/20`},{label:`本月充值`,value:J(e.monthlyDeposit),sub:t.text,subUp:t.up,icon:`lucide:trending-up`,color:`text-green-600`,bgColor:`bg-green-50 dark:bg-green-950/20`},{label:`本月提现`,value:J(e.monthlyWithdraw),sub:n.text,subUp:n.up,icon:`lucide:trending-down`,color:`text-orange-600`,bgColor:`bg-orange-50 dark:bg-orange-950/20`},{label:`手续费收入`,value:J(e.totalFeeRevenue),sub:`福利支出 ${J(e.totalBonusDisbursed)}`,icon:`lucide:percent`,color:`text-purple-600`,bgColor:`bg-purple-50 dark:bg-purple-950/20`},{label:`待处理`,value:e.pendingCount,sub:`充值 ${J(e.pendingDeposit)} | 提现 ${J(e.pendingWithdrawal)}`,icon:`lucide:clock`,color:`text-yellow-600`,bgColor:`bg-yellow-50 dark:bg-yellow-950/20`},{label:`用户总数`,value:e.userCount,sub:`本月新增 ${e.monthNewUsers}`,icon:`lucide:users`,color:`text-cyan-600`,bgColor:`bg-cyan-50 dark:bg-cyan-950/20`},{label:`今日活跃`,value:e.todayActiveUsers,sub:`冻结 ${e.totalFrozen}`,icon:`lucide:activity`,color:`text-indigo-600`,bgColor:`bg-indigo-50 dark:bg-indigo-950/20`}]}),{data:be}=te(6),xe=d(()=>{let e=be.value?.data||[];return{tooltip:{trigger:`axis`,axisPointer:{type:`shadow`}},legend:{data:[`充值`,`提现`,`净流入`],bottom:0,textStyle:{fontSize:11}},grid:{left:`3%`,right:`4%`,bottom:`14%`,top:`8%`,containLabel:!0},xAxis:{type:`category`,data:e.map(e=>e.month),axisLabel:{fontSize:11}},yAxis:{type:`value`,axisLabel:{fontSize:11}},series:[{name:`充值`,type:`bar`,stack:`flow`,data:e.map(e=>e.deposit),itemStyle:{color:`#10b981`,borderRadius:[0,0,0,0]}},{name:`提现`,type:`bar`,stack:`flow2`,data:e.map(e=>e.withdraw),itemStyle:{color:`#ef4444`,borderRadius:[0,0,0,0]}},{name:`净流入`,type:`line`,data:e.map(e=>e.netInflow),smooth:!0,lineStyle:{width:2},itemStyle:{color:`#6366f1`},symbol:`circle`,symbolSize:6}]}}),{data:X}=v(`week`),Se=d(()=>{let e=X.value?.data?.trend||[];return{tooltip:{trigger:`axis`},legend:{data:[`买入`,`卖出`],bottom:0,textStyle:{fontSize:11}},grid:{left:`3%`,right:`4%`,bottom:`14%`,top:`8%`,containLabel:!0},xAxis:{type:`category`,data:e.map(e=>e.date?.slice(5)),axisLabel:{fontSize:11}},yAxis:{type:`value`,axisLabel:{fontSize:11}},series:[{name:`买入`,type:`bar`,data:e.map(e=>e.buy),itemStyle:{color:`#10b981`,borderRadius:[3,3,0,0]}},{name:`卖出`,type:`bar`,data:e.map(e=>e.sell),itemStyle:{color:`#ef4444`,borderRadius:[3,3,0,0]}}]}}),Z=d(()=>{let e=X.value?.data;return e?[{label:`买入金额`,value:J(e.buyAmount),count:e.buyCount},{label:`卖出金额`,value:J(e.sellAmount),count:e.sellCount},{label:`净买入`,value:J(e.netBuy),count:e.buyCount+e.sellCount}]:null}),{data:Ce}=ne(`month`),Q=d(()=>(Ce.value?.data||[]).slice(0,6)),$=d(()=>Q.value.reduce((e,t)=>e+(t.amount||0),0)),{data:we}=b(),Te=d(()=>{let e=we.value?.data;return e?[{label:`大额交易`,value:e.largeTransactions,desc:e.largeTransactionThreshold,level:e.largeTransactions>0?`warn`:`ok`},{label:`异常提现`,value:e.abnormalWithdrawals,desc:e.abnormalWithdrawalThreshold,level:e.abnormalWithdrawals>0?`danger`:`ok`},{label:`待激活用户`,value:e.pendingKyc,desc:`未完成身份验证`,level:e.pendingKyc>10?`warn`:`ok`},{label:`冻结账户`,value:e.frozenAccounts,desc:`已禁用账户`,level:`ok`}]:[]}),Ee=d(()=>_e.value);return(n,d)=>{let v=ee,y=ie;return a(),o(c(re),{title:`业务分析`,description:`核心运营数据一览`},{default:p(()=>[c(Ee)?(a(),h(`div`,ae,[i(v,{class:`w-8 h-8`})])):(a(),h(`div`,x,[g(`div`,S,[(a(!0),h(f,null,l(c(ye),t=>(a(),h(`div`,{key:t.label,class:r([`rounded-lg border p-3 space-y-1`,t.bgColor])},[g(`div`,C,[g(`span`,w,e(t.label),1),i(c(u),{icon:t.icon,class:`size-3.5 opacity-50`},null,8,[`icon`])]),g(`p`,{class:r([`text-lg sm:text-xl font-bold font-mono truncate`,t.color])},e(t.value),3),g(`p`,T,[t.subUp===void 0?(a(),h(`span`,E,e(t.sub),1)):(a(),h(`span`,{key:0,class:r([`font-medium`,t.subUp?`text-green-600`:`text-red-600`])},e(t.sub),3))])],2))),128))]),g(`section`,D,[g(`div`,O,[g(`h3`,k,[i(c(u),{icon:`lucide:bar-chart-3`,class:`size-4 text-blue-600`}),d[0]||=s(` 资金流向(近6个月) `,-1)])]),g(`div`,A,[i(c(_),{option:c(xe),autoresize:``,style:{height:`280px`}},null,8,[`option`])])]),g(`div`,j,[g(`section`,M,[g(`div`,N,[g(`h3`,P,[i(c(u),{icon:`lucide:candlestick-chart`,class:`size-4 text-green-600`}),d[1]||=s(` 交易活跃度(近7日) `,-1)])]),g(`div`,F,[i(c(_),{option:c(Se),autoresize:``,style:{height:`240px`}},null,8,[`option`])]),c(Z)?(a(),h(`div`,I,[g(`div`,L,[(a(!0),h(f,null,l(c(Z),t=>(a(),h(`div`,{key:t.label},[g(`div`,R,e(t.label),1),g(`div`,z,e(t.value),1),g(`div`,B,e(t.count)+`笔`,1)]))),128))])])):t(``,!0)]),g(`div`,V,[g(`section`,H,[g(`div`,U,[g(`h3`,oe,[i(c(u),{icon:`lucide:trophy`,class:`size-4 text-amber-600`}),d[2]||=s(` 币种交易排行 `,-1)])]),g(`div`,W,[(a(!0),h(f,null,l(c(Q),(t,n)=>(a(),h(`div`,{key:t.coinCode,class:`flex items-center gap-2 text-sm`},[g(`span`,{class:r([`w-5 text-center font-bold text-xs`,n<3?`text-amber-600`:`text-muted-foreground`])},e(n+1),3),g(`span`,G,e(t.coinCode),1),g(`div`,K,[g(`div`,{class:r([`h-full rounded-full transition-all`,n===0?`bg-amber-500`:n===1?`bg-amber-400`:n===2?`bg-amber-300`:`bg-muted-foreground/30`]),style:m({width:`${c($)>0?t.amount/c($)*100:0}%`})},null,6)]),g(`span`,q,e(J(t.amount)),1)]))),128)),c(Q).length===0?(a(),h(`div`,se,`暂无交易数据`)):t(``,!0)])]),g(`section`,ce,[g(`div`,le,[g(`h3`,ue,[i(c(u),{icon:`lucide:shield-alert`,class:`size-4 text-red-600`}),d[3]||=s(` 风控监控 `,-1)])]),g(`div`,de,[(a(!0),h(f,null,l(c(Te),n=>(a(),h(`div`,{key:n.label,class:`flex items-center justify-between px-4 py-2.5`},[g(`div`,null,[g(`span`,fe,e(n.label),1),g(`span`,pe,e(n.desc),1)]),g(`div`,me,[g(`span`,he,e(n.value),1),n.level===`danger`?(a(),o(y,{key:0,variant:`destructive`,class:`text-[10px] px-1.5`},{default:p(()=>[...d[4]||=[s(`异常`,-1)]]),_:1})):n.level===`warn`?(a(),o(y,{key:1,variant:`outline`,class:`text-[10px] px-1.5`},{default:p(()=>[...d[5]||=[s(`关注`,-1)]]),_:1})):t(``,!0)])]))),128))])])])])]))]),_:1})}}});export{J as default}; |