PageSourceSearch

https://nickz.ai/assets/js/index-D17jOnxd.js

js nickz.ai collected 2026-10-05 14:20:31 UTC 9,010 bytes, 1 lines download raw bytes

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.