best-unit 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -57,7 +57,7 @@
57
57
  .custom-select-dropdown::-webkit-scrollbar-track {
58
58
  background: ${_.scrollbarTrack};
59
59
  }
60
- `}),h("div",{onClick:()=>!i&&m(x=>!x),style:{minHeight:40,borderRadius:6,display:"flex",alignItems:"center",padding:"0 12px",fontSize:15,cursor:i?"not-allowed":"pointer",boxSizing:"border-box",transition:"border 0.2s",opacity:i?.6:1,width:"100%",...w(),...o},tabIndex:0,children:[h("span",{style:{flex:1},children:y?y.label:h("span",{style:_.placeholder,children:r||"请选择"})}),h("span",{style:{marginLeft:8,display:"flex",alignItems:"center"},children:h("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h("path",{d:"M6 8L10 12L14 8",stroke:"#bfbfbf","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})})})]}),c&&!i&&h("div",{className:`custom-select-dropdown${l?" "+l:""}`,style:{position:"absolute",left:0,right:0,top:44,zIndex:10,borderRadius:6,boxShadow:_.boxShadow,maxHeight:220,overflowY:"auto",..._.dropdown,...a},children:[n.length===0&&h("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:120,width:"100%",userSelect:"none"},children:[h("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[h("title",{children:E("暂无数据")}),h("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd",children:[h("ellipse",{fill:"#f5f5f5",cx:"32",cy:"33",rx:"32",ry:"7"}),h("g",{fillRule:"nonzero",stroke:"#d9d9d9",children:[h("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),h("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:"#fafafa"})]})]})]}),h("div",{style:{marginTop:8,color:"#bfbfbf",fontSize:15},children:E("暂无数据")})]}),n.map((x,k)=>h("div",{onClick:()=>{x.disabled||(m(!1),t?.(x.value))},onMouseEnter:()=>g(k),onMouseLeave:()=>g(null),style:{padding:"10px 16px",cursor:x.disabled?"not-allowed":"pointer",fontWeight:e===x.value?600:400,opacity:x.disabled?.6:1,..._.option(e===x.value,!!x.disabled,b===k)},children:x.label},x.value))]}),d]})},Dt={white:{label:{marginBottom:8,fontSize:14,color:"#222",textAlign:"left",display:"block"},input:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},selectError:{border:"1px solid #ff4d4f"},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"},buttonCancel:{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},buttonSubmit:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600},feeTip:{marginBottom:24,padding:"12px 16px",background:"#f6ffed",border:"1px solid #b7eb8f",borderRadius:6,fontSize:14,color:"#52c41a"}},dark:{label:{marginBottom:8,fontSize:14,color:"#fff",textAlign:"left",display:"block"},input:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #23262F",background:"#23262F",color:"#fff",fontSize:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},selectError:{border:"1px solid #ff4d4f"},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"},buttonCancel:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},buttonSubmit:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600},feeTip:{marginBottom:24,padding:"12px 16px",background:"#1a1a1a",border:"1px solid #333",borderRadius:6,fontSize:14,color:"#52c41a"}}};function $o(){return L("theme")===N.WHITE?Dt.white:Dt.dark}function Wo(e){return e=e.replace(/[^\d.]/g,""),e=e.replace(/\.(?=.*\.)/g,""),e=e.replace(/^(\d+)(\.\d{0,2})?.*$/,"$1$2"),e=e.replace(/^0+(\d)/,"$1"),e.startsWith(".")&&(e="0"+e),e}function qo(e){if(!e)return"";const t=parseFloat(e);return isNaN(t)?"":t.toFixed(2)}const Jo=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}"),s=o?.currency||[],i=o?.channel?.filter(m=>m.payment_support)||[],[a,u]=B(""),[l,d]=B(!1),c=$o();return ae(()=>{e.currency&&e.amount&&e.rechargeChannel?Oo({channel:e.rechargeChannel,amount:e.amount,currency:e.currency}).then(m=>{u(m),d(!0)}).catch(m=>{console.error("计算支付金额失败:",m),d(!1)}):d(!1)},[e.currency,e.amount,e.rechargeChannel]),h(G,{children:[h("div",{style:{marginBottom:18},children:[h("div",{style:c.label,children:[h("span",{style:{color:"#F53F3F"},children:"*"})," ",E("充值币种")]}),h(Xe,{value:e.currency,onChange:m=>{t(p=>({...p,currency:m}))},options:s?.map(m=>({value:m.value,label:m.label})),placeholder:E("请选择充值币种")})]}),h("div",{style:{marginBottom:18},children:[h("div",{style:c.label,children:[h("span",{style:{color:"#F53F3F"},children:"*"})," ",E("充值金额")]}),h("input",{type:"text",placeholder:E("请输入充值金额"),value:e.amount,onInput:m=>{let p=m.target.value;p=Wo(p);let b="";if(p&&!p.endsWith(".")){let g=parseFloat(p);if(!isNaN(g)&&(g<1&&(g=1),g>999999.99&&(g=999999.99),p=g.toString(),/\./.test(m.target.value))){const _=m.target.value.split(".")[1];_!==void 0&&_.length>0&&(p=g.toFixed(Math.min(_.length,2)))}}t(g=>({...g,amount:p,amountError:b}))},onBlur:m=>{let p=m.target.value;p=qo(p),t(b=>({...b,amount:p,amountError:""}))},style:{...c.input,...e.amountError?c.inputError:{}}}),e.amountError&&h("div",{style:c.error,children:e.amountError})]}),h("div",{style:{marginBottom:24},children:[h("div",{style:c.label,children:[h("span",{style:{color:"#F53F3F"},children:"*"})," ",E("支付平台")]}),h(Xe,{value:e.rechargeChannel,onChange:m=>{t(p=>({...p,rechargeChannel:m,rechargeChannelError:m?"":p.rechargeChannelError}))},options:i?.map(m=>({value:m.value,label:m.label})),placeholder:E("请选择支付平台")}),e.rechargeChannelError&&h("div",{style:c.error,children:e.rechargeChannelError})]}),l&&a&&h("div",{style:c.feeTip,children:[i.find(m=>m.value===e.rechargeChannel)?.label||e.rechargeChannel,E("需要收取手续费,实际支付金额约为:"),"$",a]}),e.error&&h("div",{style:{color:"#ff4d4f",marginBottom:12},children:e.error}),h("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[h("button",{type:"button",onClick:n,style:c.buttonCancel,children:E("取消")}),h("button",{type:"submit",disabled:r,style:c.buttonSubmit,children:E(r?"提交中...":"去支付")})]})]})},Nt={white:{container:{border:"1px dashed #E5E6EB",borderRadius:8,background:"#FCFCFD",padding:24,textAlign:"center",cursor:"pointer",minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:15},fileItem:{display:"flex",alignItems:"center",background:"#F7F8FA",borderRadius:8,padding:"12px 16px",marginBottom:8,fontSize:15,color:"#222",justifyContent:"space-between"},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:"4px 14px",fontSize:15,marginLeft:16,cursor:"pointer"}},dark:{container:{border:"1.5px dashed #444C5C",borderRadius:8,background:"#181A20",padding:24,textAlign:"center",cursor:"pointer",minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:15},fileItem:{display:"flex",alignItems:"center",background:"#23262F",borderRadius:8,padding:"12px 16px",marginBottom:8,fontSize:15,color:"#fff",justifyContent:"space-between"},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:"4px 14px",fontSize:15,marginLeft:16,cursor:"pointer"}}};function Vo(){return L("theme")===N.WHITE?Nt.white:Nt.dark}const Go=({value:e=[],onChange:t,maxCount:n=10,accept:r=".jpg,.jpeg,.png,.pdf",multiple:o=!0,disabled:s=!1})=>{const i=Se(null),[a,u]=B(!1),[l,d]=B(0),c=Vo(),m=async b=>{const g=Array.from(b.target.files).slice(0,n);if(!g.length)return;u(!0);const _=[];for(let y=0;y<g.length;y++){d(0);const w=new FormData;w.append("file",g[y]);try{const x=await Ao(w,k=>d(k));x&&_.push(x)}catch{}}u(!1),d(0),t?.([...e,..._]),i.current&&(i.current.value="")},p=b=>{const g=e.filter((_,y)=>y!==b);t?.(g)};return h("div",{children:[h("div",{style:{...c.container,cursor:s?"not-allowed":c.container.cursor,opacity:s?.6:1},onClick:()=>!s&&i.current?.click(),children:[h("div",{style:{fontSize:48,marginBottom:12},children:"📁"}),h("div",{style:{color:"#222",fontSize:15,marginBottom:4},children:E("点击或拖拽文件到此处上传")}),h("div",{style:{color:"#999",fontSize:13},children:[E("支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传")," ",n," ",E("个文件")]}),h("input",{ref:i,type:"file",multiple:o,accept:r,style:{display:"none"},onChange:m,disabled:s}),a&&h("div",{style:{marginTop:12,color:"#1677ff"},children:[E("正在上传...")," ",l,"%"]})]}),e&&e.length>0&&h("div",{style:{marginTop:12},children:e.map((b,g)=>h("div",{style:c.fileItem,children:[h("div",{style:{display:"flex",alignItems:"center",flex:1},children:[h("span",{style:{fontWeight:500,wordBreak:"break-all"},children:b.split("/").pop()}),h("span",{style:{color:"#8C8F93",fontSize:13,marginLeft:8},children:["[",E("已上传"),"]"]})]}),h("button",{type:"button",onClick:_=>{_.stopPropagation(),p(g)},style:c.removeBtn,disabled:s,children:E("移除")})]},b))})]})},It={white:{label:{marginBottom:8,fontSize:14,color:"#222",textAlign:"left",display:"block"},input:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},select:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:15,outline:"none"},selectError:{border:"1px solid #ff4d4f"},upload:{border:"1px dashed #E5E6EB",borderRadius:8,background:"#FCFCFD",padding:24,textAlign:"center",cursor:"pointer",minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:15},uploadError:{border:"1px dashed #ff4d4f"},fileItem:{display:"flex",alignItems:"center",background:"#F7F8FA",borderRadius:8,padding:"12px 16px",marginBottom:8,fontSize:15,color:"#222",justifyContent:"space-between"},buttonCancel:{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},buttonSubmit:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:"4px 14px",fontSize:15,marginLeft:16,cursor:"pointer"},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}},dark:{label:{marginBottom:8,fontSize:14,color:"#fff",textAlign:"left",display:"block"},input:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #23262F",background:"#23262F",color:"#fff",fontSize:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},select:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid #23262F",background:"#23262F",color:"#fff",fontSize:15,outline:"none"},selectError:{border:"1px solid #ff4d4f"},upload:{border:"1px dashed #23262F",borderRadius:8,background:"#181A20",padding:24,textAlign:"center",cursor:"pointer",minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:15},uploadError:{border:"1px dashed #ff4d4f"},fileItem:{display:"flex",alignItems:"center",background:"#23262F",borderRadius:8,padding:"12px 16px",marginBottom:8,fontSize:15,color:"#fff",justifyContent:"space-between"},buttonCancel:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},buttonSubmit:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:"4px 14px",fontSize:15,marginLeft:16,cursor:"pointer"},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}}};function Ko(){return L("theme")===N.WHITE?It.white:It.dark}const Xo=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}");console.log(o,"allDicts");const s=o?.channel||[],i=Ko();return h("form",{onSubmit:async u=>{u.preventDefault();let l=!0;t(d=>({...d,platformError:"",transactionIdError:"",filesError:""})),e.platform||(t(d=>({...d,platformError:E("请选择支付平台")})),l=!1),e.transactionId.trim()||(t(d=>({...d,transactionIdError:E("请输入转账交易ID")})),l=!1),(!e.files||e.files.length===0)&&(t(d=>({...d,filesError:E("请上传转账凭证")})),l=!1),l&&(await Fo({transferChannel:e.platform,transferNo:e.transactionId,voucherUrls:e.files}),n(),Ke.success(E("离线充值创建成功")))},children:[h("div",{style:{marginBottom:18},children:[h("div",{style:i.label,children:[h("span",{style:{color:"#F53F3F"},children:"*"})," ",E("第三方支付平台")]}),h(Xe,{value:e.platform,onChange:u=>{t(l=>({...l,platform:u,platformError:u?"":l.platformError}))},options:[...s?.map(u=>({value:u.value,label:u.label}))],placeholder:E("请选择支付平台")}),e.platformError&&h("div",{style:i.error,children:e.platformError})]}),h("div",{style:{marginBottom:18},children:[h("div",{style:i.label,children:[h("span",{style:{color:"#F53F3F"},children:"*"})," ",E("交易ID")]}),h("input",{type:"text",placeholder:E("请输入转账交易ID"),value:e.transactionId,maxLength:200,onInput:u=>{let l=u.target.value;l.length>200&&(l=l.slice(0,200)),t(d=>({...d,transactionId:l,transactionIdError:l?"":d.transactionIdError}))},style:{...i.input,...e.transactionIdError?i.inputError:{}}}),e.transactionIdError&&h("div",{style:i.error,children:e.transactionIdError})]}),h("div",{style:{marginBottom:24},children:[h("div",{style:i.label,children:[h("span",{style:{color:"#F53F3F"},children:"*"})," ",E("上传文件")]}),h(Go,{value:e.files,onChange:u=>t(l=>({...l,files:u,filesError:""})),maxCount:10,accept:".jpg,.jpeg,.png,.pdf",multiple:!0}),e.filesError&&h("div",{style:i.error,children:e.filesError})]}),h("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[h("button",{type:"button",onClick:n,style:i.buttonCancel,children:E("取消")}),h("button",{type:"submit",disabled:r,style:i.buttonSubmit,children:E("去支付")})]})]})},Lt={white:{mask:"rgba(0, 0, 0, 0.45)",modalBg:"#fff",modalColor:"#222",modalBoxShadow:"0 6px 16px rgba(0, 0, 0, 0.12)",closeBtn:{position:"absolute",top:"16px",right:"16px",background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#999",padding:"0",width:"24px",height:"24px",display:"flex",alignItems:"center",justifyContent:"center"},title:{fontSize:"18px",fontWeight:"600",marginBottom:"24px",color:"#222"},tabBtn:(e,t)=>({flex:1,padding:"12px 16px",background:e?"#1890ff":"transparent",color:e?"#fff":"#666",border:"1px solid #d9d9d9",borderRight:t?"none":"1px solid #d9d9d9",cursor:"pointer",fontSize:"14px",fontWeight:e?"600":"400",borderRadius:t?"6px 0 0 6px":"0 6px 6px 0"})},dark:{mask:"rgba(0, 0, 0, 0.65)",modalBg:"#23262F",modalColor:"#F5F6FA",modalBoxShadow:"0 6px 16px rgba(0,0,0,0.32)",closeBtn:{position:"absolute",top:"16px",right:"16px",background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#B5B8BE",padding:"0",width:"24px",height:"24px",display:"flex",alignItems:"center",justifyContent:"center"},title:{fontSize:"18px",fontWeight:"600",marginBottom:"24px",color:"#F5F6FA"},tabBtn:(e,t)=>({flex:1,padding:"12px 16px",background:e?"#00E8C6":"transparent",color:e?"#fff":"#B5B8BE",border:"1px solid #444C5C",borderRight:t?"none":"1px solid #444C5C",cursor:"pointer",fontSize:"14px",fontWeight:e?"600":"400",borderRadius:t?"6px 0 0 6px":"0 6px 6px 0"})}};function Zo(){return L("theme")===N.WHITE?Lt.white:Lt.dark}function Qo({visible:e,onClose:t,title:n,children:r,width:o=400,maxWidth:s=400,showClose:i=!0,maskClosable:a=!0}){const[u,l]=B(!1),d=Zo(),c=p=>{p.target===p.currentTarget?l(!0):l(!1)},m=p=>{p.target===p.currentTarget&&u&&a&&t(),l(!1)};return e?h("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:d.mask,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},onMouseDown:c,onMouseUp:m,children:h("div",{style:{background:d.modalBg,padding:32,borderRadius:12,minWidth:o,maxWidth:s,color:d.modalColor,boxShadow:d.modalBoxShadow,position:"relative"},onClick:p=>p.stopPropagation(),children:[i&&h("button",{type:"button",onClick:t,style:d.closeBtn,"aria-label":"关闭",children:"×"}),n&&h("div",{style:d.title,children:n}),r]})}):null}const Ut={white:{tabBtn:(e,t)=>({flex:1,background:e?"#fff":"#F7F8FA",color:e?"#1890ff":"#222",border:"none",borderRadius:t?"8px 0 0 8px":"0 8px 8px 0",fontWeight:e?600:400,fontSize:16,height:48,boxShadow:e?"0 2px 8px 0 rgba(20,20,20,0.04)":"none",outline:"none",cursor:"pointer",borderRight:t?"1px solid #F0F1F3":void 0,borderLeft:t?void 0:"1px solid #F0F1F3",transition:"all 0.2s"})},dark:{tabBtn:(e,t)=>({flex:1,background:e?"#23262F":"#181A20",color:e?"#00E8C6":"#fff",border:"none",borderRadius:t?"8px 0 0 8px":"0 8px 8px 0",fontWeight:e?600:400,fontSize:16,height:48,boxShadow:e?"0 2px 8px 0 rgba(20,20,20,0.10)":"none",outline:"none",cursor:"pointer",borderRight:t?"1px solid #23262F":void 0,borderLeft:t?void 0:"1px solid #23262F",transition:"all 0.2s"})}};function Yo(){return L("theme")===N.WHITE?Ut.white:Ut.dark}function ei({visible:e,onClose:t,onSubmit:n}){const[r,o]=B({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),[s,i]=B({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}),[a,u]=B("online"),l=Yo();ae(()=>{e||(u("online"),o({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),i({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}))},[e]);const d=async c=>{c.preventDefault();let m=!0;if(o(p=>({...p,amountError:"",rechargeChannelError:""})),r.amount.trim()||(o(p=>({...p,amountError:E("请输入充值金额")})),m=!1),r.rechargeChannel||(o(p=>({...p,rechargeChannelError:E("请选择支付平台")})),m=!1),!!m){o(p=>({...p,loading:!0,error:""}));try{await n({amount:r.amount,rechargeChannel:r.rechargeChannel,currency:r.currency}),t()}catch{o(p=>({...p,error:E("提交失败,请重试")}))}finally{o(p=>({...p,loading:!1}))}}};return h(Qo,{visible:e,onClose:t,title:E("充值 / 转账"),children:[h("div",{style:{display:"flex",marginBottom:28},children:[h("button",{type:"button",onClick:()=>u("online"),style:l.tabBtn(a==="online",!0),children:E("在线充值")}),h("button",{type:"button",onClick:()=>u("offline"),style:l.tabBtn(a==="offline",!1),children:E("线下转账")})]}),a==="online"?h("form",{onSubmit:d,children:h(Jo,{formState:r,setFormState:o,onClose:t,loading:r.loading})}):h(Xo,{formState:s,setFormState:i,onClose:t,loading:s.loading})]})}function it(){return(it=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var ti=["context","children"];function ni(e){this.getChildContext=function(){return e.context};var t=e.children,n=function(r,o){if(r==null)return{};var s,i,a={},u=Object.keys(r);for(i=0;i<u.length;i++)o.indexOf(s=u[i])>=0||(a[s]=r[s]);return a}(e,ti);return Rn(t,n)}function ri(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=X(ni,it({},this._props,{context:e.detail.context}),function t(n,r){if(n.nodeType===3)return n.data;if(n.nodeType!==1)return null;var o=[],s={},i=0,a=n.attributes,u=n.childNodes;for(i=a.length;i--;)a[i].name!=="slot"&&(s[a[i].name]=a[i].value,s[Dn(a[i].name)]=a[i].value);for(i=u.length;i--;){var l=t(u[i],null),d=u[i].slot;d?s[d]=X(zt,{name:d},l):o[i]=l}var c=r?X(zt,null,o):o;return X(r||n.nodeName.toLowerCase(),s,c)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?Tn:Pe)(this._vdom,this._root)}function Dn(e){return e.replace(/-(\w)/g,function(t,n){return n?n.toUpperCase():""})}function oi(e,t,n){if(this._vdom){var r={};r[e]=n=n??void 0,r[Dn(e)]=n,this._vdom=Rn(this._vdom,r),Pe(this._vdom,this._root)}}function ii(){Pe(this._vdom=null,this._root)}function zt(e,t){var n=this;return X("slot",it({},e,{ref:function(r){r?(n.ref=r,n._listener||(n._listener=function(o){o.stopPropagation(),o.detail.context=t},r.addEventListener("_preact",n._listener))):n.ref.removeEventListener("_preact",n._listener)}}))}function st(e,t,n,r){function o(){var s=Reflect.construct(HTMLElement,[],o);return s._vdomComponent=e,s._root=r&&r.shadow?s.attachShadow({mode:r.mode||"open"}):s,s}return(o.prototype=Object.create(HTMLElement.prototype)).constructor=o,o.prototype.connectedCallback=ri,o.prototype.attributeChangedCallback=oi,o.prototype.disconnectedCallback=ii,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),o.observedAttributes=n,n.forEach(function(s){Object.defineProperty(o.prototype,s,{get:function(){return this._vdom.props[s]},set:function(i){this._vdom?this.attributeChangedCallback(s,null,i):(this._props||(this._props={}),this._props[s]=i,this.connectedCallback());var a=typeof i;i!=null&&a!=="string"&&a!=="boolean"&&a!=="number"||this.setAttribute(s,i)}})}),customElements.define(t||e.tagName||e.displayName||e.name,o)}function si(){const[e,t]=B(!1),n=async r=>{const o=await Bo({amount:r.amount,currency:r.currency,rechargeChannel:r.rechargeChannel});window.open(o,"_blank")};return h("div",{children:[h(Pn,{onClick:()=>t(!0),children:E("充值/转账")}),h(ei,{visible:e,onClose:()=>t(!1),onSubmit:n})]})}st(si,"best-recharge",["theme"],{shadow:!1});const Ht={white:{popover:{background:"#fff",color:"#222",boxShadow:"0 4px 16px rgba(0,0,0,0.12)",border:"none"},arrow:{top:"#fff",bottom:"#fff",left:"#fff",right:"#fff"}},dark:{popover:{background:"#23262F",color:"#fff",boxShadow:"0 4px 16px rgba(0,0,0,0.32)",border:"1px solid #444C5C"},arrow:{top:"#23262F",bottom:"#23262F",left:"#23262F",right:"#23262F"}}};function ai(){return L("theme")===N.WHITE?Ht.white:Ht.dark}const li=({popover:e,children:t,popoverWidth:n=300,popoverMinWidth:r=200,offsetY:o=16,offsetX:s=16,popoverPosition:i="top"})=>{const[a,u]=B(!1),[l,d]=B(i),c=Se(null),m=Se(null),p=ai(),b=()=>{if(m.current&&(clearTimeout(m.current),m.current=null),i==="top"||i==="bottom")if(c.current){const w=c.current.getBoundingClientRect();i==="top"&&w.top<100?d("bottom"):i==="bottom"&&window.innerHeight-w.bottom<100?d("top"):d(i)}else d(i);else d(i);u(!0)},g=()=>{m.current=window.setTimeout(()=>{u(!1)},120)};let _={position:"absolute",zIndex:999,borderRadius:6,fontSize:15,minWidth:r,width:n,padding:"8px 14px",pointerEvents:"auto",textAlign:"center",animation:"fadeInUp 0.3s",...p.popover},y={position:"absolute",zIndex:11,width:0,height:0};return l==="top"?(_={..._,left:"50%",top:-48,transform:"translateX(-50%)"},y={...y,left:"50%",bottom:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderTop:`8px solid ${p.arrow.top}`}):l==="bottom"?(_={..._,left:"50%",top:"100%",marginTop:o,transform:"translateX(-50%)"},y={...y,left:"50%",top:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:`8px solid ${p.arrow.bottom}`}):l==="leftTop"?(_={..._,right:"100%",top:0,marginRight:s,transform:"none"},y={...y,right:-8,top:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderLeft:`8px solid ${p.arrow.left}`}):l==="rightTop"&&(_={..._,left:"100%",top:0,marginLeft:s,transform:"translateY(0)"},y={...y,left:-8,top:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderRight:`8px solid ${p.arrow.right}`}),h("div",{ref:c,style:{position:"relative",display:"inline-block"},onMouseEnter:b,onMouseLeave:g,children:[t,a&&h("div",{style:_,onMouseEnter:b,onMouseLeave:g,children:[e,h("div",{style:y})]})]})},Mt={white:{popoverTitle:{fontSize:16,fontWeight:600,color:"#222",marginBottom:16,textAlign:"center"},detailRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 0",borderBottom:"1px solid #e5e7eb",fontSize:15},detailLabel:{display:"flex",alignItems:"center",color:"#6b7280",fontWeight:500},detailDot:e=>({display:"inline-block",width:8,height:8,borderRadius:"50%",background:e,marginRight:8}),detailValue:e=>({color:e,fontWeight:600,fontSize:15}),main:{fontSize:24,fontWeight:800,color:"#111827",display:"inline-block"},currency:{fontSize:18,color:"#6b7280",marginLeft:8,fontWeight:600}},dark:{popoverTitle:{fontSize:16,fontWeight:600,color:"#fff",marginBottom:16,textAlign:"center"},detailRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 0",borderBottom:"1px solid #374151",fontSize:15},detailLabel:{display:"flex",alignItems:"center",color:"#B5B8BE",fontWeight:500},detailDot:e=>({display:"inline-block",width:8,height:8,borderRadius:"50%",background:e,marginRight:8}),detailValue:e=>({color:e,fontWeight:600,fontSize:15}),main:{fontSize:24,fontWeight:800,color:"#fff",display:"inline-block"},currency:{fontSize:18,color:"#B5B8BE",marginLeft:8,fontWeight:600}}};function ci(){return L("theme")===N.WHITE?Mt.white:Mt.dark}function jt(e){return e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}function ui(e){const[t,n]=B({available:0,currency:"USD",symbol:"$",details:[]}),r=async()=>{try{const i=await Bn(),a=[{label:"",value:i.availableAmount,color:"#15b36b",dot:"#15b36b"},{label:"",value:i.frozenAmount,color:"#f59e0b",dot:"#f59e0b"},...i.isCredit?[{label:"",value:i.creditLimit,color:"#1890ff",dot:"#1890ff"},{label:"",value:i.creditUsed,color:"#ff0000",dot:"#ff0000"}]:[],{label:"",value:i.totalAmount,color:"#1890ff",dot:"#15b36b"}],u={available:i.availableAmount,currency:"USD",symbol:"$",details:a};n(u)}catch(i){console.error("获取余额失败:",i)}};ae(()=>{r()},[]),ae(()=>{const i=()=>{r()};return document.addEventListener("refresh-balance",i),()=>{document.removeEventListener("refresh-balance",i)}},[]);const o=ci(),s=[{label:E("真实金额"),value:t.details[0]?.value||0,color:"#15b36b",dot:"#15b36b"},{label:E("冻结金额"),value:t.details[1]?.value||0,color:"#f59e0b",dot:"#f59e0b"},...t.details.length>4?[{label:E("信用额度"),value:t.details[2]?.value||0,color:"#1890ff",dot:"#1890ff"},{label:E("已用额度"),value:t.details[3]?.value||0,color:"#ff0000",dot:"#ff0000"}]:[],{label:E("可用余额"),value:t.details[t.details.length-1]?.value||0,color:"#1890ff",dot:"#15b36b"}];return h(li,{popover:h(G,{children:[h("div",{style:o.popoverTitle,children:E("余额详情")}),s.map(i=>h("div",{style:o.detailRow,children:[h("span",{style:o.detailLabel,children:[h("span",{style:o.detailDot(i.dot)}),i.label]}),h("span",{style:o.detailValue(i.color),children:[t.symbol,jt(i.value)]})]},i.label))]}),popoverPosition:e.popoverPosition||"bottom",children:h("div",{style:o.main,children:[t.symbol,jt(t.available),h("span",{style:o.currency,children:t.currency})]})})}st(ui,"best-statistical-balance");const pe={white:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,cursor:"pointer",fontWeight:600,transition:"all 0.2s ease"},dark:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,cursor:"pointer",fontWeight:600,transition:"all 0.2s ease"}};function di(e){return L("theme")===N.WHITE?{...pe.white,background:e||pe.white.background}:{...pe.dark,background:e||pe.dark.background}}function fi(e){switch(e){case"small":return{fontSize:"12px",gap:"2px"};case"large":return{fontSize:"18px",gap:"6px"};default:return{fontSize:"14px",gap:"4px"}}}function pi({color:e,size:t="medium",children:n}){const[r,o]=B(!1),s=di(e),i=fi(t),a={...s,...i,display:"flex",alignItems:"center"};return h(G,{children:[h("style",{children:`
60
+ `}),h("div",{onClick:()=>!i&&m(x=>!x),style:{minHeight:40,borderRadius:6,display:"flex",alignItems:"center",padding:"0 12px",fontSize:15,cursor:i?"not-allowed":"pointer",boxSizing:"border-box",transition:"border 0.2s",opacity:i?.6:1,width:"100%",...w(),...o},tabIndex:0,children:[h("span",{style:{flex:1},children:y?y.label:h("span",{style:_.placeholder,children:r||"请选择"})}),h("span",{style:{marginLeft:8,display:"flex",alignItems:"center"},children:h("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h("path",{d:"M6 8L10 12L14 8",stroke:"#bfbfbf","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})})})]}),c&&!i&&h("div",{className:`custom-select-dropdown${l?" "+l:""}`,style:{position:"absolute",left:0,right:0,top:44,zIndex:10,borderRadius:6,boxShadow:_.boxShadow,maxHeight:220,overflowY:"auto",..._.dropdown,...a},children:[n.length===0&&h("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:120,width:"100%",userSelect:"none"},children:[h("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[h("title",{children:E("暂无数据")}),h("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd",children:[h("ellipse",{fill:"#f5f5f5",cx:"32",cy:"33",rx:"32",ry:"7"}),h("g",{fillRule:"nonzero",stroke:"#d9d9d9",children:[h("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),h("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:"#fafafa"})]})]})]}),h("div",{style:{marginTop:8,color:"#bfbfbf",fontSize:15},children:E("暂无数据")})]}),n.map((x,k)=>h("div",{onClick:()=>{x.disabled||(m(!1),t?.(x.value))},onMouseEnter:()=>g(k),onMouseLeave:()=>g(null),style:{padding:"10px 16px",cursor:x.disabled?"not-allowed":"pointer",fontWeight:e===x.value?600:400,opacity:x.disabled?.6:1,..._.option(e===x.value,!!x.disabled,b===k)},children:x.label},x.value))]}),d]})},Dt={white:{label:{marginBottom:8,fontSize:14,color:"#222",textAlign:"left",display:"block"},input:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},selectError:{border:"1px solid #ff4d4f"},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"},buttonCancel:{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},buttonSubmit:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600},feeTip:{marginBottom:24,padding:"12px 16px",background:"#f6ffed",border:"1px solid #b7eb8f",borderRadius:6,fontSize:14,color:"#52c41a"}},dark:{label:{marginBottom:8,fontSize:14,color:"#fff",textAlign:"left",display:"block"},input:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #23262F",background:"#23262F",color:"#fff",fontSize:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},selectError:{border:"1px solid #ff4d4f"},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"},buttonCancel:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},buttonSubmit:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600},feeTip:{marginBottom:24,padding:"12px 16px",background:"#1a1a1a",border:"1px solid #333",borderRadius:6,fontSize:14,color:"#52c41a"}}};function $o(){return L("theme")===N.WHITE?Dt.white:Dt.dark}function Wo(e){return e=e.replace(/[^\d.]/g,""),e=e.replace(/\.(?=.*\.)/g,""),e=e.replace(/^(\d+)(\.\d{0,2})?.*$/,"$1$2"),e=e.replace(/^0+(\d)/,"$1"),e.startsWith(".")&&(e="0"+e),e}function qo(e){if(!e)return"";const t=parseFloat(e);return isNaN(t)?"":t.toFixed(2)}const Jo=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}"),s=o?.currency||[],i=o?.channel?.filter(m=>m.payment_support)||[],[a,u]=B(""),[l,d]=B(!1),c=$o();return ae(()=>{e.currency&&e.amount&&e.rechargeChannel?Oo({channel:e.rechargeChannel,amount:e.amount,currency:e.currency}).then(m=>{u(m),d(!0)}).catch(m=>{console.error("计算支付金额失败:",m),d(!1)}):d(!1)},[e.currency,e.amount,e.rechargeChannel]),h(G,{children:[h("div",{style:{marginBottom:18},children:[h("div",{style:c.label,children:[h("span",{style:{color:"#F53F3F"},children:"*"})," ",E("充值币种")]}),h(Xe,{value:e.currency,onChange:m=>{t(p=>({...p,currency:m}))},options:s?.map(m=>({value:m.value,label:m.label})),placeholder:E("请选择充值币种")})]}),h("div",{style:{marginBottom:18},children:[h("div",{style:c.label,children:[h("span",{style:{color:"#F53F3F"},children:"*"})," ",E("充值金额")]}),h("input",{type:"text",placeholder:E("请输入充值金额"),value:e.amount,onInput:m=>{let p=m.target.value;p=Wo(p);let b="";if(p&&!p.endsWith(".")){let g=parseFloat(p);if(!isNaN(g)&&(g<1&&(g=1),g>999999.99&&(g=999999.99),p=g.toString(),/\./.test(m.target.value))){const _=m.target.value.split(".")[1];_!==void 0&&_.length>0&&(p=g.toFixed(Math.min(_.length,2)))}}t(g=>({...g,amount:p,amountError:b}))},onBlur:m=>{let p=m.target.value;p=qo(p),t(b=>({...b,amount:p,amountError:""}))},style:{...c.input,...e.amountError?c.inputError:{}}}),e.amountError&&h("div",{style:c.error,children:e.amountError})]}),h("div",{style:{marginBottom:24},children:[h("div",{style:c.label,children:[h("span",{style:{color:"#F53F3F"},children:"*"})," ",E("支付平台")]}),h(Xe,{value:e.rechargeChannel,onChange:m=>{t(p=>({...p,rechargeChannel:m,rechargeChannelError:m?"":p.rechargeChannelError}))},options:i?.map(m=>({value:m.value,label:m.label})),placeholder:E("请选择支付平台")}),e.rechargeChannelError&&h("div",{style:c.error,children:e.rechargeChannelError})]}),l&&a&&h("div",{style:c.feeTip,children:[i.find(m=>m.value===e.rechargeChannel)?.label||e.rechargeChannel,E("需要收取手续费,实际支付金额约为:"),"$",a]}),e.error&&h("div",{style:{color:"#ff4d4f",marginBottom:12},children:e.error}),h("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[h("button",{type:"button",onClick:n,style:c.buttonCancel,children:E("取消")}),h("button",{type:"submit",disabled:r,style:c.buttonSubmit,children:E(r?"提交中...":"去支付")})]})]})},Nt={white:{container:{border:"1px dashed #E5E6EB",borderRadius:8,background:"#FCFCFD",padding:24,textAlign:"center",cursor:"pointer",minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:15},fileItem:{display:"flex",alignItems:"center",background:"#F7F8FA",borderRadius:8,padding:"12px 16px",marginBottom:8,fontSize:15,color:"#222",justifyContent:"space-between"},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:"4px 14px",fontSize:15,marginLeft:16,cursor:"pointer"}},dark:{container:{border:"1.5px dashed #444C5C",borderRadius:8,background:"#181A20",padding:24,textAlign:"center",cursor:"pointer",minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:15},fileItem:{display:"flex",alignItems:"center",background:"#23262F",borderRadius:8,padding:"12px 16px",marginBottom:8,fontSize:15,color:"#fff",justifyContent:"space-between"},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:"4px 14px",fontSize:15,marginLeft:16,cursor:"pointer"}}};function Vo(){return L("theme")===N.WHITE?Nt.white:Nt.dark}const Go=({value:e=[],onChange:t,maxCount:n=10,accept:r=".jpg,.jpeg,.png,.pdf",multiple:o=!0,disabled:s=!1})=>{const i=Se(null),[a,u]=B(!1),[l,d]=B(0),c=Vo(),m=async b=>{const g=Array.from(b.target.files).slice(0,n);if(!g.length)return;u(!0);const _=[];for(let y=0;y<g.length;y++){d(0);const w=new FormData;w.append("file",g[y]);try{const x=await Ao(w,k=>d(k));x&&_.push(x)}catch{}}u(!1),d(0),t?.([...e,..._]),i.current&&(i.current.value="")},p=b=>{const g=e.filter((_,y)=>y!==b);t?.(g)};return h("div",{children:[h("div",{style:{...c.container,cursor:s?"not-allowed":c.container.cursor,opacity:s?.6:1},onClick:()=>!s&&i.current?.click(),children:[h("div",{style:{fontSize:48,marginBottom:12},children:"📁"}),h("div",{style:{color:"#222",fontSize:15,marginBottom:4},children:E("点击或拖拽文件到此处上传")}),h("div",{style:{color:"#999",fontSize:13},children:[E("支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传")," ",n," ",E("个文件")]}),h("input",{ref:i,type:"file",multiple:o,accept:r,style:{display:"none"},onChange:m,disabled:s}),a&&h("div",{style:{marginTop:12,color:"#1677ff"},children:[E("正在上传...")," ",l,"%"]})]}),e&&e.length>0&&h("div",{style:{marginTop:12},children:e.map((b,g)=>h("div",{style:c.fileItem,children:[h("div",{style:{display:"flex",alignItems:"center",flex:1},children:[h("span",{style:{fontWeight:500,wordBreak:"break-all"},children:b.split("/").pop()}),h("span",{style:{color:"#8C8F93",fontSize:13,marginLeft:8},children:["[",E("已上传"),"]"]})]}),h("button",{type:"button",onClick:_=>{_.stopPropagation(),p(g)},style:c.removeBtn,disabled:s,children:E("移除")})]},b))})]})},It={white:{label:{marginBottom:8,fontSize:14,color:"#222",textAlign:"left",display:"block"},input:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},select:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:15,outline:"none"},selectError:{border:"1px solid #ff4d4f"},upload:{border:"1px dashed #E5E6EB",borderRadius:8,background:"#FCFCFD",padding:24,textAlign:"center",cursor:"pointer",minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:15},uploadError:{border:"1px dashed #ff4d4f"},fileItem:{display:"flex",alignItems:"center",background:"#F7F8FA",borderRadius:8,padding:"12px 16px",marginBottom:8,fontSize:15,color:"#222",justifyContent:"space-between"},buttonCancel:{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},buttonSubmit:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:"4px 14px",fontSize:15,marginLeft:16,cursor:"pointer"},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}},dark:{label:{marginBottom:8,fontSize:14,color:"#fff",textAlign:"left",display:"block"},input:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #23262F",background:"#23262F",color:"#fff",fontSize:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},select:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid #23262F",background:"#23262F",color:"#fff",fontSize:15,outline:"none"},selectError:{border:"1px solid #ff4d4f"},upload:{border:"1px dashed #23262F",borderRadius:8,background:"#181A20",padding:24,textAlign:"center",cursor:"pointer",minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:15},uploadError:{border:"1px dashed #ff4d4f"},fileItem:{display:"flex",alignItems:"center",background:"#23262F",borderRadius:8,padding:"12px 16px",marginBottom:8,fontSize:15,color:"#fff",justifyContent:"space-between"},buttonCancel:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},buttonSubmit:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:"4px 14px",fontSize:15,marginLeft:16,cursor:"pointer"},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}}};function Ko(){return L("theme")===N.WHITE?It.white:It.dark}const Xo=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}");console.log(o,"allDicts");const s=o?.channel||[],i=Ko();return h("form",{onSubmit:async u=>{u.preventDefault();let l=!0;t(d=>({...d,platformError:"",transactionIdError:"",filesError:""})),e.platform||(t(d=>({...d,platformError:E("请选择支付平台")})),l=!1),e.transactionId.trim()||(t(d=>({...d,transactionIdError:E("请输入转账交易ID")})),l=!1),(!e.files||e.files.length===0)&&(t(d=>({...d,filesError:E("请上传转账凭证")})),l=!1),l&&(await Fo({transferChannel:e.platform,transferNo:e.transactionId,voucherUrls:e.files}),n(),Ke.success(E("离线充值创建成功")))},children:[h("div",{style:{marginBottom:18},children:[h("div",{style:i.label,children:[h("span",{style:{color:"#F53F3F"},children:"*"})," ",E("第三方支付平台")]}),h(Xe,{value:e.platform,onChange:u=>{t(l=>({...l,platform:u,platformError:u?"":l.platformError}))},options:[...s?.map(u=>({value:u.value,label:u.label}))],placeholder:E("请选择支付平台")}),e.platformError&&h("div",{style:i.error,children:e.platformError})]}),h("div",{style:{marginBottom:18},children:[h("div",{style:i.label,children:[h("span",{style:{color:"#F53F3F"},children:"*"})," ",E("交易ID")]}),h("input",{type:"text",placeholder:E("请输入转账交易ID"),value:e.transactionId,maxLength:200,onInput:u=>{let l=u.target.value;l.length>200&&(l=l.slice(0,200)),t(d=>({...d,transactionId:l,transactionIdError:l?"":d.transactionIdError}))},style:{...i.input,...e.transactionIdError?i.inputError:{}}}),e.transactionIdError&&h("div",{style:i.error,children:e.transactionIdError})]}),h("div",{style:{marginBottom:24},children:[h("div",{style:i.label,children:[h("span",{style:{color:"#F53F3F"},children:"*"})," ",E("上传文件")]}),h(Go,{value:e.files,onChange:u=>t(l=>({...l,files:u,filesError:""})),maxCount:10,accept:".jpg,.jpeg,.png,.pdf",multiple:!0}),e.filesError&&h("div",{style:i.error,children:e.filesError})]}),h("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[h("button",{type:"button",onClick:n,style:i.buttonCancel,children:E("取消")}),h("button",{type:"submit",disabled:r,style:i.buttonSubmit,children:E("去支付")})]})]})},Lt={white:{mask:"rgba(0, 0, 0, 0.45)",modalBg:"#fff",modalColor:"#222",modalBoxShadow:"0 6px 16px rgba(0, 0, 0, 0.12)",closeBtn:{position:"absolute",top:"16px",right:"16px",background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#999",padding:"0",width:"24px",height:"24px",display:"flex",alignItems:"center",justifyContent:"center"},title:{fontSize:"18px",fontWeight:"600",marginBottom:"24px",color:"#222"},tabBtn:(e,t)=>({flex:1,padding:"12px 16px",background:e?"#1890ff":"transparent",color:e?"#fff":"#666",border:"1px solid #d9d9d9",borderRight:t?"none":"1px solid #d9d9d9",cursor:"pointer",fontSize:"14px",fontWeight:e?"600":"400",borderRadius:t?"6px 0 0 6px":"0 6px 6px 0"})},dark:{mask:"rgba(0, 0, 0, 0.65)",modalBg:"#23262F",modalColor:"#F5F6FA",modalBoxShadow:"0 6px 16px rgba(0,0,0,0.32)",closeBtn:{position:"absolute",top:"16px",right:"16px",background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#B5B8BE",padding:"0",width:"24px",height:"24px",display:"flex",alignItems:"center",justifyContent:"center"},title:{fontSize:"18px",fontWeight:"600",marginBottom:"24px",color:"#F5F6FA"},tabBtn:(e,t)=>({flex:1,padding:"12px 16px",background:e?"#00E8C6":"transparent",color:e?"#fff":"#B5B8BE",border:"1px solid #444C5C",borderRight:t?"none":"1px solid #444C5C",cursor:"pointer",fontSize:"14px",fontWeight:e?"600":"400",borderRadius:t?"6px 0 0 6px":"0 6px 6px 0"})}};function Zo(){return L("theme")===N.WHITE?Lt.white:Lt.dark}function Qo({visible:e,onClose:t,title:n,children:r,width:o=400,maxWidth:s=400,showClose:i=!0,maskClosable:a=!0}){const[u,l]=B(!1),d=Zo(),c=p=>{p.target===p.currentTarget?l(!0):l(!1)},m=p=>{p.target===p.currentTarget&&u&&a&&t(),l(!1)};return e?h("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:d.mask,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},onMouseDown:c,onMouseUp:m,children:h("div",{style:{background:d.modalBg,padding:32,borderRadius:12,minWidth:o,maxWidth:s,color:d.modalColor,boxShadow:d.modalBoxShadow,position:"relative"},onClick:p=>p.stopPropagation(),children:[i&&h("button",{type:"button",onClick:t,style:d.closeBtn,"aria-label":"关闭",children:"×"}),n&&h("div",{style:d.title,children:n}),r]})}):null}const Ut={white:{tabBtn:(e,t)=>({flex:1,background:e?"#fff":"#F7F8FA",color:e?"#1890ff":"#222",border:"none",borderRadius:t?"8px 0 0 8px":"0 8px 8px 0",fontWeight:e?600:400,fontSize:16,height:48,boxShadow:e?"0 2px 8px 0 rgba(20,20,20,0.04)":"none",outline:"none",cursor:"pointer",borderRight:t?"1px solid #F0F1F3":void 0,borderLeft:t?void 0:"1px solid #F0F1F3",transition:"all 0.2s"})},dark:{tabBtn:(e,t)=>({flex:1,background:e?"#23262F":"#181A20",color:e?"#00E8C6":"#fff",border:"none",borderRadius:t?"8px 0 0 8px":"0 8px 8px 0",fontWeight:e?600:400,fontSize:16,height:48,boxShadow:e?"0 2px 8px 0 rgba(20,20,20,0.10)":"none",outline:"none",cursor:"pointer",borderRight:t?"1px solid #23262F":void 0,borderLeft:t?void 0:"1px solid #23262F",transition:"all 0.2s"})}};function Yo(){return L("theme")===N.WHITE?Ut.white:Ut.dark}function ei({visible:e,onClose:t,onSubmit:n}){const[r,o]=B({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),[s,i]=B({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}),[a,u]=B("online"),l=Yo();ae(()=>{e||(u("online"),o({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),i({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}))},[e]);const d=async c=>{c.preventDefault();let m=!0;if(o(p=>({...p,amountError:"",rechargeChannelError:""})),r.amount.trim()||(o(p=>({...p,amountError:E("请输入充值金额")})),m=!1),r.rechargeChannel||(o(p=>({...p,rechargeChannelError:E("请选择支付平台")})),m=!1),!!m){o(p=>({...p,loading:!0,error:""}));try{await n({amount:r.amount,rechargeChannel:r.rechargeChannel,currency:r.currency}),t()}catch{o(p=>({...p,error:E("提交失败,请重试")}))}finally{o(p=>({...p,loading:!1}))}}};return h(Qo,{visible:e,onClose:t,title:E("充值 / 转账"),children:[h("div",{style:{display:"flex",marginBottom:28},children:[h("button",{type:"button",onClick:()=>u("online"),style:l.tabBtn(a==="online",!0),children:E("在线充值")}),h("button",{type:"button",onClick:()=>u("offline"),style:l.tabBtn(a==="offline",!1),children:E("线下转账")})]}),a==="online"?h("form",{onSubmit:d,children:h(Jo,{formState:r,setFormState:o,onClose:t,loading:r.loading})}):h(Xo,{formState:s,setFormState:i,onClose:t,loading:s.loading})]})}function it(){return(it=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var ti=["context","children"];function ni(e){this.getChildContext=function(){return e.context};var t=e.children,n=function(r,o){if(r==null)return{};var s,i,a={},u=Object.keys(r);for(i=0;i<u.length;i++)o.indexOf(s=u[i])>=0||(a[s]=r[s]);return a}(e,ti);return Rn(t,n)}function ri(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=X(ni,it({},this._props,{context:e.detail.context}),function t(n,r){if(n.nodeType===3)return n.data;if(n.nodeType!==1)return null;var o=[],s={},i=0,a=n.attributes,u=n.childNodes;for(i=a.length;i--;)a[i].name!=="slot"&&(s[a[i].name]=a[i].value,s[Dn(a[i].name)]=a[i].value);for(i=u.length;i--;){var l=t(u[i],null),d=u[i].slot;d?s[d]=X(zt,{name:d},l):o[i]=l}var c=r?X(zt,null,o):o;return X(r||n.nodeName.toLowerCase(),s,c)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?Tn:Pe)(this._vdom,this._root)}function Dn(e){return e.replace(/-(\w)/g,function(t,n){return n?n.toUpperCase():""})}function oi(e,t,n){if(this._vdom){var r={};r[e]=n=n??void 0,r[Dn(e)]=n,this._vdom=Rn(this._vdom,r),Pe(this._vdom,this._root)}}function ii(){Pe(this._vdom=null,this._root)}function zt(e,t){var n=this;return X("slot",it({},e,{ref:function(r){r?(n.ref=r,n._listener||(n._listener=function(o){o.stopPropagation(),o.detail.context=t},r.addEventListener("_preact",n._listener))):n.ref.removeEventListener("_preact",n._listener)}}))}function st(e,t,n,r){function o(){var s=Reflect.construct(HTMLElement,[],o);return s._vdomComponent=e,s._root=r&&r.shadow?s.attachShadow({mode:r.mode||"open"}):s,s}return(o.prototype=Object.create(HTMLElement.prototype)).constructor=o,o.prototype.connectedCallback=ri,o.prototype.attributeChangedCallback=oi,o.prototype.disconnectedCallback=ii,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),o.observedAttributes=n,n.forEach(function(s){Object.defineProperty(o.prototype,s,{get:function(){return this._vdom.props[s]},set:function(i){this._vdom?this.attributeChangedCallback(s,null,i):(this._props||(this._props={}),this._props[s]=i,this.connectedCallback());var a=typeof i;i!=null&&a!=="string"&&a!=="boolean"&&a!=="number"||this.setAttribute(s,i)}})}),customElements.define(t||e.tagName||e.displayName||e.name,o)}function si(){const[e,t]=B(!1),n=async r=>{const o=await Bo({amount:r.amount,currency:r.currency,rechargeChannel:r.rechargeChannel});window.open(o,"_blank")};return h("div",{children:[h(Pn,{onClick:()=>t(!0),children:E("充值/转账")}),h(ei,{visible:e,onClose:()=>t(!1),onSubmit:n})]})}st(si,"best-recharge",["theme"],{shadow:!1});const Ht={white:{popover:{background:"#fff",color:"#222",boxShadow:"0 4px 16px rgba(0,0,0,0.12)",border:"none"},arrow:{top:"#fff",bottom:"#fff",left:"#fff",right:"#fff"}},dark:{popover:{background:"#23262F",color:"#fff",boxShadow:"0 4px 16px rgba(0,0,0,0.32)",border:"1px solid #444C5C"},arrow:{top:"#23262F",bottom:"#23262F",left:"#23262F",right:"#23262F"}}};function ai(){return L("theme")===N.WHITE?Ht.white:Ht.dark}const li=({popover:e,children:t,popoverWidth:n=300,popoverMinWidth:r=200,offsetY:o=16,offsetX:s=16,popoverPosition:i="top"})=>{const[a,u]=B(!1),[l,d]=B(i),c=Se(null),m=Se(null),p=ai(),b=()=>{if(m.current&&(clearTimeout(m.current),m.current=null),i==="top"||i==="bottom")if(c.current){const w=c.current.getBoundingClientRect();i==="top"&&w.top<100?d("bottom"):i==="bottom"&&window.innerHeight-w.bottom<100?d("top"):d(i)}else d(i);else d(i);u(!0)},g=()=>{m.current=window.setTimeout(()=>{u(!1)},120)};let _={position:"absolute",zIndex:999,borderRadius:6,fontSize:15,minWidth:r,width:n,padding:"8px 14px",pointerEvents:"auto",textAlign:"center",animation:"fadeInUp 0.3s",...p.popover},y={position:"absolute",zIndex:11,width:0,height:0};return l==="top"?(_={..._,left:"50%",top:-48,transform:"translateX(-50%)"},y={...y,left:"50%",bottom:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderTop:`8px solid ${p.arrow.top}`}):l==="bottom"?(_={..._,left:"50%",top:"100%",marginTop:o,transform:"translateX(-50%)"},y={...y,left:"50%",top:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:`8px solid ${p.arrow.bottom}`}):l==="leftTop"?(_={..._,right:"100%",top:0,marginRight:s,transform:"none"},y={...y,right:-8,top:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderLeft:`8px solid ${p.arrow.left}`}):l==="rightTop"&&(_={..._,left:"100%",top:0,marginLeft:s,transform:"translateY(0)"},y={...y,left:-8,top:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderRight:`8px solid ${p.arrow.right}`}),h("div",{ref:c,style:{position:"relative",display:"inline-block"},onMouseEnter:b,onMouseLeave:g,children:[t,a&&h("div",{style:_,onMouseEnter:b,onMouseLeave:g,children:[e,h("div",{style:y})]})]})},Mt={white:{popoverTitle:{fontSize:16,fontWeight:600,color:"#222",marginBottom:16,textAlign:"center"},detailRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 0",borderBottom:"1px solid #e5e7eb",fontSize:15},detailLabel:{display:"flex",alignItems:"center",color:"#6b7280",fontWeight:500},detailDot:e=>({display:"inline-block",width:8,height:8,borderRadius:"50%",background:e,marginRight:8}),detailValue:e=>({color:e,fontWeight:600,fontSize:15}),main:{fontSize:24,fontWeight:800,color:"#111827",display:"inline-block"},currency:{fontSize:18,color:"#6b7280",marginLeft:8,fontWeight:600}},dark:{popoverTitle:{fontSize:16,fontWeight:600,color:"#fff",marginBottom:16,textAlign:"center"},detailRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 0",borderBottom:"1px solid #374151",fontSize:15},detailLabel:{display:"flex",alignItems:"center",color:"#B5B8BE",fontWeight:500},detailDot:e=>({display:"inline-block",width:8,height:8,borderRadius:"50%",background:e,marginRight:8}),detailValue:e=>({color:e,fontWeight:600,fontSize:15}),main:{fontSize:24,fontWeight:800,color:"#fff",display:"inline-block"},currency:{fontSize:18,color:"#B5B8BE",marginLeft:8,fontWeight:600}}};function ci(){return L("theme")===N.WHITE?Mt.white:Mt.dark}function jt(e){return e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}function ui(e){const[t,n]=B({available:0,currency:"USD",symbol:"$",details:[]}),r=async()=>{try{const i=await Bn(),a=[{label:"",value:i.totalAmount,color:"#15b36b",dot:"#15b36b"},{label:"",value:i.frozenAmount,color:"#f59e0b",dot:"#f59e0b"},...i.isCredit?[{label:"",value:i.creditLimit,color:"#1890ff",dot:"#1890ff"},{label:"",value:i.creditUsed,color:"#ff0000",dot:"#ff0000"}]:[],{label:"",value:i.availableAmount,color:"#1890ff",dot:"#15b36b"}],u={available:i.availableAmount,currency:"USD",symbol:"$",details:a};n(u)}catch(i){console.error("获取余额失败:",i)}};ae(()=>{r()},[]),ae(()=>{const i=()=>{r()};return document.addEventListener("refresh-balance",i),()=>{document.removeEventListener("refresh-balance",i)}},[]);const o=ci(),s=[{label:E("真实金额"),value:t.details[0]?.value||0,color:"#15b36b",dot:"#15b36b"},{label:E("冻结金额"),value:t.details[1]?.value||0,color:"#f59e0b",dot:"#f59e0b"},...t.details.length>4?[{label:E("信用额度"),value:t.details[2]?.value||0,color:"#1890ff",dot:"#1890ff"},{label:E("已用额度"),value:t.details[3]?.value||0,color:"#ff0000",dot:"#ff0000"}]:[],{label:E("可用余额"),value:t.details[t.details.length-1]?.value||0,color:"#1890ff",dot:"#15b36b"}];return h(li,{popover:h(G,{children:[h("div",{style:o.popoverTitle,children:E("余额详情")}),s.map(i=>h("div",{style:o.detailRow,children:[h("span",{style:o.detailLabel,children:[h("span",{style:o.detailDot(i.dot)}),i.label]}),h("span",{style:o.detailValue(i.color),children:[t.symbol,jt(i.value)]})]},i.label))]}),popoverPosition:e.popoverPosition||"bottom",children:h("div",{style:o.main,children:[t.symbol,jt(t.available),h("span",{style:o.currency,children:t.currency})]})})}st(ui,"best-statistical-balance");const pe={white:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,cursor:"pointer",fontWeight:600,transition:"all 0.2s ease"},dark:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,cursor:"pointer",fontWeight:600,transition:"all 0.2s ease"}};function di(e){return L("theme")===N.WHITE?{...pe.white,background:e||pe.white.background}:{...pe.dark,background:e||pe.dark.background}}function fi(e){switch(e){case"small":return{fontSize:"12px",gap:"2px"};case"large":return{fontSize:"18px",gap:"6px"};default:return{fontSize:"14px",gap:"4px"}}}function pi({color:e,size:t="medium",children:n}){const[r,o]=B(!1),s=di(e),i=fi(t),a={...s,...i,display:"flex",alignItems:"center"};return h(G,{children:[h("style",{children:`
61
61
  @keyframes spin {
62
62
  from {
63
63
  transform: rotate(0deg);
package/dist/best-unit.js CHANGED
@@ -4209,7 +4209,7 @@ function ii(e) {
4209
4209
  {
4210
4210
  label: "",
4211
4211
  // 翻译在渲染时处理
4212
- value: i.availableAmount,
4212
+ value: i.totalAmount,
4213
4213
  color: "#15b36b",
4214
4214
  dot: "#15b36b"
4215
4215
  },
@@ -4235,7 +4235,7 @@ function ii(e) {
4235
4235
  ] : [],
4236
4236
  {
4237
4237
  label: "",
4238
- value: i.totalAmount,
4238
+ value: i.availableAmount,
4239
4239
  color: "#1890ff",
4240
4240
  dot: "#15b36b"
4241
4241
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "best-unit",
3
3
  "private": false,
4
- "version": "1.2.2",
4
+ "version": "1.2.3",
5
5
  "type": "module",
6
6
  "main": "dist/best-unit.cjs",
7
7
  "module": "dist/best-unit.js",
@@ -42,7 +42,7 @@ function StatisticalBalance(props: { popoverPosition?: PopoverPosition }) {
42
42
  const details: DetailItem[] = [
43
43
  {
44
44
  label: "", // 翻译在渲染时处理
45
- value: balance.availableAmount,
45
+ value: balance.totalAmount,
46
46
  color: "#15b36b",
47
47
  dot: "#15b36b",
48
48
  },
@@ -70,7 +70,7 @@ function StatisticalBalance(props: { popoverPosition?: PopoverPosition }) {
70
70
  : []),
71
71
  {
72
72
  label: "",
73
- value: balance.totalAmount,
73
+ value: balance.availableAmount,
74
74
  color: "#1890ff",
75
75
  dot: "#15b36b",
76
76
  },