Files
Mycontent/.next/static/chunks/d4d197e7bc986f3d.js
2025-12-29 14:01:37 +08:00

1 line
17 KiB
JavaScript

(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,23750,e=>{"use strict";var a=e.i(43476),t=e.i(47163);function s({className:e,type:s,...r}){return(0,a.jsx)("input",{type:s,"data-slot":"input",className:(0,t.cn)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}e.s(["Input",()=>s])},16715,e=>{"use strict";let a=(0,e.i(75254).default)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",()=>a],16715)},70065,e=>{"use strict";var a=e.i(43476),t=e.i(71645),s=e.i(47163);let r=t.forwardRef(({className:e,...t},r)=>(0,a.jsx)("div",{ref:r,className:(0,s.cn)("rounded-xl border bg-card text-card-foreground shadow",e),...t}));r.displayName="Card";let i=t.forwardRef(({className:e,...t},r)=>(0,a.jsx)("div",{ref:r,className:(0,s.cn)("flex flex-col space-y-1.5 p-6",e),...t}));i.displayName="CardHeader";let l=t.forwardRef(({className:e,...t},r)=>(0,a.jsx)("h3",{ref:r,className:(0,s.cn)("font-semibold leading-none tracking-tight",e),...t}));l.displayName="CardTitle";let n=t.forwardRef(({className:e,...t},r)=>(0,a.jsx)("p",{ref:r,className:(0,s.cn)("text-sm text-muted-foreground",e),...t}));n.displayName="CardDescription";let c=t.forwardRef(({className:e,...t},r)=>(0,a.jsx)("div",{ref:r,className:(0,s.cn)("p-6 pt-0",e),...t}));c.displayName="CardContent",t.forwardRef(({className:e,...t},r)=>(0,a.jsx)("div",{ref:r,className:(0,s.cn)("flex items-center p-6 pt-0",e),...t})).displayName="CardFooter",e.s(["Card",()=>r,"CardContent",()=>c,"CardDescription",()=>n,"CardHeader",()=>i,"CardTitle",()=>l])},10708,48425,e=>{"use strict";var a=e.i(43476),t=e.i(71645),s=e.i(74080),r=e.i(91918),i=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce((e,s)=>{let i=t.forwardRef((e,t)=>{let{asChild:i,...l}=e,n=i?r.Slot:s;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,a.jsx)(n,{...l,ref:t})});return i.displayName=`Primitive.${s}`,{...e,[s]:i}},{});function l(e,a){e&&s.flushSync(()=>e.dispatchEvent(a))}e.s(["Primitive",()=>i,"dispatchDiscreteCustomEvent",()=>l],48425);var n=t.forwardRef((e,t)=>(0,a.jsx)(i.label,{...e,ref:t,onMouseDown:a=>{a.target.closest("button, input, select, textarea")||(e.onMouseDown?.(a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));n.displayName="Label";var c=e.i(47163);let d=t.forwardRef(({className:e,...t},s)=>(0,a.jsx)(n,{ref:s,className:(0,c.cn)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));d.displayName=n.displayName,e.s(["Label",()=>d],10708)},81140,30030,e=>{"use strict";function a(e,t,{checkForDefaultPrevented:s=!0}={}){return function(a){if(e?.(a),!1===s||!a.defaultPrevented)return t?.(a)}}e.s(["composeEventHandlers",()=>a],81140);var t=e.i(71645),s=e.i(43476);function r(e,a=[]){let i=[],l=()=>{let a=i.map(e=>t.createContext(e));return function(s){let r=s?.[e]||a;return t.useMemo(()=>({[`__scope${e}`]:{...s,[e]:r}}),[s,r])}};return l.scopeName=e,[function(a,r){let l=t.createContext(r),n=i.length;i=[...i,r];let c=a=>{let{scope:r,children:i,...c}=a,d=r?.[e]?.[n]||l,o=t.useMemo(()=>c,Object.values(c));return(0,s.jsx)(d.Provider,{value:o,children:i})};return c.displayName=a+"Provider",[c,function(s,i){let c=i?.[e]?.[n]||l,d=t.useContext(c);if(d)return d;if(void 0!==r)return r;throw Error(`\`${s}\` must be used within \`${a}\``)}]},function(...e){let a=e[0];if(1===e.length)return a;let s=()=>{let s=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=s.reduce((a,{useScope:t,scopeName:s})=>{let r=t(e)[`__scope${s}`];return{...a,...r}},{});return t.useMemo(()=>({[`__scope${a.scopeName}`]:r}),[r])}};return s.scopeName=a.scopeName,s}(l,...a)]}e.s(["createContextScope",()=>r],30030)},69340,30207,e=>{"use strict";var a=e.i(71645);function t(e){let t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>(...e)=>t.current?.(...e),[])}function s({prop:e,defaultProp:s,onChange:r=()=>{}}){let[i,l]=function({defaultProp:e,onChange:s}){let r=a.useState(e),[i]=r,l=a.useRef(i),n=t(s);return a.useEffect(()=>{l.current!==i&&(n(i),l.current=i)},[i,l,n]),r}({defaultProp:s,onChange:r}),n=void 0!==e,c=n?e:i,d=t(r);return[c,a.useCallback(a=>{if(n){let t="function"==typeof a?a(e):a;t!==e&&d(t)}else l(a)},[n,e,l,d])]}e.s(["useCallbackRef",()=>t],30207),e.s(["useControllableState",()=>s],69340)},99682,e=>{"use strict";var a=e.i(71645);function t(e){let t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}e.s(["usePrevious",()=>t])},34620,e=>{"use strict";var a=e.i(71645),t=globalThis?.document?a.useLayoutEffect:()=>{};e.s(["useLayoutEffect",()=>t])},35804,e=>{"use strict";var a=e.i(71645),t=e.i(34620);function s(e){let[s,r]=a.useState(void 0);return(0,t.useLayoutEffect)(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let a=new ResizeObserver(a=>{let t,s;if(!Array.isArray(a)||!a.length)return;let i=a[0];if("borderBoxSize"in i){let e=i.borderBoxSize,a=Array.isArray(e)?e[0]:e;t=a.inlineSize,s=a.blockSize}else t=e.offsetWidth,s=e.offsetHeight;r({width:t,height:s})});return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}r(void 0)},[e]),s}e.s(["useSize",()=>s])},19036,e=>{"use strict";var a=e.i(43476),t=e.i(71645),s=e.i(81140),r=e.i(20783),i=e.i(30030),l=e.i(69340),n=e.i(99682),c=e.i(35804),d=e.i(48425),o="Switch",[u,p]=(0,i.createContextScope)(o),[h,x]=u(o),f=t.forwardRef((e,i)=>{let{__scopeSwitch:n,name:c,checked:o,defaultChecked:u,required:p,disabled:x,value:f="on",onCheckedChange:m,form:g,...y}=e,[N,j]=t.useState(null),w=(0,r.useComposedRefs)(i,e=>j(e)),C=t.useRef(!1),k=!N||g||!!N.closest("form"),[S=!1,R]=(0,l.useControllableState)({prop:o,defaultProp:u,onChange:m});return(0,a.jsxs)(h,{scope:n,checked:S,disabled:x,children:[(0,a.jsx)(d.Primitive.button,{type:"button",role:"switch","aria-checked":S,"aria-required":p,"data-state":v(S),"data-disabled":x?"":void 0,disabled:x,value:f,...y,ref:w,onClick:(0,s.composeEventHandlers)(e.onClick,e=>{R(e=>!e),k&&(C.current=e.isPropagationStopped(),C.current||e.stopPropagation())})}),k&&(0,a.jsx)(b,{control:N,bubbles:!C.current,name:c,value:f,checked:S,required:p,disabled:x,form:g,style:{transform:"translateX(-100%)"}})]})});f.displayName=o;var m="SwitchThumb",g=t.forwardRef((e,t)=>{let{__scopeSwitch:s,...r}=e,i=x(m,s);return(0,a.jsx)(d.Primitive.span,{"data-state":v(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})});g.displayName=m;var b=e=>{let{control:s,checked:r,bubbles:i=!0,...l}=e,d=t.useRef(null),o=(0,n.usePrevious)(r),u=(0,c.useSize)(s);return t.useEffect(()=>{let e=d.current,a=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(o!==r&&a){let t=new Event("click",{bubbles:i});a.call(e,r),e.dispatchEvent(t)}},[o,r,i]),(0,a.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...l,tabIndex:-1,ref:d,style:{...e.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function v(e){return e?"checked":"unchecked"}var y=e.i(47163);let N=t.forwardRef(({className:e,...t},s)=>(0,a.jsx)(f,{className:(0,y.cn)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:s,children:(0,a.jsx)(g,{className:(0,y.cn)("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));N.displayName=f.displayName,e.s(["Switch",()=>N],19036)},20170,e=>{"use strict";var a=e.i(43476),t=e.i(71645),s=e.i(4421),r=e.i(67881),i=e.i(23750),l=e.i(10708),n=e.i(19036),c=e.i(70065);let d=(0,e.i(75254).default)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);var o=e.i(16715);function u(){let{settings:e,updateSettings:u,fetchSettings:p}=(0,s.useStore)(),[h,x]=(0,t.useState)(!1),[f,m]=(0,t.useState)(e.paymentMethods);(0,t.useEffect)(()=>{m(e.paymentMethods)},[e.paymentMethods]);let g=async()=>{x(!0),u({paymentMethods:f}),await new Promise(e=>setTimeout(e,800)),x(!1),alert("配置已保存!")},b=async()=>{x(!0),await p(),x(!1)},v=(e,a)=>{m(t=>({...t,wechat:{...t.wechat,[e]:a}}))},y=(e,a)=>{m(t=>({...t,alipay:{...t.alipay,[e]:a}}))},N=(e,a)=>{m(t=>({...t,usdt:{...t.usdt,[e]:a}}))};return(0,a.jsxs)("div",{className:"p-8 max-w-5xl mx-auto text-white",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-8",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold mb-2",children:"支付配置"}),(0,a.jsx)("p",{className:"text-gray-400",children:"配置微信、支付宝及USDT支付参数"})]}),(0,a.jsxs)("div",{className:"flex gap-4",children:[(0,a.jsxs)(r.Button,{variant:"outline",onClick:b,className:"border-gray-600 text-gray-300 hover:text-white bg-transparent",children:[(0,a.jsx)(o.RefreshCw,{className:`w-4 h-4 mr-2 ${h?"animate-spin":""}`}),"同步配置"]}),(0,a.jsxs)(r.Button,{onClick:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[(0,a.jsx)(d,{className:"w-4 h-4 mr-2"}),"保存配置"]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-8",children:[(0,a.jsxs)(c.Card,{className:"bg-[#1e293b] border-gray-700",children:[(0,a.jsxs)(c.CardHeader,{className:"flex flex-row items-center justify-between pb-2",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(c.CardTitle,{className:"text-[#07C160] flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"w-6 h-6",fill:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 0 0 .167-.054l1.903-1.114a.864.864 0 0 1 .717-.098 10.16 10.16 0 0 0 2.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178A1.17 1.17 0 0 1 4.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178 1.17 1.17 0 0 1-1.162-1.178c0-.651.52-1.18 1.162-1.18zm5.34 2.867c-1.797-.052-3.746.512-5.28 1.786-1.72 1.428-2.687 3.72-1.78 6.22.942 2.453 3.666 4.229 6.884 4.229.826 0 1.622-.12 2.361-.336a.722.722 0 0 1 .598.082l1.584.926a.272.272 0 0 0 .14.047c.134 0 .24-.111.24-.247 0-.06-.023-.12-.038-.177l-.327-1.233a.582.582 0 0 1-.023-.156.49.49 0 0 1 .201-.398C23.024 18.48 24 16.82 24 14.98c0-3.21-2.931-5.837-6.656-6.088V8.89c-.135-.01-.269-.03-.406-.03zm-2.53 3.274c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.97-.982zm4.844 0c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.969-.982z"})}),"微信支付"]}),(0,a.jsx)(c.CardDescription,{className:"text-gray-400",children:"配置微信商户号及API密钥"})]}),(0,a.jsx)(n.Switch,{checked:f.wechat.enabled,onCheckedChange:e=>v("enabled",e)})]}),(0,a.jsxs)(c.CardContent,{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(l.Label,{className:"text-gray-300",children:"网站应用 AppID"}),(0,a.jsx)(i.Input,{className:"bg-[#0f172a] border-gray-600 text-white",placeholder:"wx...",value:f.wechat.websiteAppId||"",onChange:e=>v("websiteAppId",e.target.value)})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(l.Label,{className:"text-gray-300",children:"网站应用 AppSecret"}),(0,a.jsx)(i.Input,{type:"password",className:"bg-[#0f172a] border-gray-600 text-white",placeholder:"......",value:f.wechat.websiteAppSecret||"",onChange:e=>v("websiteAppSecret",e.target.value)})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(l.Label,{className:"text-gray-300",children:"商户号 (MchId)"}),(0,a.jsx)(i.Input,{className:"bg-[#0f172a] border-gray-600 text-white",placeholder:"160...",value:f.wechat.merchantId||"",onChange:e=>v("merchantId",e.target.value)})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(l.Label,{className:"text-gray-300",children:"API v3 密钥"}),(0,a.jsx)(i.Input,{type:"password",className:"bg-[#0f172a] border-gray-600 text-white",placeholder:"......",value:f.wechat.apiKey||"",onChange:e=>v("apiKey",e.target.value)})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(l.Label,{className:"text-gray-300",children:"个人收款码 URL (兜底方案)"}),(0,a.jsx)(i.Input,{className:"bg-[#0f172a] border-gray-600 text-white",placeholder:"/images/wechat-pay.png",value:f.wechat.qrCode||"",onChange:e=>v("qrCode",e.target.value)}),(0,a.jsx)("p",{className:"text-xs text-gray-500",children:"当未配置企业支付参数时,将显示此二维码进行个人收款"})]})]})]}),(0,a.jsxs)(c.Card,{className:"bg-[#1e293b] border-gray-700",children:[(0,a.jsxs)(c.CardHeader,{className:"flex flex-row items-center justify-between pb-2",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(c.CardTitle,{className:"text-[#1677FF] flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"w-6 h-6",fill:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M8.77 20.62l9.92-4.33c-.12-.33-.24-.66-.38-.99-.14-.33-.3-.66-.47-.99H8.08c-2.2 0-3.99-1.79-3.99-3.99V8.08c0-2.2 1.79-3.99 3.99-3.99h7.84c2.2 0 3.99 1.79 3.99 3.99v2.24h-8.66c-.55 0-1 .45-1 1s.45 1 1 1h10.66c-.18 1.73-.71 3.36-1.53 4.83l-2.76 1.2c-.74-1.69-1.74-3.24-2.93-4.6-.52-.59-1.11-1.13-1.76-1.59H4.09v4.24c0 2.2 1.79 3.99 3.99 3.99h.69v.23z"})}),"支付宝"]}),(0,a.jsx)(c.CardDescription,{className:"text-gray-400",children:"配置支付宝PID及密钥"})]}),(0,a.jsx)(n.Switch,{checked:f.alipay.enabled,onCheckedChange:e=>y("enabled",e)})]}),(0,a.jsxs)(c.CardContent,{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(l.Label,{className:"text-gray-300",children:"合作者身份 (PID)"}),(0,a.jsx)(i.Input,{className:"bg-[#0f172a] border-gray-600 text-white",placeholder:"2088...",value:f.alipay.partnerId||"",onChange:e=>y("partnerId",e.target.value)})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(l.Label,{className:"text-gray-300",children:"安全校验码 (Key)"}),(0,a.jsx)(i.Input,{type:"password",className:"bg-[#0f172a] border-gray-600 text-white",placeholder:"......",value:f.alipay.securityKey||"",onChange:e=>y("securityKey",e.target.value)})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(l.Label,{className:"text-gray-300",children:"个人收款码 URL (兜底方案)"}),(0,a.jsx)(i.Input,{className:"bg-[#0f172a] border-gray-600 text-white",placeholder:"/images/alipay.png",value:f.alipay.qrCode||"",onChange:e=>y("qrCode",e.target.value)})]})]})]}),(0,a.jsxs)(c.Card,{className:"bg-[#1e293b] border-gray-700",children:[(0,a.jsxs)(c.CardHeader,{className:"flex flex-row items-center justify-between pb-2",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(c.CardTitle,{className:"text-[#26A17B] flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-bold",children:"₮"})," USDT支付"]}),(0,a.jsx)(c.CardDescription,{className:"text-gray-400",children:"配置区块链钱包地址"})]}),(0,a.jsx)(n.Switch,{checked:f.usdt.enabled,onCheckedChange:e=>N("enabled",e)})]}),(0,a.jsxs)(c.CardContent,{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(l.Label,{className:"text-gray-300",children:"网络协议"}),(0,a.jsx)(i.Input,{className:"bg-[#0f172a] border-gray-600 text-white",value:f.usdt.network||"TRC20",onChange:e=>N("network",e.target.value)})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(l.Label,{className:"text-gray-300",children:"汇率 (USD -> CNY)"}),(0,a.jsx)(i.Input,{type:"number",className:"bg-[#0f172a] border-gray-600 text-white",value:f.usdt.exchangeRate||7.2,onChange:e=>N("exchangeRate",parseFloat(e.target.value))})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(l.Label,{className:"text-gray-300",children:"钱包地址"}),(0,a.jsx)(i.Input,{className:"bg-[#0f172a] border-gray-600 text-white font-mono",placeholder:"T...",value:f.usdt.address||"",onChange:e=>N("address",e.target.value)})]})]})]})]})]})}e.s(["default",()=>u],20170)}]);