PageSourceSearch

https://cfadata.com/assets/index-BBpt6PGR.js

js cfadata.com collected 2026-10-03 02:32:04 UTC 12,463 bytes, 1 lines download raw bytes

1import{j as e,u as X,m as ee,x as te,q as ne,a as se,a0 as ae,Z as oe,aa as ie,b5 as le,az as re}from"./index-BgOx-y6Z.js";import{a as m}from"./echarts-DgtDMHXn.js";import{O as ce,P as ue,M as me}from"./OverviewPage-BSzF6_NT.js";import{N as B}from"./NoteTip-DypnkGR6.js";import{K as de}from"./KpiStrip-DyTFyOC5.js";import{u as fe,c as pe,i as xe}from"./investmentAlerts-C1Ywr9Uv.js";import{u as he}from"./useMoneyFormatter-nQgPhkeI.js";import"./useIsDark-iZe97-MD.js";import"./InfoCircleOutlined-DZC8WRsa.js";const ve=[{key:"6M",label:"6M",months:6},{key:"1Y",label:"1Y",months:12},{key:"3Y",label:"3Y",months:36},{key:"ALL",label:"全部",months:null}],_=300,D=64,Z={gain:"text-[#cf1322]",loss:"text-[#3f8600]"},ke=[{key:"value",label:"市值"},{key:"profit",label:"盈亏"}],ge=({value:w,valueLabel:b,valueNote:C,delta:P,deltaTone:T,stats:A,points:v,range:p,onRangeChange:$,trendNote:R,emptyHint:E,profitValue:L,profitValueLabel:F,profitValueNote:O,profitDelta:d,profitDeltaTone:K,profitStats:W,profitPoints:l,profitTrendNote:S})=>{const[k,q]=m.useState("value"),t=k==="value"?{value:w,valueLabel:b,valueNote:C,delta:P,deltaTone:T,stats:A,points:v,trendNote:R}:{value:L,valueLabel:F,valueNote:O,delta:d,deltaTone:K,stats:W,points:l,trendNote:S},u=t.points.length>=2,x=u?Math.min(...t.points.map(i=>i.value)):0,g=(u?Math.max(...t.points.map(i=>i.value)):0)-x||1,I=u?_/(t.points.length-1):0,Y=4,j=u?t.points.map((i,N)=>{const H=N*I,G=Y+(1-(i.value-x)/g)*(D-Y*2);return`${H.toFixed(1)},${G.toFixed(1)}`}):[];return e.jsxs("section",{className:"relative overflow-hidden rounded-motif border border-motif-border bg-motif-surface p-4 shadow-[0_1px_3px_rgba(79,70,229,0.05)]",children:[e.jsxs("svg",{className:"pointer-events-none absolute inset-0 h-full w-full","aria-hidden":"true",preserveAspectRatio:"none",children:[e.jsx("defs",{children:e.jsx("pattern",{id:"motif-grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:e.jsx("path",{d:"M20 0L0 0 0 20",fill:"none",stroke:"var(--motif-surface-tint)",strokeWidth:"0.8"})})}),e.jsx("rect",{width:"100%",height:"100%",fill:"url(#motif-grid)"})]}),e.jsxs("div",{className:"relative flex flex-col gap-4 md:flex-row md:gap-5",children:[e.jsxs("div",{className:"shrink-0 md:w-[210px]",children:[e.jsx("div",{className:"mb-2 flex gap-1.5",children:ke.map(i=>{const N=i.key===k;return e.jsx("button",{type:"button",onClick:()=>q(i.key),className:`rounded-full px-2.5 py-1 text-[11px] font-medium leading-4 transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-motif-accent focus-visible:ring-offset-1 ${N?"bg-motif-accent text-white shadow-sm":"bg-motif-surface-tint text-motif-muted hover:bg-motif-border/40 hover:text-motif-ink"}`,children:i.label},i.key)})}),e.jsx("p",{className:"text-[12px] leading-5 text-motif-muted",children:t.valueLabel}),e.jsx("p",{className:"mt-0.5 text-[28px] font-semibold leading-9 tabular-nums tracking-tight text-motif-ink",children:t.value}),t.delta?e.jsx("p",{className:`mt-0.5 text-[12px] font-medium leading-5 tabular-nums ${t.deltaTone?Z[t.deltaTone]:"text-motif-muted"}`,children:t.delta}):null,t.valueNote?e.jsx("p",{className:"mt-1 text-[11px] leading-4 text-motif-muted",children:t.valueNote}):null,e.jsx("div",{className:"my-3 h-px bg-motif-border"}),e.jsx("div",{className:"space-y-1.5",children:t.stats.map(i=>e.jsxs("div",{className:"flex items-center justify-between text-[12px] leading-5",children:[e.jsx("span",{className:"text-motif-muted",children:i.label}),e.jsx("span",{className:`tabular-nums ${i.tone?Z[i.tone]:"text-motif-ink"}`,children:i.value})]},i.key))})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"mb-2 flex gap-1.5",children:ve.map(i=>{const N=i.key===p;return e.jsx("button",{type:"button",onClick:()=>$?.(i.key),className:`rounded-full px-2.5 py-1 text-[11px] font-medium leading-4 transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-motif-accent focus-visible:ring-offset-1 ${N?"bg-motif-accent text-white shadow-sm":"bg-motif-surface-tint text-motif-muted hover:bg-motif-border/40 hover:text-motif-ink"}`,children:i.label},i.key)})}),u?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{viewBox:`0 0 ${_} ${D}`,className:"block w-full max-h-[180px]",preserveAspectRatio:"xMidYMid meet",role:"img","aria-label":k==="value"?"投资总市值月频盘点曲线":"投资盈亏月频曲线",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"chart-fill",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"var(--motif-accent)",stopOpacity:"0.14"}),e.jsx("stop",{offset:"100%",stopColor:"var(--motif-accent)",stopOpacity:"0.02"})]})}),e.jsx("polygon",{points:`${j.join(" ")} ${_},${D} 0,${D}`,fill:"url(#chart-fill)"}),e.jsx("polyline",{points:j.join(" "),fill:"none",stroke:"var(--motif-accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("circle",{cx:_,cy:j[j.length-1].split(",")[1],r:"3",fill:"var(--motif-accent)",stroke:"white",strokeWidth:"1.2"})]}),e.jsxs("div",{className:"mt-1 flex justify-between text-[11px] leading-4 text-motif-muted",children:[e.jsx("span",{children:t.points[0].monthKey}),e.jsx("span",{children:t.points[t.points.length-1].monthKey})]})]}):e.jsx("div",{className:"flex h-[92px] items-center justify-center rounded-motif-sm bg-motif-surface-tint px-4 text-center text-[12px] leading-5 text-motif-muted",children:E??"暂无盘点记录"}),e.jsx("p",{className:"mt-1.5 text-[11px] leading-4 text-motif-muted",children:t.trendNote??"数据来自月度盘点快照,每月一个点,不是日频净值"})]})]})]})},J={securities:"#4F46E5",bank:"#7C3AED",insurance:"#D97706",pension:"#6366F1"},we=()=>{const w=X(),{investments:b,loadInvestments:C}
1=ee(),{products:P,recalculateCurrentValue:T}=te(),{insurances:A}=ne(),{convertAmount:v,mainCurrency:p}=se(),{globalMoneyFundAlertThreshold:$,marketSentiment:R}=ae(),{loadMetalPrices:E,getMarketIndicators:L}=fe(),{monthlySnapshots:F}=oe(),O=he(),[d,K]=m.useState("1Y");m.useEffect(()=>{Promise.allSettled([C(),E()])},[C,E]);const W=m.useMemo(()=>ie("invest"),[]),l=s=>O(s,p.code),S=m.useMemo(()=>L(R?.value),[L,R?.value]),k=m.useMemo(()=>pe(b.filter(s=>s.status==="holding"),$,S),[b,$,S]),q=m.useMemo(()=>{const s={securities:0,bank:0,insurance:0,pension:0};return b.filter(a=>a.status==="holding"&&a.liquidityTier!=="quick").forEach(a=>{const c=a.type==="deposit"?"bank":"securities";xe(a,$,S)&&(s[c]+=1)}),s},[b,$,S]),t=m.useMemo(()=>{const s=b.filter(o=>o.status==="holding"),a=P.filter(o=>o.status==="holding");let c=0,n=0,f=0;const r={securities:{amount:0,marketValue:0,count:0},bank:{amount:0,marketValue:0,count:0},insurance:{amount:0,marketValue:0,count:0},pension:{amount:0,marketValue:0,count:0}};s.forEach(o=>{const V=v(o.purchaseAmount,o.currency,p.code),h=v(o.currentValue,o.currency,p.code);if(!(o.liquidityTier==="quick")){c+=V,n+=h;const M=o.type==="deposit"?"bank":"securities";r[M].amount+=V,r[M].marketValue+=h,r[M].count+=1}o.isForRetirement&&(f+=h,r.pension.marketValue+=h,r.pension.count+=1)}),a.forEach(o=>{const V=v(o.amount,o.currency,p.code),h=v(T(o),o.currency,p.code);c+=V,n+=h,r.bank.amount+=V,r.bank.marketValue+=h,r.bank.count+=1,o.isForRetirement&&(f+=h,r.pension.marketValue+=h,r.pension.count+=1)}),A.forEach(o=>{const V=o.category||"protection";if(r.insurance.count+=1,!(V==="investment"&&o.cashValue!==void 0))return;const z=v(o.premium,o.currency,p.code),M=v(o.cashValue,o.currency,p.code);c+=z,n+=M,r.insurance.marketValue+=M,o.isForRetirement&&(f+=M,r.pension.marketValue+=M,r.pension.count+=1)});const U=n-c,Q=c!==0?U/c*100:0;return{investedPrincipal:c,totalMarketValue:n,totalProfit:U,totalProfitRate:Q,pensionMarketValue:f,modules:r}},[b,P,A,p.code,v,T]),u=m.useMemo(()=>{const s=d==="6M"?6:d==="1Y"?12:d==="3Y"?36:null,a=[...F].sort((n,f)=>n.yearMonth.localeCompare(f.yearMonth));return(s===null?a:a.slice(-s)).filter(n=>Number.isFinite(n.details?.invest)&&Number.isFinite(n.details?.insurance)).map(n=>({monthKey:n.yearMonth,value:n.details.invest+n.details.insurance}))},[F,d]),x=m.useMemo(()=>{const s=d==="6M"?6:d==="1Y"?12:d==="3Y"?36:null,a=[...F].sort((n,f)=>n.yearMonth.localeCompare(f.yearMonth));return(s===null?a:a.slice(-s)).filter(n=>Number.isFinite(n.details?.invest)&&Number.isFinite(n.details?.insurance)&&n.details?.invest_cost>0).map(n=>({monthKey:n.yearMonth,value:n.details.invest+n.details.insurance-n.details.invest_cost}))},[F,d]),y=m.useMemo(()=>{if(u.length<2)return null;const s=u[u.length-1].value,a=u[u.length-2].value;return!Number.isFinite(a)||a===0?null:{delta:s-a,rate:(s-a)/a*100}},[u]),g=m.useMemo(()=>{if(x.length<2)return null;const s=x[x.length-1].value,a=x[x.length-2].value;return!Number.isFinite(a)||a===0?null:{delta:s-a,rate:(s-a)/Math.abs(a)*100}},[x]),I=t.totalProfit>=0?"gain":"loss",Y=[{key:"sec",label:"证券持仓",value:l(t.modules.securities.marketValue)},{key:"bank",label:"存款理财",value:l(t.modules.bank.marketValue)},{key:"ins",label:"理财型保险",value:l(t.modules.insurance.marketValue)},{key:"pension",label:"养老储备",value:l(t.pensionMarketValue)}],j=t.modules.securities.marketValue-t.modules.securities.amount,i=t.modules.bank.marketValue-t.modules.bank.amount,N=[{key:"sec-profit",label:"证券持仓盈亏",value:l(j),tone:j>=0?"gain":"loss"},{key:"bank-profit",label:"存款理财盈亏",value:l(i),tone:i>=0?"gain":"loss"},{key:"pension",label:"养老储备市值",value:l(t.pensionMarketValue)},{key:"holdings",label:"持仓数",value:`${t.modules.securities.count+t.modules.bank.count+t.modules.insurance.count} 项`}],H=m.useMemo(()=>[{key:"amount",label:"投资本金",value:l(t.investedPrincipal)},{key:"profit",label:"累计盈亏",value:l(t.totalProfit),tone:I,hint:"市值 − 本金;含理财型保险现金价值,不含货币基金与保障型保费"},{key:"profit-rate",label:"总收益率",value:`${t.totalProfitRate>=0?"+":""}${t.totalProfitRate.toFixed(2)}
1%`,tone:I},{key:"warn",label:"待处理预警",value:`${k} 项`,tone:k>0?"danger":"default"}],[t,I,k,l]),G=W.map(s=>{const a=s.key,c=t.modules[a],n=a==="pension",f=!n&&t.totalMarketValue!==0?c.marketValue/t.totalMarketValue*100:null,r=n?0:q[a];return{key:s.key,title:s.label,dotColor:J[s.key]??"#6366F1",meta:n?`跨模块聚合 · ${l(c.marketValue)}`:`${c.count} 项 · ${l(c.marketValue)}`,value:n?"聚合":`${(f??0).toFixed(0)}%`,valueMuted:n,variant:n?"none":"spark",sparkColor:J[s.key]??"#6366F1",flag:r>0?{tone:"danger",label:`预警 ${r} 项`}:void 0,hint:n?"养老钱包是聚合统计模块,资产已包含在基金、定存、保险、理财等分类中,不重复计入总投资额":`占总市值 ${(f??0).toFixed(1)}%`,onClick:()=>w(s.to),quickAdd:()=>w(s.to,{state:{autoAdd:!0}}),quickAddLabel:`添加${s.label}`}});return e.jsxs(ce,{motif:"invest",children:[e.jsx(ue,{title:"财富引擎",icon:e.jsx(re,{}),subtitle:"基金 · 股票 · 定存 · 理财 · 保险,按周更新份额与成本,日更行情",actions:[{key:"strategy",label:"策略中心",icon:e.jsx(le,{}),badge:k>0?k:void 0,onClick:()=>w("/assets/invest/strategy")}]}),e.jsx(de,{items:H,className:"mb-4"}),e.jsx(ge,{valueLabel:"投资总市值",value:l(t.totalMarketValue),valueNote:e.jsx(B,{tip:"口径:证券持仓 + 存款理财 + 理财型保险现金价值(货币基金计入流动钱包,不含保障型保费)",children:"投资总市值 = 持仓 + 存款理财 + 理财险现金价值"}),delta:y?`较上月 ${y.delta>=0?"+":"-"}${l(Math.abs(y.delta))} · ${y.rate>=0?"+":""}${y.rate.toFixed(2)}%`:void 0,deltaTone:y&&y.delta<0?"loss":"gain",stats:Y,points:u,range:d,onRangeChange:K,trendNote:e.jsx(B,{tip:"市值曲线 = 月度盘点快照「投资 + 保险」市值;月频盘点,非日频净值",children:"月度盘点快照生成,非日频净值"}),emptyHint:"还没有盘点记录,保存一次月度盘点即可生成第一个点",profitValueLabel:"投资累计盈亏",profitValue:l(t.totalProfit),profitValueNote:e.jsx(B,{tip:"口径:(证券持仓 + 存款理财 + 理财型保险市值) − 投资本金",children:"盈亏 = 市值 − 投资本金"}),profitDelta:g?`较上月 ${g.delta>=0?"+":"-"}${l(Math.abs(g.delta))} · ${g.rate>=0?"+":""}${g.rate.toFixed(2)}%`:void 0,profitDeltaTone:g&&g.delta<0?"loss":"gain",profitStats:N,profitPoints:x,profitTrendNote:"盈亏曲线 = 投资市值 − 投资本金;成本自 2026-09 起记录,曲线自首个新快照起"}),e.jsx(me,{items:G})]})};export{we as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.