best-unit 0.0.58 → 0.0.59
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.
package/dist/best-unit.cjs
CHANGED
|
@@ -57,4 +57,4 @@
|
|
|
57
57
|
.custom-select-dropdown::-webkit-scrollbar-track {
|
|
58
58
|
background: ${h?"#f5f5f5":"#23262F"};
|
|
59
59
|
}
|
|
60
|
-
`}),m("div",{onClick:()=>!s&&_(E=>!E),style:{minHeight:40,borderRadius:6,display:"flex",alignItems:"center",padding:"0 12px",fontSize:15,cursor:s?"not-allowed":"pointer",boxSizing:"border-box",transition:"border 0.2s",opacity:s?.6:1,width:"100%",...y.trigger,...o},tabIndex:0,children:[m("span",{style:{flex:1},children:w?w.label:m("span",{style:y.placeholder,children:r||"请选择"})}),m("span",{style:{marginLeft:8,display:"flex",alignItems:"center"},children:m("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m("path",{d:"M6 8L10 12L14 8",stroke:"#bfbfbf","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})})})]}),c&&!s&&m("div",{className:`custom-select-dropdown${u?" "+u:""}`,style:{position:"absolute",left:0,right:0,top:44,zIndex:10,borderRadius:6,boxShadow:h?"0 2px 8px rgba(0,0,0,0.08)":"0 2px 8px rgba(0,0,0,0.32)",maxHeight:220,overflowY:"auto",...y.dropdown,...a},children:[n.length===0&&m("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:120,width:"100%",userSelect:"none"},children:[m("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[m("title",{children:S("暂无数据")}),m("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd",children:[m("ellipse",{fill:"#f5f5f5",cx:"32",cy:"33",rx:"32",ry:"7"}),m("g",{fillRule:"nonzero",stroke:"#d9d9d9",children:[m("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"}),m("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"})]})]})]}),m("div",{style:{marginTop:8,color:"#bfbfbf",fontSize:15},children:S("暂无数据")})]}),n.map((E,T)=>m("div",{onClick:()=>{E.disabled||(_(!1),t?.(E.value))},onMouseEnter:()=>x(T),onMouseLeave:()=>x(null),style:{padding:"10px 16px",cursor:E.disabled?"not-allowed":"pointer",fontWeight:e===E.value?600:400,opacity:E.disabled?.6:1,...y.option(e===E.value,!!E.disabled,g===T)},children:E.label},E.value))]}),f]})};function vo(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 To(e){if(!e)return"";const t=parseFloat(e);return isNaN(t)?"":t.toFixed(2)}const Ro=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}"),i=o?.currency||[],s=o?.channel?.filter(p=>p.payment_support)||[],l=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE,[u,f]=P(""),[c,_]=P(!1);Ae(()=>{e.currency&&e.amount&&e.rechargeChannel?mo({channel:e.rechargeChannel,amount:e.amount,currency:e.currency}).then(p=>{f(p),_(!0)}).catch(p=>{console.error("计算支付金额失败:",p),_(!1)}):_(!1)},[e.currency,e.amount,e.rechargeChannel]);const b=l?{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"},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}}:{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"},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}},g=l?{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"}:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},x=l?{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600}:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600};return m(Q,{children:[m("div",{style:{marginBottom:18},children:[m("div",{style:b.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("充值币种")]}),m(Je,{value:e.currency,onChange:p=>{t(h=>({...h,currency:p}))},options:i?.map(p=>({value:p.value,label:p.label})),placeholder:S("请选择充值币种")})]}),m("div",{style:{marginBottom:18},children:[m("div",{style:b.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("充值金额")]}),m("input",{type:"text",placeholder:S("请输入充值金额"),value:e.amount,onInput:p=>{let h=p.target.value;h=vo(h);let y="";if(h&&!h.endsWith(".")){let w=parseFloat(h);if(!isNaN(w)&&(w<1&&(w=1),w>999999.99&&(w=999999.99),h=w.toString(),/\./.test(p.target.value))){const E=p.target.value.split(".")[1];E!==void 0&&E.length>0&&(h=w.toFixed(Math.min(E.length,2)))}}t(w=>({...w,amount:h,amountError:y}))},onBlur:p=>{let h=p.target.value;h=To(h),t(y=>({...y,amount:h,amountError:""}))},style:{...b.input,...e.amountError?b.inputError:{}}}),e.amountError&&m("div",{style:b.error,children:e.amountError})]}),m("div",{style:{marginBottom:24},children:[m("div",{style:b.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("支付平台")]}),m(Je,{value:e.rechargeChannel,onChange:p=>{t(h=>({...h,rechargeChannel:p,rechargeChannelError:p?"":h.rechargeChannelError}))},options:s?.map(p=>({value:p.value,label:p.label})),placeholder:S("请选择支付平台")}),e.rechargeChannelError&&m("div",{style:b.error,children:e.rechargeChannelError})]}),c&&u&&m("div",{style:{marginBottom:24,padding:"12px 16px",background:l?"#f6ffed":"#1a1a1a",border:`1px solid ${l?"#b7eb8f":"#333"}`,borderRadius:6,fontSize:14,color:"#52c41a"},children:[s.find(p=>p.value===e.rechargeChannel)?.label||e.rechargeChannel,S("需要收取手续费,实际支付金额约为:"),"$",u]}),e.error&&m("div",{style:{color:"#ff4d4f",marginBottom:12},children:e.error}),m("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[m("button",{type:"button",onClick:n,style:g,children:S("取消")}),m("button",{type:"submit",disabled:r,style:x,children:S(r?"提交中...":"去支付")})]})]})},ko={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"}}},Co=({value:e=[],onChange:t,maxCount:n=10,accept:r=".jpg,.jpeg,.png,.pdf",multiple:o=!0,disabled:i=!1})=>{const s=ye(null),[a,l]=P(!1),[u,f]=P(0),b=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE?"white":"dark",g=ko[b],x=async h=>{const y=Array.from(h.target.files).slice(0,n);if(!y.length)return;l(!0);const w=[];for(let E=0;E<y.length;E++){f(0);const T=new FormData;T.append("file",y[E]);try{const k=await fo(T,I=>f(I));k&&w.push(k)}catch{}}l(!1),f(0),t?.([...e,...w]),s.current&&(s.current.value="")},p=h=>{const y=e.filter((w,E)=>E!==h);t?.(y)};return m("div",{children:[m("div",{style:{...g.container,cursor:i?"not-allowed":g.container.cursor,opacity:i?.6:1},onClick:()=>!i&&s.current?.click(),children:[m("div",{style:{fontSize:48,marginBottom:12},children:"📁"}),m("div",{style:{color:"#222",fontSize:15,marginBottom:4},children:S("点击或拖拽文件到此处上传")}),m("div",{style:{color:"#999",fontSize:13},children:[S("支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传")," ",n," ",S("个文件")]}),m("input",{ref:s,type:"file",multiple:o,accept:r,style:{display:"none"},onChange:x,disabled:i}),a&&m("div",{style:{marginTop:12,color:"#1677ff"},children:[S("正在上传...")," ",u,"%"]})]}),e&&e.length>0&&m("div",{style:{marginTop:12},children:e.map((h,y)=>m("div",{style:g.fileItem,children:[m("div",{style:{display:"flex",alignItems:"center",flex:1},children:[m("span",{style:{fontWeight:500,wordBreak:"break-all"},children:h.split("/").pop()}),m("span",{style:{color:"#8C8F93",fontSize:13,marginLeft:8},children:["[",S("已上传"),"]"]})]}),m("button",{type:"button",onClick:w=>{w.stopPropagation(),p(y)},style:g.removeBtn,disabled:i,children:S("移除")})]},h))})]})},Ao=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}");console.log(o,"allDicts");const i=o?.channel||[],l=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.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"},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},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}}:{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"},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},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}};return m("form",{onSubmit:async f=>{f.preventDefault();let c=!0;t(_=>({..._,platformError:"",transactionIdError:"",filesError:""})),e.platform||(t(_=>({..._,platformError:S("请选择支付平台")})),c=!1),e.transactionId.trim()||(t(_=>({..._,transactionIdError:S("请输入转账交易ID")})),c=!1),(!e.files||e.files.length===0)&&(t(_=>({..._,filesError:S("请上传转账凭证")})),c=!1),c&&(await po({transferChannel:e.platform,transferNo:e.transactionId,voucherUrls:e.files}),n(),qe.success(S("离线充值创建成功")))},children:[m("div",{style:{marginBottom:18},children:[m("div",{style:l.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("第三方支付平台")]}),m(Je,{value:e.platform,onChange:f=>{t(c=>({...c,platform:f,platformError:f?"":c.platformError}))},options:[...i?.map(f=>({value:f.value,label:f.label}))],placeholder:S("请选择支付平台")}),e.platformError&&m("div",{style:l.error,children:e.platformError})]}),m("div",{style:{marginBottom:18},children:[m("div",{style:l.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("交易ID")]}),m("input",{type:"text",placeholder:S("请输入转账交易ID"),value:e.transactionId,maxLength:200,onInput:f=>{let c=f.target.value;c.length>200&&(c=c.slice(0,200)),t(_=>({..._,transactionId:c,transactionIdError:c?"":_.transactionIdError}))},style:{...l.input,...e.transactionIdError?l.inputError:{}}}),e.transactionIdError&&m("div",{style:l.error,children:e.transactionIdError})]}),m("div",{style:{marginBottom:24},children:[m("div",{style:l.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("上传文件")]}),m(Co,{value:e.files,onChange:f=>t(c=>({...c,files:f,filesError:""})),maxCount:10,accept:".jpg,.jpeg,.png,.pdf",multiple:!0}),e.filesError&&m("div",{style:l.error,children:e.filesError})]}),m("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[m("button",{type:"button",onClick:n,style:l.buttonCancel,children:S("取消")}),m("button",{type:"submit",disabled:r,style:l.buttonSubmit,children:S("去支付")})]})]})};function Oo({visible:e,onClose:t,onSubmit:n}){const[r,o]=P({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),[i,s]=P("online"),[a,l]=P({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1});if(Ae(()=>{e||(s("online"),o({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),l({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}))},[e]),!e)return null;const u=async h=>{h.preventDefault();let y=!0;if(o(w=>({...w,amountError:"",rechargeChannelError:""})),r.amount.trim()||(o(w=>({...w,amountError:S("请输入充值金额")})),y=!1),r.rechargeChannel||(o(w=>({...w,rechargeChannelError:S("请选择支付平台")})),y=!1),!!y){o(w=>({...w,loading:!0,error:""}));try{await n({amount:r.amount,rechargeChannel:r.rechargeChannel,currency:r.currency}),t()}catch{o(w=>({...w,error:S("提交失败,请重试")}))}finally{o(w=>({...w,loading:!1}))}}},[f,c]=P(!1),_=h=>{h.target===h.currentTarget?c(!0):c(!1)},b=h=>{h.target===h.currentTarget&&f&&t(),c(!1)},p=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE?{modalBg:"#fff",modalColor:"#222",modalBoxShadow:"0 4px 24px rgba(0,0,0,0.08)",mask:"rgba(0,0,0,0.3)",title:{fontWeight:600,fontSize:20,marginBottom:24,textAlign:"left",color:"#222"},closeBtn:{position:"absolute",right:16,top:16,background:"none",border:"none",color:"#222",fontSize:22,cursor:"pointer",lineHeight:1},tabBtn:(h,y)=>({flex:1,background:h?"#fff":"#F7F8FA",color:h?"#1890ff":"#222",border:"none",borderRadius:y?"8px 0 0 8px":"0 8px 8px 0",fontWeight:h?600:400,fontSize:16,height:48,boxShadow:h?"0 2px 8px 0 rgba(20,20,20,0.04)":"none",outline:"none",cursor:"pointer",borderRight:y?"1px solid #F0F1F3":void 0,borderLeft:y?void 0:"1px solid #F0F1F3",transition:"all 0.2s"})}:{modalBg:"#181A20",modalColor:"#fff",modalBoxShadow:"0 4px 24px rgba(0,0,0,0.5)",mask:"rgba(0,0,0,0.7)",title:{fontWeight:600,fontSize:20,marginBottom:24,textAlign:"left",color:"#fff"},closeBtn:{position:"absolute",right:16,top:16,background:"none",border:"none",color:"#fff",fontSize:22,cursor:"pointer",lineHeight:1},tabBtn:(h,y)=>({flex:1,background:h?"#23262F":"#181A20",color:h?"#00E8C6":"#fff",border:"none",borderRadius:y?"8px 0 0 8px":"0 8px 8px 0",fontWeight:h?600:400,fontSize:16,height:48,boxShadow:h?"0 2px 8px 0 rgba(20,20,20,0.10)":"none",outline:"none",cursor:"pointer",borderRight:y?"1px solid #23262F":void 0,borderLeft:y?void 0:"1px solid #23262F",transition:"all 0.2s"})};return m("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:p.mask,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},onMouseDown:_,onMouseUp:b,children:m("form",{onSubmit:u,style:{background:p.modalBg,padding:32,borderRadius:12,minWidth:400,maxWidth:400,color:p.modalColor,boxShadow:p.modalBoxShadow,position:"relative"},onClick:h=>h.stopPropagation(),children:[m("button",{type:"button",onClick:t,style:p.closeBtn,"aria-label":S("关闭"),children:"×"}),m("div",{style:p.title,children:S("充值 / 转账")}),m("div",{style:{display:"flex",marginBottom:28},children:[m("button",{type:"button",onClick:()=>s("online"),style:p.tabBtn(i==="online",!0),children:S("在线充值")}),m("button",{type:"button",onClick:()=>s("offline"),style:p.tabBtn(i==="offline",!1),children:S("线下转账")})]}),i==="online"?m(Ro,{formState:r,setFormState:o,onClose:t,loading:r.loading}):m(Ao,{formState:a,setFormState:l,onClose:t,loading:a.loading})]})})}function tt(){return(tt=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 Fo=["context","children"];function Po(e){this.getChildContext=function(){return e.context};var t=e.children,n=function(r,o){if(r==null)return{};var i,s,a={},l=Object.keys(r);for(s=0;s<l.length;s++)o.indexOf(i=l[s])>=0||(a[i]=r[i]);return a}(e,Fo);return pn(t,n)}function Bo(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=G(Po,tt({},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=[],i={},s=0,a=n.attributes,l=n.childNodes;for(s=a.length;s--;)a[s].name!=="slot"&&(i[a[s].name]=a[s].value,i[gn(a[s].name)]=a[s].value);for(s=l.length;s--;){var u=t(l[s],null),f=l[s].slot;f?i[f]=G(kt,{name:f},u):o[s]=u}var c=r?G(kt,null,o):o;return G(r||n.nodeName.toLowerCase(),i,c)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?dn:Ce)(this._vdom,this._root)}function gn(e){return e.replace(/-(\w)/g,function(t,n){return n?n.toUpperCase():""})}function No(e,t,n){if(this._vdom){var r={};r[e]=n=n??void 0,r[gn(e)]=n,this._vdom=pn(this._vdom,r),Ce(this._vdom,this._root)}}function Io(){Ce(this._vdom=null,this._root)}function kt(e,t){var n=this;return G("slot",tt({},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 bn(e,t,n,r){function o(){var i=Reflect.construct(HTMLElement,[],o);return i._vdomComponent=e,i._root=r&&r.shadow?i.attachShadow({mode:r.mode||"open"}):i,i}return(o.prototype=Object.create(HTMLElement.prototype)).constructor=o,o.prototype.connectedCallback=Bo,o.prototype.attributeChangedCallback=No,o.prototype.disconnectedCallback=Io,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),o.observedAttributes=n,n.forEach(function(i){Object.defineProperty(o.prototype,i,{get:function(){return this._vdom.props[i]},set:function(s){this._vdom?this.attributeChangedCallback(i,null,s):(this._props||(this._props={}),this._props[i]=s,this.connectedCallback());var a=typeof s;s!=null&&a!=="string"&&a!=="boolean"&&a!=="number"||this.setAttribute(i,s)}})}),customElements.define(t||e.tagName||e.displayName||e.name,o)}function Do(){const[e,t]=P(!1),n=async r=>{const o=await ho({amount:r.amount,currency:r.currency,rechargeChannel:r.rechargeChannel});window.open(o,"_blank")};return m("div",{children:[m(bo,{onClick:()=>t(!0),children:S("充值/转账")}),m(Oo,{visible:e,onClose:()=>t(!1),onSubmit:n})]})}bn(Do,"best-recharge",["theme"],{shadow:!1});const Uo=({popover:e,children:t,popoverWidth:n=300,popoverMinWidth:r=200,offsetY:o=16,offsetX:i=16,popoverPosition:s="top"})=>{const[a,l]=P(!1),[u,f]=P(s),c=ye(null),_=ye(null),b=()=>{if(_.current&&(clearTimeout(_.current),_.current=null),s==="top"||s==="bottom")if(c.current){const T=c.current.getBoundingClientRect();s==="top"&&T.top<100?f("bottom"):s==="bottom"&&window.innerHeight-T.bottom<100?f("top"):f(s)}else f(s);else f(s);l(!0)},g=()=>{_.current=window.setTimeout(()=>{l(!1)},120)},x={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"}}},h=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE,y=x[h?"white":"dark"];let w={position:"absolute",zIndex:999,borderRadius:6,fontSize:15,minWidth:r,width:n,padding:"8px 14px",pointerEvents:"auto",textAlign:"center",animation:"fadeInUp 0.3s",...y.popover},E={position:"absolute",zIndex:11,width:0,height:0};return u==="top"?(w={...w,left:"50%",top:-48,transform:"translateX(-50%)"},E={...E,left:"50%",bottom:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderTop:`8px solid ${y.arrow.top}`}):u==="bottom"?(w={...w,left:"50%",top:"100%",marginTop:o,transform:"translateX(-50%)"},E={...E,left:"50%",top:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:`8px solid ${y.arrow.bottom}`}):u==="leftTop"?(w={...w,right:"100%",top:0,marginRight:i,transform:"none"},E={...E,right:-8,top:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderLeft:`8px solid ${y.arrow.left}`}):u==="rightTop"&&(w={...w,left:"100%",top:0,marginLeft:i,transform:"translateY(0)"},E={...E,left:-8,top:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderRight:`8px solid ${y.arrow.right}`}),m("div",{ref:c,style:{position:"relative",display:"inline-block"},onMouseEnter:b,onMouseLeave:g,children:[t,a&&m("div",{style:w,onMouseEnter:b,onMouseLeave:g,children:[e,m("div",{style:E})]})]})};function Ct(e){return e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}const Lo={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 #23262F",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 zo(e){const[t,n]=P({available:0,currency:"USD",symbol:"$",details:[{label:S("真实金额"),value:0,color:"#15b36b",dot:"#15b36b"},{label:S("冻结金额"),value:0,color:"#f59e0b",dot:"#f59e0b"},{label:S("总可用"),value:0,color:"#1890ff",dot:"#15b36b"}]});Ae(()=>{(async()=>{try{const a=await co(),l={available:a.availableAmount,currency:"USD",symbol:"$",details:[{label:S("真实金额"),value:a.totalAmount,color:"#15b36b",dot:"#15b36b"},{label:S("冻结金额"),value:a.frozenAmount,color:"#f59e0b",dot:"#f59e0b"},{label:S("总可用"),value:a.availableAmount,color:"#1890ff",dot:"#15b36b"}]};n(l)}catch(a){console.error("获取余额失败:",a)}})()},[]);const o=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE,i=Lo[o?"white":"dark"];return m(Uo,{popover:m(Q,{children:[m("div",{style:i.popoverTitle,children:S("余额详情")}),t.details.map(s=>m("div",{style:i.detailRow,children:[m("span",{style:i.detailLabel,children:[m("span",{style:i.detailDot(s.dot)}),s.label]}),m("span",{style:i.detailValue(s.color),children:[t.symbol,Ct(s.value)]})]},s.label))]}),popoverPosition:e.popoverPosition||"bottom",children:m("div",{style:i.main,children:[t.symbol,Ct(t.available),m("span",{style:i.currency,children:t.currency})]})})}bn(zo,"best-statistical-balance");const Ho=["best-recharge","best-statistical-balance"];exports.components=Ho;exports.initFundUnit=_o;exports.npmTest=yn;exports.printCurrentTime=wn;exports.viteProxy=go;
|
|
60
|
+
`}),m("div",{onClick:()=>!s&&_(E=>!E),style:{minHeight:40,borderRadius:6,display:"flex",alignItems:"center",padding:"0 12px",fontSize:15,cursor:s?"not-allowed":"pointer",boxSizing:"border-box",transition:"border 0.2s",opacity:s?.6:1,width:"100%",...y.trigger,...o},tabIndex:0,children:[m("span",{style:{flex:1},children:w?w.label:m("span",{style:y.placeholder,children:r||"请选择"})}),m("span",{style:{marginLeft:8,display:"flex",alignItems:"center"},children:m("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m("path",{d:"M6 8L10 12L14 8",stroke:"#bfbfbf","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})})})]}),c&&!s&&m("div",{className:`custom-select-dropdown${u?" "+u:""}`,style:{position:"absolute",left:0,right:0,top:44,zIndex:10,borderRadius:6,boxShadow:h?"0 2px 8px rgba(0,0,0,0.08)":"0 2px 8px rgba(0,0,0,0.32)",maxHeight:220,overflowY:"auto",...y.dropdown,...a},children:[n.length===0&&m("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:120,width:"100%",userSelect:"none"},children:[m("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[m("title",{children:S("暂无数据")}),m("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd",children:[m("ellipse",{fill:"#f5f5f5",cx:"32",cy:"33",rx:"32",ry:"7"}),m("g",{fillRule:"nonzero",stroke:"#d9d9d9",children:[m("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"}),m("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"})]})]})]}),m("div",{style:{marginTop:8,color:"#bfbfbf",fontSize:15},children:S("暂无数据")})]}),n.map((E,T)=>m("div",{onClick:()=>{E.disabled||(_(!1),t?.(E.value))},onMouseEnter:()=>x(T),onMouseLeave:()=>x(null),style:{padding:"10px 16px",cursor:E.disabled?"not-allowed":"pointer",fontWeight:e===E.value?600:400,opacity:E.disabled?.6:1,...y.option(e===E.value,!!E.disabled,g===T)},children:E.label},E.value))]}),f]})};function vo(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 To(e){if(!e)return"";const t=parseFloat(e);return isNaN(t)?"":t.toFixed(2)}const Ro=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}"),i=o?.currency||[],s=o?.channel?.filter(p=>p.payment_support)||[],l=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE,[u,f]=P(""),[c,_]=P(!1);Ae(()=>{e.currency&&e.amount&&e.rechargeChannel?mo({channel:e.rechargeChannel,amount:e.amount,currency:e.currency}).then(p=>{f(p),_(!0)}).catch(p=>{console.error("计算支付金额失败:",p),_(!1)}):_(!1)},[e.currency,e.amount,e.rechargeChannel]);const b=l?{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"},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}}:{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"},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}},g=l?{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"}:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},x=l?{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600}:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600};return m(Q,{children:[m("div",{style:{marginBottom:18},children:[m("div",{style:b.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("充值币种")]}),m(Je,{value:e.currency,onChange:p=>{t(h=>({...h,currency:p}))},options:i?.map(p=>({value:p.value,label:p.label})),placeholder:S("请选择充值币种")})]}),m("div",{style:{marginBottom:18},children:[m("div",{style:b.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("充值金额")]}),m("input",{type:"text",placeholder:S("请输入充值金额"),value:e.amount,onInput:p=>{let h=p.target.value;h=vo(h);let y="";if(h&&!h.endsWith(".")){let w=parseFloat(h);if(!isNaN(w)&&(w<1&&(w=1),w>999999.99&&(w=999999.99),h=w.toString(),/\./.test(p.target.value))){const E=p.target.value.split(".")[1];E!==void 0&&E.length>0&&(h=w.toFixed(Math.min(E.length,2)))}}t(w=>({...w,amount:h,amountError:y}))},onBlur:p=>{let h=p.target.value;h=To(h),t(y=>({...y,amount:h,amountError:""}))},style:{...b.input,...e.amountError?b.inputError:{}}}),e.amountError&&m("div",{style:b.error,children:e.amountError})]}),m("div",{style:{marginBottom:24},children:[m("div",{style:b.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("支付平台")]}),m(Je,{value:e.rechargeChannel,onChange:p=>{t(h=>({...h,rechargeChannel:p,rechargeChannelError:p?"":h.rechargeChannelError}))},options:s?.map(p=>({value:p.value,label:p.label})),placeholder:S("请选择支付平台")}),e.rechargeChannelError&&m("div",{style:b.error,children:e.rechargeChannelError})]}),c&&u&&m("div",{style:{marginBottom:24,padding:"12px 16px",background:l?"#f6ffed":"#1a1a1a",border:`1px solid ${l?"#b7eb8f":"#333"}`,borderRadius:6,fontSize:14,color:"#52c41a"},children:[s.find(p=>p.value===e.rechargeChannel)?.label||e.rechargeChannel,S("需要收取手续费,实际支付金额约为:"),"$",u]}),e.error&&m("div",{style:{color:"#ff4d4f",marginBottom:12},children:e.error}),m("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[m("button",{type:"button",onClick:n,style:g,children:S("取消")}),m("button",{type:"submit",disabled:r,style:x,children:S(r?"提交中...":"去支付")})]})]})},ko={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"}}},Co=({value:e=[],onChange:t,maxCount:n=10,accept:r=".jpg,.jpeg,.png,.pdf",multiple:o=!0,disabled:i=!1})=>{const s=ye(null),[a,l]=P(!1),[u,f]=P(0),b=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE?"white":"dark",g=ko[b],x=async h=>{const y=Array.from(h.target.files).slice(0,n);if(!y.length)return;l(!0);const w=[];for(let E=0;E<y.length;E++){f(0);const T=new FormData;T.append("file",y[E]);try{const k=await fo(T,I=>f(I));k&&w.push(k)}catch{}}l(!1),f(0),t?.([...e,...w]),s.current&&(s.current.value="")},p=h=>{const y=e.filter((w,E)=>E!==h);t?.(y)};return m("div",{children:[m("div",{style:{...g.container,cursor:i?"not-allowed":g.container.cursor,opacity:i?.6:1},onClick:()=>!i&&s.current?.click(),children:[m("div",{style:{fontSize:48,marginBottom:12},children:"📁"}),m("div",{style:{color:"#222",fontSize:15,marginBottom:4},children:S("点击或拖拽文件到此处上传")}),m("div",{style:{color:"#999",fontSize:13},children:[S("支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传")," ",n," ",S("个文件")]}),m("input",{ref:s,type:"file",multiple:o,accept:r,style:{display:"none"},onChange:x,disabled:i}),a&&m("div",{style:{marginTop:12,color:"#1677ff"},children:[S("正在上传...")," ",u,"%"]})]}),e&&e.length>0&&m("div",{style:{marginTop:12},children:e.map((h,y)=>m("div",{style:g.fileItem,children:[m("div",{style:{display:"flex",alignItems:"center",flex:1},children:[m("span",{style:{fontWeight:500,wordBreak:"break-all"},children:h.split("/").pop()}),m("span",{style:{color:"#8C8F93",fontSize:13,marginLeft:8},children:["[",S("已上传"),"]"]})]}),m("button",{type:"button",onClick:w=>{w.stopPropagation(),p(y)},style:g.removeBtn,disabled:i,children:S("移除")})]},h))})]})},Ao=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}");console.log(o,"allDicts");const i=o?.channel||[],l=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.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"},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},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}}:{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"},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},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}};return m("form",{onSubmit:async f=>{f.preventDefault();let c=!0;t(_=>({..._,platformError:"",transactionIdError:"",filesError:""})),e.platform||(t(_=>({..._,platformError:S("请选择支付平台")})),c=!1),e.transactionId.trim()||(t(_=>({..._,transactionIdError:S("请输入转账交易ID")})),c=!1),(!e.files||e.files.length===0)&&(t(_=>({..._,filesError:S("请上传转账凭证")})),c=!1),c&&(await po({transferChannel:e.platform,transferNo:e.transactionId,voucherUrls:e.files}),n(),qe.success(S("离线充值创建成功")))},children:[m("div",{style:{marginBottom:18},children:[m("div",{style:l.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("第三方支付平台")]}),m(Je,{value:e.platform,onChange:f=>{t(c=>({...c,platform:f,platformError:f?"":c.platformError}))},options:[...i?.map(f=>({value:f.value,label:f.label}))],placeholder:S("请选择支付平台")}),e.platformError&&m("div",{style:l.error,children:e.platformError})]}),m("div",{style:{marginBottom:18},children:[m("div",{style:l.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("交易ID")]}),m("input",{type:"text",placeholder:S("请输入转账交易ID"),value:e.transactionId,maxLength:200,onInput:f=>{let c=f.target.value;c.length>200&&(c=c.slice(0,200)),t(_=>({..._,transactionId:c,transactionIdError:c?"":_.transactionIdError}))},style:{...l.input,...e.transactionIdError?l.inputError:{}}}),e.transactionIdError&&m("div",{style:l.error,children:e.transactionIdError})]}),m("div",{style:{marginBottom:24},children:[m("div",{style:l.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("上传文件")]}),m(Co,{value:e.files,onChange:f=>t(c=>({...c,files:f,filesError:""})),maxCount:10,accept:".jpg,.jpeg,.png,.pdf",multiple:!0}),e.filesError&&m("div",{style:l.error,children:e.filesError})]}),m("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[m("button",{type:"button",onClick:n,style:l.buttonCancel,children:S("取消")}),m("button",{type:"submit",disabled:r,style:l.buttonSubmit,children:S("去支付")})]})]})};function Oo({visible:e,onClose:t,onSubmit:n}){const[r,o]=P({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),[i,s]=P("online"),[a,l]=P({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1});if(Ae(()=>{e||(s("online"),o({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),l({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}))},[e]),!e)return null;const u=async h=>{h.preventDefault();let y=!0;if(o(w=>({...w,amountError:"",rechargeChannelError:""})),r.amount.trim()||(o(w=>({...w,amountError:S("请输入充值金额")})),y=!1),r.rechargeChannel||(o(w=>({...w,rechargeChannelError:S("请选择支付平台")})),y=!1),!!y){o(w=>({...w,loading:!0,error:""}));try{await n({amount:r.amount,rechargeChannel:r.rechargeChannel,currency:r.currency}),t()}catch{o(w=>({...w,error:S("提交失败,请重试")}))}finally{o(w=>({...w,loading:!1}))}}},[f,c]=P(!1),_=h=>{h.target===h.currentTarget?c(!0):c(!1)},b=h=>{h.target===h.currentTarget&&f&&t(),c(!1)},p=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE?{modalBg:"#fff",modalColor:"#222",modalBoxShadow:"0 4px 24px rgba(0,0,0,0.08)",mask:"rgba(0,0,0,0.3)",title:{fontWeight:600,fontSize:20,marginBottom:24,textAlign:"left",color:"#222"},closeBtn:{position:"absolute",right:16,top:16,background:"none",border:"none",color:"#222",fontSize:22,cursor:"pointer",lineHeight:1},tabBtn:(h,y)=>({flex:1,background:h?"#fff":"#F7F8FA",color:h?"#1890ff":"#222",border:"none",borderRadius:y?"8px 0 0 8px":"0 8px 8px 0",fontWeight:h?600:400,fontSize:16,height:48,boxShadow:h?"0 2px 8px 0 rgba(20,20,20,0.04)":"none",outline:"none",cursor:"pointer",borderRight:y?"1px solid #F0F1F3":void 0,borderLeft:y?void 0:"1px solid #F0F1F3",transition:"all 0.2s"})}:{modalBg:"#181A20",modalColor:"#fff",modalBoxShadow:"0 4px 24px rgba(0,0,0,0.5)",mask:"rgba(0,0,0,0.7)",title:{fontWeight:600,fontSize:20,marginBottom:24,textAlign:"left",color:"#fff"},closeBtn:{position:"absolute",right:16,top:16,background:"none",border:"none",color:"#fff",fontSize:22,cursor:"pointer",lineHeight:1},tabBtn:(h,y)=>({flex:1,background:h?"#23262F":"#181A20",color:h?"#00E8C6":"#fff",border:"none",borderRadius:y?"8px 0 0 8px":"0 8px 8px 0",fontWeight:h?600:400,fontSize:16,height:48,boxShadow:h?"0 2px 8px 0 rgba(20,20,20,0.10)":"none",outline:"none",cursor:"pointer",borderRight:y?"1px solid #23262F":void 0,borderLeft:y?void 0:"1px solid #23262F",transition:"all 0.2s"})};return m("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:p.mask,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},onMouseDown:_,onMouseUp:b,children:m("form",{onSubmit:u,style:{background:p.modalBg,padding:32,borderRadius:12,minWidth:400,maxWidth:400,color:p.modalColor,boxShadow:p.modalBoxShadow,position:"relative"},onClick:h=>h.stopPropagation(),children:[m("button",{type:"button",onClick:t,style:p.closeBtn,"aria-label":S("关闭"),children:"×"}),m("div",{style:p.title,children:S("充值 / 转账")}),m("div",{style:{display:"flex",marginBottom:28},children:[m("button",{type:"button",onClick:()=>s("online"),style:p.tabBtn(i==="online",!0),children:S("在线充值")}),m("button",{type:"button",onClick:()=>s("offline"),style:p.tabBtn(i==="offline",!1),children:S("线下转账")})]}),i==="online"?m(Ro,{formState:r,setFormState:o,onClose:t,loading:r.loading}):m(Ao,{formState:a,setFormState:l,onClose:t,loading:a.loading})]})})}function tt(){return(tt=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 Fo=["context","children"];function Po(e){this.getChildContext=function(){return e.context};var t=e.children,n=function(r,o){if(r==null)return{};var i,s,a={},l=Object.keys(r);for(s=0;s<l.length;s++)o.indexOf(i=l[s])>=0||(a[i]=r[i]);return a}(e,Fo);return pn(t,n)}function Bo(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=G(Po,tt({},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=[],i={},s=0,a=n.attributes,l=n.childNodes;for(s=a.length;s--;)a[s].name!=="slot"&&(i[a[s].name]=a[s].value,i[gn(a[s].name)]=a[s].value);for(s=l.length;s--;){var u=t(l[s],null),f=l[s].slot;f?i[f]=G(kt,{name:f},u):o[s]=u}var c=r?G(kt,null,o):o;return G(r||n.nodeName.toLowerCase(),i,c)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?dn:Ce)(this._vdom,this._root)}function gn(e){return e.replace(/-(\w)/g,function(t,n){return n?n.toUpperCase():""})}function No(e,t,n){if(this._vdom){var r={};r[e]=n=n??void 0,r[gn(e)]=n,this._vdom=pn(this._vdom,r),Ce(this._vdom,this._root)}}function Io(){Ce(this._vdom=null,this._root)}function kt(e,t){var n=this;return G("slot",tt({},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 bn(e,t,n,r){function o(){var i=Reflect.construct(HTMLElement,[],o);return i._vdomComponent=e,i._root=r&&r.shadow?i.attachShadow({mode:r.mode||"open"}):i,i}return(o.prototype=Object.create(HTMLElement.prototype)).constructor=o,o.prototype.connectedCallback=Bo,o.prototype.attributeChangedCallback=No,o.prototype.disconnectedCallback=Io,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),o.observedAttributes=n,n.forEach(function(i){Object.defineProperty(o.prototype,i,{get:function(){return this._vdom.props[i]},set:function(s){this._vdom?this.attributeChangedCallback(i,null,s):(this._props||(this._props={}),this._props[i]=s,this.connectedCallback());var a=typeof s;s!=null&&a!=="string"&&a!=="boolean"&&a!=="number"||this.setAttribute(i,s)}})}),customElements.define(t||e.tagName||e.displayName||e.name,o)}function Do(){const[e,t]=P(!1),n=async r=>{const o=await ho({amount:r.amount,currency:r.currency,rechargeChannel:r.rechargeChannel});window.open(o,"_blank")};return m("div",{children:[m(bo,{onClick:()=>t(!0),children:S("充值/转账")}),m(Oo,{visible:e,onClose:()=>t(!1),onSubmit:n})]})}bn(Do,"best-recharge",["theme"],{shadow:!1});const Uo=({popover:e,children:t,popoverWidth:n=300,popoverMinWidth:r=200,offsetY:o=16,offsetX:i=16,popoverPosition:s="top"})=>{const[a,l]=P(!1),[u,f]=P(s),c=ye(null),_=ye(null),b=()=>{if(_.current&&(clearTimeout(_.current),_.current=null),s==="top"||s==="bottom")if(c.current){const T=c.current.getBoundingClientRect();s==="top"&&T.top<100?f("bottom"):s==="bottom"&&window.innerHeight-T.bottom<100?f("top"):f(s)}else f(s);else f(s);l(!0)},g=()=>{_.current=window.setTimeout(()=>{l(!1)},120)},x={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"}}},h=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE,y=x[h?"white":"dark"];let w={position:"absolute",zIndex:999,borderRadius:6,fontSize:15,minWidth:r,width:n,padding:"8px 14px",pointerEvents:"auto",textAlign:"center",animation:"fadeInUp 0.3s",...y.popover},E={position:"absolute",zIndex:11,width:0,height:0};return u==="top"?(w={...w,left:"50%",top:-48,transform:"translateX(-50%)"},E={...E,left:"50%",bottom:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderTop:`8px solid ${y.arrow.top}`}):u==="bottom"?(w={...w,left:"50%",top:"100%",marginTop:o,transform:"translateX(-50%)"},E={...E,left:"50%",top:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:`8px solid ${y.arrow.bottom}`}):u==="leftTop"?(w={...w,right:"100%",top:0,marginRight:i,transform:"none"},E={...E,right:-8,top:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderLeft:`8px solid ${y.arrow.left}`}):u==="rightTop"&&(w={...w,left:"100%",top:0,marginLeft:i,transform:"translateY(0)"},E={...E,left:-8,top:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderRight:`8px solid ${y.arrow.right}`}),m("div",{ref:c,style:{position:"relative",display:"inline-block"},onMouseEnter:b,onMouseLeave:g,children:[t,a&&m("div",{style:w,onMouseEnter:b,onMouseLeave:g,children:[e,m("div",{style:E})]})]})};function Ct(e){return e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}const Lo={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 #23262F",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 zo(e){const[t,n]=P({available:0,currency:"USD",symbol:"$",details:[{label:S("真实金额"),value:0,color:"#15b36b",dot:"#15b36b"},{label:S("冻结金额"),value:0,color:"#f59e0b",dot:"#f59e0b"},{label:S("总可用"),value:0,color:"#1890ff",dot:"#15b36b"}]});Ae(()=>{(async()=>{try{const a=await co(),l={available:a.availableAmount,currency:"USD",symbol:"$",details:[{label:S("真实金额"),value:a.availableAmount,color:"#15b36b",dot:"#15b36b"},{label:S("冻结金额"),value:a.frozenAmount,color:"#f59e0b",dot:"#f59e0b"},{label:S("总可用"),value:a.totalAmount,color:"#1890ff",dot:"#15b36b"}]};n(l)}catch(a){console.error("获取余额失败:",a)}})()},[]);const o=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE,i=Lo[o?"white":"dark"];return m(Uo,{popover:m(Q,{children:[m("div",{style:i.popoverTitle,children:S("余额详情")}),t.details.map(s=>m("div",{style:i.detailRow,children:[m("span",{style:i.detailLabel,children:[m("span",{style:i.detailDot(s.dot)}),s.label]}),m("span",{style:i.detailValue(s.color),children:[t.symbol,Ct(s.value)]})]},s.label))]}),popoverPosition:e.popoverPosition||"bottom",children:m("div",{style:i.main,children:[t.symbol,Ct(t.available),m("span",{style:i.currency,children:t.currency})]})})}bn(zo,"best-statistical-balance");const Ho=["best-recharge","best-statistical-balance"];exports.components=Ho;exports.initFundUnit=_o;exports.npmTest=yn;exports.printCurrentTime=wn;exports.viteProxy=go;
|
package/dist/best-unit.js
CHANGED
|
@@ -3925,7 +3925,7 @@ function Io(e) {
|
|
|
3925
3925
|
details: [
|
|
3926
3926
|
{
|
|
3927
3927
|
label: S("真实金额"),
|
|
3928
|
-
value: a.
|
|
3928
|
+
value: a.availableAmount,
|
|
3929
3929
|
color: "#15b36b",
|
|
3930
3930
|
dot: "#15b36b"
|
|
3931
3931
|
},
|
|
@@ -3937,7 +3937,7 @@ function Io(e) {
|
|
|
3937
3937
|
},
|
|
3938
3938
|
{
|
|
3939
3939
|
label: S("总可用"),
|
|
3940
|
-
value: a.
|
|
3940
|
+
value: a.totalAmount,
|
|
3941
3941
|
color: "#1890ff",
|
|
3942
3942
|
dot: "#15b36b"
|
|
3943
3943
|
}
|
package/package.json
CHANGED
|
@@ -136,7 +136,7 @@ function StatisticalBalance(props: { popoverPosition?: PopoverPosition }) {
|
|
|
136
136
|
details: [
|
|
137
137
|
{
|
|
138
138
|
label: t("真实金额"),
|
|
139
|
-
value: balance.
|
|
139
|
+
value: balance.availableAmount,
|
|
140
140
|
color: "#15b36b",
|
|
141
141
|
dot: "#15b36b",
|
|
142
142
|
},
|
|
@@ -148,7 +148,7 @@ function StatisticalBalance(props: { popoverPosition?: PopoverPosition }) {
|
|
|
148
148
|
},
|
|
149
149
|
{
|
|
150
150
|
label: t("总可用"),
|
|
151
|
-
value: balance.
|
|
151
|
+
value: balance.totalAmount,
|
|
152
152
|
color: "#1890ff",
|
|
153
153
|
dot: "#15b36b",
|
|
154
154
|
},
|