1import{u as C,b as M,v as T,r as d,t as x,j as e,E as A,ag as $,T as B,g as G}from"./index-DxpMJHht.js";import{B as F}from"./badge-DsT5f29h.js";import{Z as y}from"./zap-Hez7l0EJ.js";import{H as j}from"./history-CNsqc5g5.js";import{C as D}from"./circle-check-big-D9tIU27c.js";import{G as E}from"./gift-CU9tCcJB.js";import{T as H}from"./trending-down-D2IbHuS2.js";function q(){const{t}=C(),[,p]=M(),{user:r,loading:h}=T(),[n,R]=d.useState(null),[i,N]=d.useState("recharge"),[l,u]=d.useState(1),{data:m,isLoading:f}=x.gopoint.listRechargePlans.useQuery(void 0,{staleTime:12e4}),{data:v}=x.gopoint.getBalance.useQuery(void 0,{enabled:!!r,staleTime:3e4}),{data:w}=x.gopoint.getExchangeRate.useQuery(void 0,{staleTime:3e5}),L=w?.rate??10,{data:o,isLoading:S}=x.gopoint.getHistory.useQuery({page:l,pageSize:20},{enabled:!!r&&i==="history",staleTime:3e4});if(d.useEffect(()=>{h||r||p("/login")},[h,r,p]),h)return e.jsx("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:41",className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsx("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:42",className:"w-8 h-8 border-2 border-orange-500 border-t-transparent rounded-full animate-spin"})});if(!r)return null;const s=m?.find(a=>a.id===n),k=()=>{if(!s){G.error("è«é¸æå
å¼å¥é¤");return}const a=Number(s.amountMop??0);if(!a||a<=0){G.error("æ¤å¥é¤æ«ä¸å¯è³¼è²·");return}p(`/payment/checkout?type=gopoint&rechargePlanId=${s.id}&amount=${a}`)},z=a=>{switch(a){case"earn":return{label:"ç²å¾",color:"text-green-600",bg:"bg-green-50"};case"spend":return{label:"æ£é¤",color:"text-red-500",bg:"bg-red-50"};case"expire":return{label:"å°æ",color:"text-gray-400",bg:"bg-gray-50"};case"refund":return{label:"鿬¾",color:"text-blue-500",bg:"bg-blue-50"};case"admin_adjust":return{label:"調æ´",color:"text-purple-500",bg:"bg-purple-50"};default:return{label:a,color:"text-gray-500",bg:"bg-gray-50"}}};return e.jsxs("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:68",className:"min-h-screen bg-gray-50",children:[e.jsxs("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:69",className:"sticky top-0 z-10 bg-white border-b border-gray-100 px-4 py-3 flex items-center gap-3",children:[e.jsx("button",{"data-loc":"client/src/pages/GopointRechargePage.tsx:70",onClick:()=>window.history.back(),className:"p-1.5 rounded-full hover:bg-gray-100",children:e.jsx(A,{"data-loc":"client/src/pages/GopointRechargePage.tsx:71",size:20,className:"text-gray-600"})}),e.jsx("h1",{"data-loc":"client/src/pages/GopointRechargePage.tsx:73",className:"font-bold text-gray-900 text-base",children:t("購買 GoPoint")})]}),e.jsxs("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:76",className:"max-w-lg mx-auto px-4 py-5 space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:78",className:"bg-gradient-to-r from-orange-500 to-amber-400 rounded-xl p-4 text-white",children:[e.jsx("p",{"data-loc":"client/src/pages/GopointRechargePage.tsx:79",className:"text-white/70 text-xs mb-1",children:t("ç¶å GoPoint é¤é¡")}),e.jsxs("p",{"data-loc":"client/src/pages/GopointRechargePage.tsx:80",className:"text-2xl font-bold",style:{fontFamily:"DM Sans"},children:[(v?.balance??0).toLocaleString()," ",e.jsx("span",{"data-loc":"client/src/pages/GopointRechargePage.tsx:81",className:"text-sm font-normal",children:"GP"})]}),e.jsx("p",{"data-loc":"client/src/pages/GopointRechargePage.tsx:83",className:"text-white/60 text-xs mt-1",children:t("GoPoint å¯ç¨æ¼ç½®é ãç²¾é¸ãå·æ°çå¢å¼æå")}),e.jsxs("p",{"data-loc":"client/src/pages/GopointRechargePage.tsx:84",className:"text-white/50 text-xs mt-0.5",children:["å
å¼åºç¤æ¯ä¾ï¼1 MOP = ",L," GP"]})]}),e.jsx("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:88",className:"flex bg-white rounded-xl border border-gray-100 p-1 gap-1",children:["recharge","history"].map(a=>e.jsxs("button",{"data-loc":"client/src/pages/GopointRechargePage.tsx:90",onClick:()=>N(a),className:`flex-1 flex items-center justify-center gap-1.5 py-2 rounded-lg text-sm font-medium transition-all ${i===a?"bg-amber-500 text-white shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:[a==="recharge"?e.jsx(y,{"data-loc":"client/src/pages/GopointRechargePage.tsx:97",size:14}):e.jsx(j,{"data-loc":"client/src/pages/GopointRechargePage.tsx:97",size:14}),a==="recharge"?"å
å¼å¥é¤":"æ·å²è¨é"]},a))}),i==="recharge"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:106",className:"bg-white rounded-xl border border-gray-100 p-4 shadow-sm",children:[e.jsx("h2",{"data-loc":"client/src/pages/GopointRechargePage.tsx:107",className:"text-sm font-semibold text-gray-700 mb-3",children:t("鏿å
å¼å¥é¤")}),f?e.jsx("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:109",className:"text-center py-6 text-gray-400 text-sm",children:t("è¼å
¥ä¸...")}):m?.length?e.jsx("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:113",className:"grid grid-cols-2 gap-2",children:m.filter(a=>a.isActive).map(a=>{const g=n===a.id,c=a.bonusGp??0,b=a.gpAmount+c;return e.jsxs("button",{"data-loc":"client/src/pages/GopointRechargePage.tsx:119",onClick:()=>R(a.id),className:`relative p-3 rounded-xl border-2 text-left transition-all ${g?"border-amber-400 bg-amber-50":"border-gray-100 hover:border-gray-200 bg-white"}`,children:[c>0&&e.jsxs(F,{"data-loc":"client/src/pages/GopointRechargePage.tsx:127",className:"absolute -top-2 -right-1 text-xs px-1.5 py-0.5 bg-red-500 text-white border-0",children:["+",c," è´é"]}),e.jsxs("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:131",className:"flex items-center gap-1 mb-1",children:[e.jsx(y,{"data-loc":"client/src/pages/GopointRechargePage.tsx:132",size:14,className:"text-amber-500"}),e.jsx("span",{"data-loc":"client/src/pages/GopointRechargePage.tsx:133",className:"text-base font-bold text-gray-900",children:b.toLocaleStr
1ing()}),e.jsx("span",{"data-loc":"client/src/pages/GopointRechargePage.tsx:134",className:"text-xs text-gray-400",children:"GP"})]}),c>0&&e.jsxs("p",{"data-loc":"client/src/pages/GopointRechargePage.tsx:137",className:"text-xs text-gray-400 mb-1",children:[a.gpAmount.toLocaleString()," + ",e.jsxs("span",{"data-loc":"client/src/pages/GopointRechargePage.tsx:138",className:"text-red-500",children:[c," è´"]})]}),e.jsxs("p",{"data-loc":"client/src/pages/GopointRechargePage.tsx:141",className:"text-sm font-semibold text-amber-600",children:["MOP ",Number(a.amountMop??0).toFixed(0)]}),g&&e.jsx(D,{"data-loc":"client/src/pages/GopointRechargePage.tsx:142",size:16,className:"absolute bottom-2 right-2 text-amber-500"})]},a.id)})}):e.jsx("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:111",className:"text-center py-6 text-gray-400 text-sm",children:t("æ«ç¡å¯ç¨å
å¼å¥é¤")})]}),s&&e.jsxs("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:151",className:"bg-amber-50 rounded-xl border border-amber-100 p-3 flex items-center gap-3",children:[e.jsx(E,{"data-loc":"client/src/pages/GopointRechargePage.tsx:152",size:20,className:"text-amber-500 flex-shrink-0"}),e.jsxs("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:153",className:"flex-1",children:[e.jsxs("p",{"data-loc":"client/src/pages/GopointRechargePage.tsx:154",className:"text-sm font-medium text-amber-800",children:[(s.gpAmount+(s.bonusGp??0)).toLocaleString()," GP"]}),e.jsxs("p",{"data-loc":"client/src/pages/GopointRechargePage.tsx:157",className:"text-xs text-amber-600",children:["MOP ",Number(s.amountMop??0).toFixed(2),(s.bonusGp??0)>0&&` · å« ${s.bonusGp} GP è´é`]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:165",className:"bg-gray-50 rounded-xl border border-gray-100 p-3 text-xs text-gray-500 space-y-1",children:[e.jsx("p",{"data-loc":"client/src/pages/GopointRechargePage.tsx:166",className:"font-semibold text-gray-600",children:t("GoPoint 使ç¨èªªæ")}),e.jsx("p",{"data-loc":"client/src/pages/GopointRechargePage.tsx:167",children:t("⢠GoPoint å¯ç¨æ¼ç½®é ãç²¾é¸ãå·æ°ãAI æ¨è¦çå¢å¼æå")}),e.jsx("p",{"data-loc":"client/src/pages/GopointRechargePage.tsx:168",children:t("⢠å
å¼å¾æ°¸ä¹
ææï¼ä¸è¨ä½¿ç¨æé")}),e.jsx("p",{"data-loc":"client/src/pages/GopointRechargePage.tsx:169",children:t("â¢ ä»æ¬¾å®æå¾ï¼å·¥ä½äººå¡å¯©æ ¸å¾å°èªåå
å¼å°æ¨ç帳æ¶")}),e.jsx("p",{"data-loc":"client/src/pages/GopointRechargePage.tsx:170",children:t("â¢ å¦æåé¡ï¼è«è¯çµ¡å®¢æ")})]}),e.jsx($,{"data-loc":"client/src/pages/GopointRechargePage.tsx:173",className:"w-full bg-amber-500 hover:bg-amber-600 text-white font-semibold h-12 rounded-xl",onClick:k,disabled:!n,children:n?`確èªè³¼è²· MOP ${Number(s?.amountMop??0).toFixed(2)}`:"è«é¸æå
å¼å¥é¤"})]}),i==="history"&&e.jsx("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:185",className:"bg-white rounded-xl border border-gray-100 shadow-sm overflow-hidden",children:S?e.jsx("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:187",className:"p-6 space-y-3",children:[1,2,3,4].map(a=>e.jsx("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:188",className:"h-14 bg-gray-100 rounded-xl animate-pulse"},a))}):o?.items?.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:197",className:"divide-y divide-gray-50",children:o.items.map(a=>{const{label:g,color:c,bg:b}=z(a.type),P=a.amount>0;return e.jsxs("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:202",className:"flex items-center gap-3 px-4 py-3",children:[e.jsx("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:203",className:`w-9 h-9 rounded-xl ${b} flex items-center justify-center flex-shrink-0`,children:P?e.jsx(B,{"data-loc":"client/src/pages/GopointRechargePage.tsx:205",size:16,className:"text-green-500"}):e.jsx(H,{"data-loc":"client/src/pages/GopointRechargePage.tsx:206",size:16,className:"text-red-400"})}),e.jsxs("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:208",className:"flex-1 min-w-0",children:[e.jsx("p",{"data-loc":"client/src/pages/GopointRechargePage.tsx:209",className:"text-sm font-medium text-gray-800 truncate",children:a.description||g}),e.jsxs("p",{"data-loc":"client/src/pages/GopointRechargePage.tsx:210",className:"text-xs text-gray-400 mt-0.5",children:[new Date(a.createdAt).toLocaleStr
1ing("zh-HK",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})," · ","é¤é¡ ",(a.balance??0).toLocaleString()," GP"]})]}),e.jsxs("span",{"data-loc":"client/src/pages/GopointRechargePage.tsx:215",className:`text-sm font-bold ${c} flex-shrink-0`,children:[P?"+":"",a.amount.toLocaleString()," GP"]})]},a.id)})}),o.total>20&&e.jsxs("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:223",className:"flex items-center justify-between px-4 py-3 border-t border-gray-50",children:[e.jsx("button",{"data-loc":"client/src/pages/GopointRechargePage.tsx:224",onClick:()=>u(a=>Math.max(1,a-1)),disabled:l===1,className:"text-xs text-gray-500 disabled:text-gray-300 hover:text-amber-600",children:"ä¸ä¸é "}),e.jsxs("span",{"data-loc":"client/src/pages/GopointRechargePage.tsx:226",className:"text-xs text-gray-400",children:["第 ",l," é · å
± ",o.total," æ¢"]}),e.jsx("button",{"data-loc":"client/src/pages/GopointRechargePage.tsx:227",onClick:()=>u(a=>a+1),disabled:l*20>=o.total,className:"text-xs text-gray-500 disabled:text-gray-300 hover:text-amber-600",children:"ä¸ä¸é "})]})]}):e.jsxs("div",{"data-loc":"client/src/pages/GopointRechargePage.tsx:191",className:"text-center py-12",children:[e.jsx(j,{"data-loc":"client/src/pages/GopointRechargePage.tsx:192",size:32,className:"text-gray-200 mx-auto mb-3"}),e.jsx("p",{"data-loc":"client/src/pages/GopointRechargePage.tsx:193",className:"text-sm text-gray-400",children:"æ«ç¡ GoPoint 交æè¨é"})]})})]})]})}export{q 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.