PageSourceSearch

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

js nickz.ai collected 2026-10-05 14:20:50 UTC 7,512 bytes, 1 lines download raw bytes

1import{r as e,j as t}from"./vendor-react-DejgYtBM.js";import{i as s,f as n,j as a,l as r,E as i,m as o,F as l,B as d,R as c,C as u,T as m,a as p,x,y}from"./vendor-semi-D8d7bTtM.js";import{u as h,Y as j,A as g,s as f,v,w as S,V as b}from"./index-BeIIFw6E.js";import{M as w,C as _,t as I,u as C,v as k,w as z}from"./vendor-icons-EJvJ5X-w.js";import"./vendor-motion-Chfy_MiU.js";const{Title:F,Text:R}=n;function $(e){return e&&e.data&&e.data.success?e.data.data:null}function E(e){const t=b();return`$${((Number(e)||0)/t).toFixed(2)}`}function T(e){return`¥${(Number(e)||0).toFixed(2)}`}function B(e){if(!e)return"";const t=e instanceof Date?e:new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function U({endpoint:s,exportEndpoint:n,exportFilename:r,columns:o,extraSummary:c}){const{t:u}=h(),[m,p]=e.useState([]),[j,v]=e.useState(0),[S,b]=e.useState(null),[w,_]=e.useState(1),[I,C]=e.useState(!1),[k,F]=e.useState(!1),[R,E]=e.useState(""),[T,U]=e.useState([]),[D,L]=e.useState(""),[N,P]=e.useState([]),A=e.useCallback(async()=>{C(!0);try{const e=new URLSearchParams;e.set("page",String(w)),e.set("page_size",String(10)),R&&e.set("keyword",R),T[0]&&e.set("start_date",B(T[0])),T[1]&&e.set("end_date",B(T[1]));const t=await g.get(`${s}?${e.toString()}`),n=$(t);n?(p(Array.isArray(n.records)?n.records:[]),v(Number(n.total)||0),b(c?c(n):null)):(p([]),v(0),b(null),f(t?.data?.message||u("加载失败")))}catch(e){f(e.message)}finally{C(!1)}},[s,w,R,T,c,u]);e.useEffect(()=>{A()},[A]);const K=()=>{E(D.trim()),U(N||[]),_(1)};return t.jsxs("div",{children:[t.jsxs(a,{wrap:!0,style:{marginBottom:16},children:[t.jsx(l,{placeholder:u("用户ID / 用户名 / 渠道"),value:D,onChange:L,onEnterPress:K,style:{width:220},showClear:!0}),t.jsx(x,{type:"dateRange",value:N,onChange:P,style:{width:260}}),t.jsx(d,{theme:"solid",type:"primary",onClick:K,children:u("查询")}),t.jsx(d,{onClick:()=>{L(""),P([]),E(""),U([]),_(1)},children:u("重置")}),n?t.jsx(d,{icon:t.jsx(z,{size:14}),loading:k,onClick:async()=>{if(n){F(!0);try{const e=new URLSearchParams;R&&e.set("keyword",R),T[0]&&e.set("start_date",B(T[0])),T[1]&&e.set("end_date",B(T[1]));const t=e.toString(),s=t?`${n}?${t}`:n;await async function(e,t,s,n){try{const s=await g.get(e,{responseType:"blob"}),n=s.headers?.["content-disposition"]||"";let a=t;const r=n.match(/filename\*?=(?:UTF-8'')?([^;"\n]+)/i);if(r)try{a=decodeURIComponent(r[1].replace(/"/g,""))}catch{}const i=new Blob([s.data],{type:s.headers?.["content-type"]||"application/octet-stream"}),o=document.createElement("a");o.href=URL.createObjectURL(i),o.download=a,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(o.href)}catch(a){s(n)}}(s,r,f,u("导出失败,请稍后重试"))}finally{F(!1)}}},children:u("导出")}):null]}),S,t.jsx(y,{columns:o,dataSource:m,loading:I,rowKey:"id",empty:t.jsx(i,{description:u("暂无数据"),style:{padding:30}}),pagination:{currentPage:w,pageSize:10,total:j,onPageChange:e=>_(e),formatPageText:e=>u("第 {{start}} - {{end}} 条",{start:e.currentStart,end:e.currentEnd})}})]})}function D(){const{t:n}=h(),[x,y]=e.useState(!0),[b,z]=e.useState(!1),[B,D]=e.useState(null);e.useEffect(()=>{let e=!0;return(async()=>{try{const t=$(await g.get("/api/user/promotion/self"));if(!e)return;if(!t||!t.is_promoter)return z(!1),void y(!1);z(!0);const s=$(await g.get("/api/user/promotion/overview"));e&&s&&D(s)}catch(t){e&&f(t.message)}finally{e&&y(!1)}})(),()=>{e=!1}},[]);const N=[{title:n("用户ID"),dataIndex:"id",width:90},{title:n("用户名"),dataIndex:"username",render:(e,t)=>t.display_name||e||"-"},{title:n("邮箱"),dataIndex:"email",render:e=>e||"-"},{title:n("注册时间"),dataIndex:"created_at",render:e=>e?j(e):"-"},{title:n("累计充值"),dataIndex:"total_topup_amount",render:e=>E(e)},{title:n("状态"),dataIndex:"status",width:90,render:e=>1===Number(e)?t.jsx(s,{color:"green",children:n("启用")}):t.jsx(s,{color:"grey",children:n("禁用")})}],P=[{title:n("订单ID"),dataIndex:"id",width:90},{title:n("用户"),dataIndex:"username",render:(e,t)=>t.display_name||e||"-"},{title:n("充值额度"),dataIndex:"amount",render:e=>E(e)},{title:n("实付金额"),dataIndex:"money",render:e=>T(e)},{title:n("支付方式"),dataIndex:"payment_method",render:e=>e||"-"},{title:n("充值时间"),dataIndex:"create_time",render:e=>e?j(e):"-"}],A=e.useCallback(e=>t.jsx("div",{style:{marginBottom:12},children:t.jsxs(R,{type:"tertiary",children:[n("累计充值合计"),":",E(e.topup_sum)]})}),[n]),K=e.useCallback(e=>t.jsx("div",{style:{marginBottom:12},children:t.jsxs(a,{children:[t.jsxs(R,{type:"tertiary",children:[n("充值额度合计"),":",E(e.amount_sum)]}),t.jsxs(R,{type:"tertiary",children:[n("实付金额合计"),":",T(e.money_sum)]})]})}),[n]);if(x)return t.jsx("div",{style:{display:"flex",justifyContent:"center",padding:80},children:t.jsx(r,{size:"large"})});if(!b)return t.jsx("div",{style:{padding:24},children:t.jsx(i,{image:t.jsx(w,{size:48,color:"var(--semi-color-tertiary)"}),title:n("暂无推广权限"),description:n("您还不是推广员,如需开通请联系管理员。"),style:{padding:60}})});const O=B?.summary||{};return t.jsxs("div",{style:{padding:16},children:[t.jsx(F,{heading:4,style:{marginBottom:16},children:n("推广管理")}),t.jsxs(o,{style:{marginBottom:16},children:[t.jsx(R,{strong:!0,children:n("专属推广链接")}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginTop:8,flexWrap:"wrap"},children:[t.jsx(l,{readOnly:!0,value:B?.promo_link||"",style:{maxWidth:480,flex:1}}),t.jsx(d,{icon:t.jsx(_,{size:14}),theme:"solid",type:"primary",onClick:async()=>{const e=B?.promo_link;e&&(await v(e)?S(n("推广链接已复制")):f(n("复制失败,请手动复制")))},children:n("复制链接")}),B?.promo_code?t.jsxs(s,{color:"blue",size:"large",children:[n("推广码"),":",B.promo_code]}):null]})]}),t.jsxs(c,{gutter:16,style:{marginBottom:16},children:[t.jsx(u,{xs:24,sm:8,children:t.jsx(L,{icon:t.jsx(I,{size:20}),label:n("注册人数"),value:Number(O.total_registers)||0})}),t.jsx(u,{xs:24,sm:8,children:t.jsx(L,{icon:t.jsx(C,{size:20}),label:n("充值人数"),value:Number(O.total_topups)||0})}),t.jsx(u,{xs:24,sm:8,children:t.jsx(L,{icon:t.jsx(k,{size:20}),label:n("充值总额"),value:T(O.total_amount)})})]}),t.jsx(o,{children:t.jsxs(m,{type:"line",children:[t.jsx(p,{tab:n("注册用户"),itemKey:"users",children:t.jsx("div",{style:{paddingTop:12},children:t.jsx(U,{endpoint:"/api/user/promotion/users",exportEndpoint:"/api/user/promotion/users/export",exportFilename:"promotion_users.xlsx",columns:N,extraSummary:A})})}),t.jsx(p,{tab:n("充值记录"),itemKey:"topups",children:t.jsx("div",{style:{paddingTop:12},children:t.jsx(U,{endpoint:"/api/user/promotion/topups",exportEndpoint:"/api/user/promotion/topups/ex
1port",exportFilename:"promotion_topups.xlsx",columns:P,extraSummary:K})})})]})})]})}function L({icon:e,label:s,value:n}){return t.jsx(o,{style:{height:"100%"},children:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[t.jsx("div",{style:{width:40,height:40,borderRadius:10,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(70,172,255,0.12)",color:"#0084FF",flexShrink:0},children:e}),t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:13,color:"var(--semi-color-text-2)"},children:s}),t.jsx("div",{style:{fontSize:22,fontWeight:600,lineHeight:"30px"},children:n})]})]})})}export{D 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.