1import{r as e,j as t}from"./vendor-react-DejgYtBM.js";import{f as a,m as n,l as r,B as s,j as l,k as i,y as d,T as o,a as c,i as m}from"./vendor-semi-D8d7bTtM.js";import{u as y,A as u,s as h}from"./index-BeIIFw6E.js";import{R as p}from"./vendor-icons-EJvJ5X-w.js";import"./vendor-motion-Chfy_MiU.js";const{Title:x,Text:g}=a,j=e=>null==e?"â":`Â¥${Number(e).toFixed(2)}`,f=e=>e?new Date(1e3*e).toLocaleString():"-",_=({label:e,value:a,gradient:r})=>t.jsxs(n,{style:{flex:1,minWidth:180,background:r},bodyStyle:{padding:"16px"},children:[t.jsx(g,{style:{color:"rgba(255,255,255,0.85)",fontSize:13},children:e}),t.jsx(x,{heading:3,style:{margin:"8px 0 0",color:"#fff"},children:j(a)})]}),b=()=>{const{t:a}=y(),[b,v]=e.useState(null),[w,k]=e.useState(!1),[I,S]=e.useState(!1),[z,C]=e.useState(0),[B,F]=e.useState("topup"),[$,R]=e.useState(""),[T,E]=e.useState([]),[K,W]=e.useState(0),[L,O]=e.useState(1),[D,M]=e.useState(!1),P=e.useRef(0),A=e.useRef(0),N=e.useRef(0),U=e.useRef(z);U.current=z;const Y=e.useRef(!0),q=(new Date).getFullYear(),G=e.useMemo(()=>{const e=[];for(let t=q;t>=q-5;t--)e.push({value:t,label:`${t}å¹´`});return e},[q]),H=e.useCallback(async()=>{const e=++P.current;k(!0),S(!0);try{const t=U.current,n={};t>0&&(n.year=t);const r=await u.get("/api/user/service_provider/dashboard/summary",{params:n});if(e!==P.current)return;const{success:s,data:l,message:i}=r.data;s?v(l):h(i||a("è·åæå¡åçæ¿æ°æ®å¤±è´¥"))}catch(t){if(e!==P.current)return;h(t.message)}finally{e===P.current&&(k(!1),S(!1))}},[a]),J=e.useCallback(async e=>{const t=++A.current;S(!0);try{const n={list_only:1};e>0&&(n.year=e);const r=await u.get("/api/user/service_provider/dashboard/summary",{params:n});if(t!==A.current)return;const{success:s,data:l,message:i}=r.data;s?v(e=>({...e||{},monthly_list:l.monthly_list||[]})):h(i||a("è·åæå¡åçæ¿æ°æ®å¤±è´¥"))}catch(n){if(t!==A.current)return;h(n.message)}finally{t===A.current&&S(!1)}},[a]),Q=e.useCallback(async()=>{const e=++N.current;M(!0);try{const t={type:B,page:L,page_size:20};$&&(t.month=$);const n=await u.get("/api/user/service_provider/dashboard/details",{params:t});if(e!==N.current)return;const{success:r,data:s,message:l}=n.data;r?(E(s.records||[]),W(s.total||0)):h(l||a("è·åæç»æ°æ®å¤±è´¥"))}catch(t){if(e!==N.current)return;h(t.message)}finally{e===N.current&&M(!1)}},[B,$,L,a]);e.useEffect(()=>{H()},[H]),e.useEffect(()=>{Y.current?Y.current=!1:J(z)},[z,J]),e.useEffect(()=>{Q()},[Q]);const V=b?.monthly_list?.map(e=>({value:e.month,label:e.month}))||[],X=e.useMemo(()=>[{title:a("æä»½"),dataIndex:"month",key:"month",width:120,render:e=>t.jsx(g,{strong:!0,children:e})},{title:a("å
å¼éé¢"),dataIndex:"topup_money",key:"topup_money",width:150,render:e=>t.jsx(g,{style:{color:"#3B82F6"},children:j(e)})},{title:a("å转éé¢"),dataIndex:"transfer_amount",key:"transfer_amount",width:150,render:e=>t.jsx(g,{style:{color:"#F97316"},children:j(e)})},{title:a("å
æ¢ç éé¢"),dataIndex:"redemption_money",key:"redemption_money",width:150,render:e=>t.jsx(g,{style:{color:"#22C55E"},children:j(e)})},{title:a("å计"),dataIndex:"total",key:"total",width:150,render:e=>t.jsx(g,{strong:!0,style:{color:"#8B5CF6"},children:j(e)})}],[a]),Z=e.useMemo(()=>{const e=[{title:"ID",dataIndex:"id",key:"id",width:70},{title:a("ç¨æ·"),dataIndex:"username",key:"username",width:140,render:(e,a)=>t.jsxs("span",{children:[a.display_name||e,null!=a.user_id?t.jsxs(g,{type:"tertiary",size:14,children:[" (",a.user_id,")"]}):null]})},{title:a("å½å±ä»£ç"),dataIndex:"parent_username",key:"parent_username",width:140,render:(e,a)=>a.parent_id?t.jsxs("span",{children:[a.parent_display_name||e,null!=a.parent_id?t.jsxs(g,{type:"tertiary",size:14,children:[" (",a.parent_id,")"]}):null]}):t.jsx(g,{type:"tertiary",children:"主ç«"})},{title:a("æå±ç«ç¹"),dataIndex:"agent_system_name",key:"agent_system_name",width:150,render:(e,a)=>a.parent_id?t.jsxs("span",{children:[e||"-",a.agent_domain?t.jsxs(g,{type:"tertiary",size:14,children:[" (",a.agent_domain,")"]}):null]}):t.jsx(g,{type:"tertiary",children:"主ç«"})}];return"topup"===B?[...e,{title:a("æ¯ä»éé¢"),dataIndex:"money",key:"money",width:120,render:e=>t.jsx(g,{strong:!0,style:{color:"#10B981"},children:j(e)})},{title:a("æ¶é´"),dataIndex:"created_at",key:"created_at",width:170,render:e=>f(e)}]:"transfer"===B?[...e,{title:a("å转éé¢"),dataIndex:"money",key:"money",width:120,render:e=>t.jsx(g,{strong:!0,style:{color:"#F97316"},children:j(e)})},{title:a("说æ"),dataIndex:"description",key:"description",ellipsis:!0},{title:a("æ¶é´"),dataIndex:"created_at",key:"created_at",width:170,render:e=>f(e)}]:[...e,{title:a("æ¯ä»éé¢"),dataIndex:"money",key:"money",width:120,render:e=>t.jsx(g,{strong:!0,style:{color:"#22C55E"},children:j(e)})},{title:a("说æ"),dataIndex:"description",key:"description",width:140},{title:a("æ¶é´"),dataIndex:"created_at",key:"created_at",width:170,render:e=>f(e)}]},[B,a]);return t.jsxs("div",{className:"bg-background h-full px-2",children:[t.jsx(n,{title:t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"},children:[t.jsx(x,{heading:5,style:{margin:0},children:a("æå¡åçæ¿")}),t.jsx(s,{icon:t.jsx(p,{size:16}),onClick:()=>{H(),Q()},loading:w||D,children:a("å·æ°")})]}),style:{marginBottom:16},children:w&&!b?t.jsx("div",{style:{textAlign:"center",padding:40},children:t.jsx(r,{size:20})}):b?t.jsxs(t.Fragment,{children:[t.jsxs("div",{style:{display:"flex",gap:12,marginBottom:20,flexWrap:"wrap"},children:[t.jsx(_,{label:a("æ¬æå
å¼"),value:b.current_month?.topup_money,gradient:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)"}),t.jsx(_,{label:a("䏿å
å¼"),value:b.last_month?.topup_money,gradient:"linear-gradient(135deg, #89a0d4 0%, #9a7ec0 100%)"}),t.jsx(_,{label:a("æ¬æå转"),value:b.current_month?.transfer_amount,gradient:"linear-gradient(135deg, #f093fb 0%, #f5576c 100%)"}),t.jsx(_,{label:a("䏿å转"),value:b.last_month?.transfer_amount,gradient:"linear-gradient(135deg, #d4a0c0 0%, #d49090 100%)"}),t.jsx(_,{label:a("æ¬æå
æ¢ç "),value:b.current_month?.redemption_money,gradient:"linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)"}),t.jsx(_,{label:a("䏿å
æ¢ç "),value:b.last_month?.redemption_money,gradient:"linear-gradient(135deg, #8ec5a0 0%, #7ed4c0 100%)"})]}),t.jsxs("div",{style:{display:"flex",gap:12,marginBottom:20,flexWrap:"wrap"},children:[t.jsxs(n,{style:{flex:1,minWidth:220},bodyStyle:{padding:"16px"},children:[t.jsx(g,{type:"tertiary",size:14,children:a("æ¬æå计")}),t.jsx(x,{heading:4,style:{margin:"4px 0 0",color:"#8B5CF6"},children:j(b.current_month?.total)})]}),t.jsxs(n,{style:{flex:1,minWidth:220},bodyStyle:{padding:"16px"},children:[t.jsx(g,{type:"tertiary",size:14,children:a("䏿å计")}),t.jsx(x,{heading:4,style:{margin:"4px 0 0",color:"#6366F1"},children:j(b.last_month?.total)})]})]})]}):null}),t.jsxs(n,{title:t.jsx(x,{heading:5,style:{margin:0},children:a("æåº¦æ±æ»")}),style:{marginBottom:16},children:[t.jsx("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",marginBottom:12},children:t.jsxs(l,{children:[t.jsx(g,{type:"tertiary",size:14,children:a("鿩年份")}),t.jsxs(i,{placeholder:a("鿩年份"),value:z,onChange:e=>C(e),style:{width:140},children:[t.jsx(i.Option,{value:0,children:a("æè¿12个æ")}),G.map(e=>t.jsx(i.Option,{value:e.value,children:e.label},e.value))]})]})}),t.jsx(d,{columns:X,dataSource:b?.monthly_list||[],loading:I,rowKey:"month",pagination:!1,size:"small",bordered:!0,empty:t.jsx(g,{type:"tertiary",children:a("ææ æ°æ®")})})]}),t.jsxs(n,{title:t.jsx(x,{heading:5,style:{margin:0},children:a("æåº¦æç»")}),children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16,flexWrap:"wrap",gap:8},children:[t.jsxs(o,{type:"button",activeKey:B,onChange:e=>{F(e),O(1)},style:{marginBottom:0},children:[t.jsx(c,{tab:t.jsxs("span",{children:[a("å
å¼"),t.jsx(m,{size:"small",color:"blue",style:{marginLeft:4},children:"TopUp"})]}),itemKey:"topup"}),t.jsx(c,{tab:t.jsxs("span",{children:[a("å转"),t.jsx(m,{size:"small",color:"orange",style:{marginLeft:4},children:"Transfer"})]}),itemKey:"transfer"}),t.jsx(c,{tab:t.jsxs("span",{children:[a("å
æ¢ç "),t.jsx(m,{size:"small",color:"green",style:{marginLeft:4},children:"Redeem"})]}),itemKey:"redemption"})]}),t.jsxs(i,{placeholder:a("çéæä»½"),value:$,onChange:e=>{R(e||""),O(1)},style:{width:160},showClear:!0,children:[t.jsx(i.Option,{value:"",children:a("å
¨é¨æä»½")}),V.map(e=>t.jsx(i.Option,{value:e.value,children:e.label},e.value))]})]}),t.jsx(d,{columns:Z,dataSource:T,loading:D,rowKey:e=>`${B}-${e.id}`,pagination:{currentPage:L,pageSize:20,total:K,onPageChange:e=>O(e),showTotal:!0,formatPageText:e=>`${e.currentStart}-${e.currentEnd} / ${a("å
±")} ${K} ${a("æ¡")}
1`},size:"small",bordered:!0,empty:t.jsx(g,{type:"tertiary",children:a("ææ æç»è®°å½")})})]})]})};export{b 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.