best-unit 1.4.9 → 1.5.2
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
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
padding: 4px;
|
|
43
43
|
color: ${i.closeColor};
|
|
44
44
|
font-size: 12px;
|
|
45
|
-
`,l.onclick=()=>{document.body.removeChild(a)},a.appendChild(l)}document.body.appendChild(a),o!==0&&setTimeout(()=>{document.body.contains(a)&&document.body.removeChild(a)},o||3e3)}success(t){this.show("success",t)}error(t){this.show("error",t)}warning(t){this.show("warning",t)}info(t){this.show("info",t)}}const Xe=new xo;function So(e={}){const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");console.log("fundUnitParams",t);const{env:n}=t;let r;switch(n){case Z.DEV:case Z.DEVELOPMENT:r="/api";break;case Z.TEST:r="https://fund.bestfulfill.tech/api/sdk";break;case Z.PROD:case Z.PRODUCTION:default:r="https://fund.bestfulfill.com/api/sdk";break}const{baseURL:o=r,timeout:s=1e4,onError:i}=e,a=R.create({baseURL:o,timeout:s});return a.interceptors.request.use(d=>{const{token:l,locale:f}=t;return d.headers={...d.headers,Authorization:l,"x-locale":f===Pe.ZH?"zh-CN":"en-US"},d}),a.interceptors.response.use(d=>{if(d.data&&d.data.code===0)return d.data;const l=d.data?.msg||d.data?.message||"未知错误";return Xe.error(l),i&&i(l,d),Promise.reject(d.data||{message:"未知错误"})},d=>{const l=d.response?.data?.msg||d.response?.data?.message||d.message||"网络请求失败";return Xe.error(l),i&&i(l,d),Promise.reject(d)}),a}let xe=null;function X(){return xe||(xe=So()),xe}function Lo(){xe=null}function vn(){const e=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");return X().get("/balance",{params:{merchant_id:e.merchantId,biz_type:e.bizType,fund_balance_id:e.fundBalanceId}}).then(t=>{const n=t.data,r={fundBalanceId:n.fund_balance_id,merchantId:n.merchant_id,bizType:n.biz_type,currency:n.currency,totalAmount:n.total_amount,frozenAmount:n.frozen_amount,creditLimit:n.credit_config?.credit_limit,creditUsed:n.credit_used,isCredit:!!n.credit_config,availableAmount:n.available_amount,currBalance:n.curr_balance,pendingAmount:n.pending_amount,status:n.status,createdAt:n.created_at};return sessionStorage.setItem("balanceData",JSON.stringify(r)),r})}const wo=async()=>X().get("/all-dicts",{}).then(e=>(sessionStorage.setItem("all_dicts",JSON.stringify(e.data)),e.data||{})),Ao=async(e,t)=>X().post("/oss/upload",e,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:n=>{if(n.total){const r=Math.round(n.loaded*100/n.total);t&&t(r)}}}).then(n=>n.data?.url||""),Eo=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}"),n={merchant_id:Number(t.merchantId),biz_type:t.bizType,fund_balance_id:t.fundBalanceId,source_operator:t.userId?String(t.userId):void 0,transfer_no:e.transferNo,transfer_channel:e.transferChannel,voucher_urls:e.voucherUrls};return X().post("/offline/recharge/create",n,{})},vo=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}"),n={merchant_id:Number(t.merchantId),biz_type:t.bizType,fund_balance_id:t.fundBalanceId,source_operator:t.userId?String(t.userId):void 0,amount:e.amount,currency:e.currency,recharge_channel:e.rechargeChannel,return_url:window.location.href};return X().post("/online/recharge/create",n,{}).then(r=>r.data.redirect_url)},ko=async e=>X().get("/calc-payment-amount",{params:e}).then(t=>{const n=t.data;return{paymentAmount:n.payment_amount,fee:n.fee,currency:n.currency}}),To=async e=>X().get("/channel/info",{params:{code:e.code,biz_type:
|
|
45
|
+
`,l.onclick=()=>{document.body.removeChild(a)},a.appendChild(l)}document.body.appendChild(a),o!==0&&setTimeout(()=>{document.body.contains(a)&&document.body.removeChild(a)},o||3e3)}success(t){this.show("success",t)}error(t){this.show("error",t)}warning(t){this.show("warning",t)}info(t){this.show("info",t)}}const Xe=new xo;function So(e={}){const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");console.log("fundUnitParams",t);const{env:n}=t;let r;switch(n){case Z.DEV:case Z.DEVELOPMENT:r="/api";break;case Z.TEST:r="https://fund.bestfulfill.tech/api/sdk";break;case Z.PROD:case Z.PRODUCTION:default:r="https://fund.bestfulfill.com/api/sdk";break}const{baseURL:o=r,timeout:s=1e4,onError:i}=e,a=R.create({baseURL:o,timeout:s});return a.interceptors.request.use(d=>{const{token:l,locale:f}=t;return d.headers={...d.headers,Authorization:l,"x-locale":f===Pe.ZH?"zh-CN":"en-US"},d}),a.interceptors.response.use(d=>{if(d.data&&d.data.code===0)return d.data;const l=d.data?.msg||d.data?.message||"未知错误";return Xe.error(l),i&&i(l,d),Promise.reject(d.data||{message:"未知错误"})},d=>{const l=d.response?.data?.msg||d.response?.data?.message||d.message||"网络请求失败";return Xe.error(l),i&&i(l,d),Promise.reject(d)}),a}let xe=null;function X(){return xe||(xe=So()),xe}function Lo(){xe=null}function vn(){const e=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");return X().get("/balance",{params:{merchant_id:e.merchantId,biz_type:e.bizType,fund_balance_id:e.fundBalanceId}}).then(t=>{const n=t.data,r={fundBalanceId:n.fund_balance_id,merchantId:n.merchant_id,bizType:n.biz_type,currency:n.currency,totalAmount:n.total_amount,frozenAmount:n.frozen_amount,creditLimit:n.credit_config?.credit_limit,creditUsed:n.credit_used,isCredit:!!n.credit_config,availableAmount:n.available_amount,currBalance:n.curr_balance,pendingAmount:n.pending_amount,status:n.status,createdAt:n.created_at};return sessionStorage.setItem("balanceData",JSON.stringify(r)),r})}const wo=async()=>X().get("/all-dicts",{}).then(e=>(sessionStorage.setItem("all_dicts",JSON.stringify(e.data)),e.data||{})),Ao=async(e,t)=>X().post("/oss/upload",e,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:n=>{if(n.total){const r=Math.round(n.loaded*100/n.total);t&&t(r)}}}).then(n=>n.data?.url||""),Eo=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}"),n={merchant_id:Number(t.merchantId),biz_type:t.bizType,fund_balance_id:t.fundBalanceId,source_operator:t.userId?String(t.userId):void 0,transfer_no:e.transferNo,transfer_channel:e.transferChannel,voucher_urls:e.voucherUrls};return X().post("/offline/recharge/create",n,{})},vo=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}"),n={merchant_id:Number(t.merchantId),biz_type:t.bizType,fund_balance_id:t.fundBalanceId,source_operator:t.userId?String(t.userId):void 0,amount:e.amount,currency:e.currency,recharge_channel:e.rechargeChannel,return_url:window.location.href};return X().post("/online/recharge/create",n,{}).then(r=>r.data.redirect_url)},ko=async e=>X().get("/calc-payment-amount",{params:e}).then(t=>{const n=t.data;return{paymentAmount:n.payment_amount,fee:n.fee,currency:n.currency}}),To=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");return X().get("/channel/info",{params:{code:e.code,biz_type:t.bizType}}).then(n=>n.data?.detail||[])};async function Co(){return await vn()}function Mo(e){const{merchant_id:t,biz_type:n,fund_balance_id:r,user_id:o,theme:s=N.WHITE,locale:i=Pe.ZH,env:a,size:d,themeConfig:l}=e;console.log(e,"InitParams1111");const f="Bearer "+e.token;return sessionStorage.setItem("fund_unit_params",JSON.stringify({merchantId:t,bizType:n,fundBalanceId:r,userId:o,token:f,theme:s,locale:i,env:a,size:d,themeConfig:l})),Lo(),wo(),{token:f,merchantId:t,bizType:n,fundBalanceId:r,userId:o,theme:s,locale:i,env:a,size:d}}function k(e){const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");if(!e)return t;if(Array.isArray(e)){const n={};return e.forEach(r=>{n[r]=t[r]}),n}return t[e]}function kn(){const e=new CustomEvent("refresh-balance",{detail:{},bubbles:!0,composed:!0});window.dispatchEvent(e)}const Ro={"/api":{target:"https://fund.bestfulfill.tech/api/sdk",changeOrigin:!0,rewrite:e=>e.replace(/^\/api/,""),secure:!1}};function Bo(){const e=k("size");return{white:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 10px":"8px 16px",cursor:"pointer",fontSize:e===u.SMALL?12:16,fontWeight:600},dark:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 10px":"8px 16px",cursor:"pointer",fontSize:e===u.SMALL?12:16,fontWeight:600}}}function Fo(e){const t=k("theme"),n=k("themeConfig"),r=t===N.WHITE,o=Bo();let s=e;return!s&&n&&(s=(r?n.white:n.dark)?.color),r?{...o.white,background:s||o.white.background}:{...o.dark,background:s||o.dark.background}}function Tn({onClick:e,color:t,children:n}){const r=Fo(t);return m("button",{style:r,onClick:e,type:"button",children:n})}const Oo={"额外费用说明:您的地区、币种、支付卡类型等因素可能会导致手续费的变动,最终手续费以官方为准。":"额外费用说明:您的地区、币种、支付卡类型等因素可能会导致手续费的变动,最终手续费以官方为准。","手续费约为:":"手续费约为:",确定:"确定",提交成功:"提交成功",余额详情:"余额详情",真实金额:"真实金额",冻结金额:"冻结金额",信用额度:"信用额度",已用额度:"已用额度",可用余额:"可用余额",暂无数据:"暂无数据","金额需在1到999999.99之间":"金额需在1到999999.99之间","充值 / 转账":"充值 / 转账",在线充值:"在线充值",线下转账:"线下转账",充值币种:"充值币种",充值金额:"充值金额",支付平台:"支付平台",请选择充值币种:"请选择充值币种",请输入充值金额:"请输入充值金额",请选择支付平台:"请选择支付平台","需要收取手续费,实际支付金额约为:":"需要收取手续费,实际支付金额约为:","提交失败,请重试":"提交失败,请重试","提交中...":"提交中...",去支付:"去支付",取消:"取消",关闭:"关闭",第三方支付平台:"第三方支付平台",交易ID:"交易ID",请输入转账交易ID:"请输入转账交易ID",上传文件:"上传文件",请上传转账凭证:"请上传转账凭证","加载中...":"加载中...",错误:"错误",成功:"成功",必填:"必填","充值/转账":"充值/转账",切换为暗黑主题:"切换为暗黑主题",切换为白色主题:"切换为白色主题",点击或拖拽文件到此处上传:"点击或拖拽文件到此处上传","支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传":"支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传",个文件:"个文件","正在上传...":"正在上传...",已上传:"已上传",移除:"移除"};function Po(e){return Oo[e]||e}const Io={"额外费用说明:您的地区、币种、支付卡类型等因素可能会导致手续费的变动,最终手续费以官方为准。":"Additional note: Your region, currency, and card type may affect the processing fee; the final fee is determined by the provider.","手续费约为:":"Fee approximately: ",确定:"Confirm",提交成功:"Submit Success",余额详情:"Balance Details",真实金额:"Real Balance",冻结金额:"Frozen Amount",信用额度:"Credit Limit",已用额度:"Credit Used",可用余额:"Available Balance",暂无数据:"No Data","金额需在1到999999.99之间":"Amount must be between 1 and 999999.99","充值 / 转账":"Recharge / Transfer",在线充值:"Online Recharge",线下转账:"Offline Transfer",充值币种:"Recharge Currency",充值金额:"Recharge Amount",支付平台:"Payment Platform",请选择充值币种:"Please select recharge currency",请输入充值金额:"Please enter recharge amount",请选择支付平台:"Please select payment platform","需要收取手续费,实际支付金额约为:":"requires a handling fee, the actual payment amount is approximately: ","提交失败,请重试":"Submit failed, please try again","提交中...":"Submitting...",去支付:"Go to Pay",取消:"Cancel",关闭:"Close",第三方支付平台:"Third-party Payment Platform",交易ID:"Transaction ID",请输入转账交易ID:"Please enter transfer transaction ID",上传文件:"Upload Files",请上传转账凭证:"Please upload transfer voucher","加载中...":"Loading...",错误:"Error",成功:"Success",必填:"Required","充值/转账":"Recharge/Transfer",切换为暗黑主题:"Switch to Dark Theme",切换为白色主题:"Switch to Light Theme",点击或拖拽文件到此处上传:"Click or drag files here to upload","支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传":"Supports JPG, PNG, PDF formats, single file not exceeding 20MB, maximum",个文件:"files can be uploaded","正在上传...":"Uploading...",已上传:"Uploaded",移除:"Remove"};function Do(e){return Io[e]||e}function No(){return JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").locale||Pe.ZH}function L(e){return No()==="zh"?Po(e):Do(e)}const Ot={white:{trigger:{background:"#fff",color:"#222",border:"1px solid #d9d9d9"},triggerDisabled:{background:"#f5f5f5",color:"#bfbfbf",border:"1px solid #f0f0f0"},triggerError:{background:"#fff",color:"#222",border:"1px solid #ff4d4f"},dropdown:{background:"#fff",border:"1px solid #d9d9d9",color:"#222"},option:(e,t,n)=>({color:t?"#bfbfbf":e?"#1890ff":"#222",background:e?"#e6f7ff":n&&!t||t?"#f5f5f5":"#fff"}),placeholder:{color:"#bfbfbf"},scrollbarThumb:"#e5e5e5",scrollbarTrack:"#f5f5f5",boxShadow:"0 2px 8px rgba(0,0,0,0.08)"},dark:{trigger:{background:"#23262F",color:"#fff",border:"1px solid #374151"},triggerDisabled:{background:"#23262F",color:"#666",border:"1px solid #374151"},triggerError:{background:"#23262F",color:"#fff",border:"1px solid #ff4d4f"},dropdown:{background:"#23262F",border:"1px solid #374151",color:"#fff"},option:(e,t,n)=>({color:t?"#666":e?"#00E8C6":"#fff",background:e?"#23262F":n&&!t?"#333843":"#23262F"}),placeholder:{color:"#666"},scrollbarThumb:"#444C5C",scrollbarTrack:"#23262F",boxShadow:"0 2px 8px rgba(0,0,0,0.32)"}};function zo(){const e=k("theme"),t=k("themeConfig"),n=e===N.WHITE,r=n?Ot.white:Ot.dark;if(t){const o=n?t.white:t.dark;if(o?.color)return{...r,option:(s,i,a)=>({...r.option(s,i,a),color:i?r.option(s,i,a).color:s?o.color:r.option(s,i,a).color})}}return r}const Ze=({value:e,onChange:t,options:n,placeholder:r,style:o,error:s,disabled:i,dropdownStyle:a,className:d,dropdownClassName:l,children:f})=>{const[c,g]=F(!1),h=Ee(null),[_,y]=F(null),b=zo(),x=k("size");le(()=>{if(!c)return;const w=E=>{h.current&&!h.current.contains(E.target)&&g(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]);const S=n.find(w=>w.value===e),v=()=>s?b.triggerError:i?b.triggerDisabled:b.trigger;return m("div",{ref:h,className:d,style:{position:"relative",...o},children:[m("style",{children:`
|
|
46
46
|
.custom-select-dropdown {
|
|
47
47
|
scrollbar-width: thin;
|
|
48
48
|
scrollbar-color: ${b.scrollbarThumb} ${b.scrollbarTrack};
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
.custom-select-dropdown::-webkit-scrollbar-track {
|
|
58
58
|
background: ${b.scrollbarTrack};
|
|
59
59
|
}
|
|
60
|
-
`}),m("div",{onClick:()=>!i&&g(w=>!w),style:{minHeight:x===u.SMALL?32:40,borderRadius:6,display:"flex",alignItems:"center",padding:x===u.SMALL?"0 10px":"0 12px",fontSize:x===u.SMALL?12:15,cursor:i?"not-allowed":"pointer",boxSizing:"border-box",transition:"border 0.2s",opacity:i?.6:1,width:"100%",...v(),...o},tabIndex:0,children:[m("span",{style:{flex:1},children:S?S.label:m("span",{style:b.placeholder,children:r||"请选择"})}),m("span",{style:{marginLeft:8,display:"flex",alignItems:"center"},children:m("svg",{width:x===u.SMALL?16:20,height:x===u.SMALL?16: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&&!i&&m("div",{className:`custom-select-dropdown${l?" "+l:""}`,style:{position:"absolute",left:0,right:0,top:x===u.SMALL?32:44,zIndex:10,borderRadius:6,boxShadow:b.boxShadow,maxHeight:x===u.SMALL?160:220,overflowY:"auto",...b.dropdown,...a},children:[n.length===0&&m("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:x===u.SMALL?80:120,width:"100%",userSelect:"none"},children:[m("svg",{width:x===u.SMALL?48:64,height:x===u.SMALL?32:41,viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[m("title",{children:L("暂无数据")}),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:x===u.SMALL?12:15},children:L("暂无数据")})]}),n.map((w,E)=>m("div",{onClick:()=>{w.disabled||(g(!1),t?.(w.value))},onMouseEnter:()=>y(E),onMouseLeave:()=>y(null),style:{padding:x===u.SMALL?"6px 10px":"10px 16px",fontSize:x===u.SMALL?12:15,cursor:w.disabled?"not-allowed":"pointer",fontWeight:e===w.value?600:400,opacity:w.disabled?.6:1,...b.option(e===w.value,!!w.disabled,_===E)},children:w.label},w.value))]}),f]})};function Uo(){const e=k("size");return{white:{label:{marginBottom:e===u.SMALL?6:8,fontSize:e===u.SMALL?12:14,color:"#222",textAlign:"left",display:"block"},input:{width:"100%",padding:e===u.SMALL?"8px 10px":"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:e===u.SMALL?12:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},selectError:{border:"1px solid #ff4d4f"},error:{color:"#ff4d4f",fontSize:e===u.SMALL?12:13,marginTop:e===u.SMALL?2:4,textAlign:"left"},buttonCancel:{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:e===u.SMALL?"6px 16px":"8px 24px",fontSize:e===u.SMALL?12:15,cursor:"pointer"},buttonSubmit:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 16px":"8px 24px",fontSize:e===u.SMALL?12:15,cursor:"pointer",fontWeight:600},feeTip:{marginBottom:24,padding:e===u.SMALL?"8px 10px":"12px 16px",background:"#f6ffed",border:"1px solid #b7eb8f",borderRadius:6,fontSize:e===u.SMALL?12:14,color:"#52c41a"},feeDetailBox:{marginTop:e===u.SMALL?8:10,marginBottom:e===u.SMALL?16:20,padding:e===u.SMALL?"8px 10px":"12px 16px",background:"#fff",border:"1px solid #E5E6EB",borderRadius:6},feeDetailTitle:{fontSize:e===u.SMALL?12:14,color:"#222",fontWeight:600,marginBottom:e===u.SMALL?6:8},feeAmount:{color:"#F53F3F",marginLeft:4},feeDetailDesc:{fontSize:e===u.SMALL?12:13,color:"#6b7280",lineHeight:1.5}},dark:{label:{marginBottom:e===u.SMALL?6:8,fontSize:e===u.SMALL?12:14,color:"#fff",textAlign:"left",display:"block"},input:{width:"100%",padding:e===u.SMALL?"8px 10px":"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #374151",background:"#23262F",color:"#fff",fontSize:e===u.SMALL?12:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},selectError:{border:"1px solid #ff4d4f"},error:{color:"#ff4d4f",fontSize:e===u.SMALL?12:13,marginTop:e===u.SMALL?2:4,textAlign:"left"},buttonCancel:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 16px":"8px 24px",fontSize:e===u.SMALL?12:15,cursor:"pointer"},buttonSubmit:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 16px":"8px 24px",fontSize:e===u.SMALL?12:15,cursor:"pointer",fontWeight:600},feeTip:{marginBottom:e===u.SMALL?16:24,padding:e===u.SMALL?"8px 10px":"12px 16px",background:"#1a1a1a",border:"1px solid #333",borderRadius:6,fontSize:e===u.SMALL?12:14,color:"#52c41a"},feeDetailBox:{marginTop:e===u.SMALL?8:10,marginBottom:e===u.SMALL?16:20,padding:e===u.SMALL?"8px 10px":"12px 16px",background:"#23262F",border:"1px solid #374151",borderRadius:6},feeDetailTitle:{fontSize:e===u.SMALL?12:14,color:"#fff",fontWeight:600,marginBottom:e===u.SMALL?6:8},feeAmount:{color:"#FF6B6B",marginLeft:4},feeDetailDesc:{fontSize:e===u.SMALL?12:13,color:"#B5B8BE",lineHeight:1.5}}}}function Ho(){const e=k("theme"),t=k("themeConfig"),n=e===N.WHITE,r=Uo(),o=n?r.white:r.dark;if(t){const s=n?t.white:t.dark;if(s?.color)return{...o,buttonSubmit:{...o.buttonSubmit,background:s.color}}}return o}function jo(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 $o(e){if(!e)return"";const t=parseFloat(e);return isNaN(t)?"":t.toFixed(2)}const Wo=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}"),s=o?.currency||[],i=o?.channel?.filter(_=>_.payment_support)||[],[a,d]=F(""),[l,f]=F(""),[c,g]=F(!1),h=Ho();return le(()=>{e.currency&&e.amount&&e.rechargeChannel?ko({channel:e.rechargeChannel,amount:e.amount,currency:e.currency}).then(_=>{d(_.paymentAmount),f(_.fee),g(!0)}).catch(_=>{console.error("计算支付金额失败:",_),g(!1)}):g(!1)},[e.currency,e.amount,e.rechargeChannel]),m(K,{children:[m("div",{style:{marginBottom:18},children:[m("div",{style:h.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",L("充值币种")]}),m(Ze,{value:e.currency,onChange:_=>{t(y=>({...y,currency:_}))},options:s?.map(_=>({value:_.value,label:_.label})),placeholder:L("请选择充值币种")})]}),m("div",{style:{marginBottom:18},children:[m("div",{style:h.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",L("充值金额")]}),m("input",{type:"text",placeholder:L("请输入充值金额"),value:e.amount,onInput:_=>{let y=_.target.value;y=jo(y);let b="";if(y&&!y.endsWith(".")){let x=parseFloat(y);if(!isNaN(x)&&(x<1&&(x=1),x>999999.99&&(x=999999.99),y=x.toString(),/\./.test(_.target.value))){const S=_.target.value.split(".")[1];S!==void 0&&S.length>0&&(y=x.toFixed(Math.min(S.length,2)))}}t(x=>({...x,amount:y,amountError:b}))},onBlur:_=>{let y=_.target.value;y=$o(y),t(b=>({...b,amount:y,amountError:""}))},style:{...h.input,...e.amountError?h.inputError:{}}}),e.amountError&&m("div",{style:h.error,children:e.amountError})]}),m("div",{style:{marginBottom:24},children:[m("div",{style:h.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",L("支付平台")]}),m(Ze,{value:e.rechargeChannel,onChange:_=>{t(y=>({...y,rechargeChannel:_,rechargeChannelError:_?"":y.rechargeChannelError}))},options:i?.map(_=>({value:_.value,label:_.label})),placeholder:L("请选择支付平台")}),e.rechargeChannelError&&m("div",{style:h.error,children:e.rechargeChannelError})]}),c&&a&&m("div",{style:h.feeTip,children:[i.find(_=>_.value===e.rechargeChannel)?.label||e.rechargeChannel,L("需要收取手续费,实际支付金额约为:"),"$",a]}),c&&a&&m("div",{style:h.feeDetailBox,children:[m("div",{style:h.feeDetailTitle,children:[L("手续费约为:"),m("span",{style:h.feeAmount,children:["$",l]})]}),m("div",{style:h.feeDetailDesc,children:L("额外费用说明:您的地区、币种、支付卡类型等因素可能会导致手续费的变动,最终手续费以官方为准。")})]}),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:h.buttonCancel,children:L("取消")}),m("button",{type:"submit",disabled:r,style:h.buttonSubmit,children:L(r?"提交中...":"去支付")})]})]})};function qo(){const e=k("size");return{white:{container:{border:"1px dashed #E5E6EB",borderRadius:8,background:"#FCFCFD",padding:e===u.SMALL?16:24,textAlign:"center",cursor:"pointer",minHeight:e===u.SMALL?80:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:e===u.SMALL?12:15},fileItem:{display:"flex",alignItems:"center",background:"#F7F8FA",borderRadius:8,padding:e===u.SMALL?"8px 10px":"12px 16px",marginBottom:8,fontSize:e===u.SMALL?12:15,color:"#222",justifyContent:"space-between"},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 10px":"4px 14px",fontSize:e===u.SMALL?12:15,marginLeft:e===u.SMALL?8:16,cursor:"pointer"}},dark:{container:{border:"1.5px dashed #444C5C",borderRadius:8,background:"#181A20",padding:e===u.SMALL?16:24,textAlign:"center",cursor:"pointer",minHeight:e===u.SMALL?80:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:e===u.SMALL?12:15},fileItem:{display:"flex",alignItems:"center",background:"#23262F",borderRadius:8,padding:e===u.SMALL?"8px 10px":"12px 16px",marginBottom:8,fontSize:e===u.SMALL?12:15,color:"#fff",justifyContent:"space-between"},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 10px":"4px 14px",fontSize:e===u.SMALL?12:15,marginLeft:e===u.SMALL?8:16,cursor:"pointer"}}}}function Jo(){const t=k("theme")===N.WHITE,n=qo();return t?n.white:n.dark}const Vo=({value:e=[],onChange:t,maxCount:n=10,accept:r=".jpg,.jpeg,.png,.pdf",multiple:o=!0,disabled:s=!1})=>{const i=k("size"),a=Ee(null),[d,l]=F(!1),[f,c]=F(0),g=Jo(),h=async y=>{const b=Array.from(y.target.files).slice(0,n);if(!b.length)return;l(!0);const x=[];for(let S=0;S<b.length;S++){c(0);const v=new FormData;v.append("file",b[S]);try{const w=await Ao(v,E=>c(E));w&&x.push(w)}catch{}}l(!1),c(0),t?.([...e,...x]),a.current&&(a.current.value="")},_=y=>{const b=e.filter((x,S)=>S!==y);t?.(b)};return m("div",{children:[m("div",{style:{...g.container,cursor:s?"not-allowed":g.container.cursor,opacity:s?.6:1},onClick:()=>!s&&a.current?.click(),children:[m("div",{style:{fontSize:i===u.SMALL?32:48,marginBottom:i===u.SMALL?8:12},children:"📁"}),m("div",{style:{color:"#222",fontSize:i===u.SMALL?12:15,marginBottom:i===u.SMALL?4:8},children:L("点击或拖拽文件到此处上传")}),m("div",{style:{color:"#999",fontSize:i===u.SMALL?12:13},children:[L("支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传")," ",n," ",L("个文件")]}),m("input",{ref:a,type:"file",multiple:o,accept:r,style:{display:"none"},onChange:h,disabled:s}),d&&m("div",{style:{marginTop:i===u.SMALL?8:12,color:"#1677ff"},children:[L("正在上传...")," ",f,"%"]})]}),e&&e.length>0&&m("div",{style:{marginTop:i===u.SMALL?8:12},children:e.map((y,b)=>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:y.split("/").pop()})}),m("button",{type:"button",onClick:x=>{x.stopPropagation(),_(b)},style:g.removeBtn,disabled:s,children:L("移除")})]},y))})]})};function Go(){const e=k("size");return{white:{label:{marginBottom:e===u.SMALL?6:8,fontSize:e===u.SMALL?12:14,color:"#222",textAlign:"left",display:"block"},input:{width:"100%",padding:e===u.SMALL?"8px 10px":"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:e===u.SMALL?12:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},select:{width:"100%",padding:e===u.SMALL?"8px 10px":"10px 12px",borderRadius:6,border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:e===u.SMALL?12:15,outline:"none"},selectError:{border:"1px solid #ff4d4f"},upload:{border:"1px dashed #E5E6EB",borderRadius:8,background:"#FCFCFD",padding:e===u.SMALL?12:24,textAlign:"center",cursor:"pointer",minHeight:e===u.SMALL?100:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:e===u.SMALL?12:15},uploadError:{border:"1px dashed #ff4d4f"},fileItem:{display:"flex",alignItems:"center",background:"#F7F8FA",borderRadius:8,padding:e===u.SMALL?"8px 10px":"12px 16px",marginBottom:e===u.SMALL?6:8,fontSize:e===u.SMALL?12:15,color:"#222",justifyContent:"space-between"},buttonCancel:{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:e===u.SMALL?"6px 18px":"8px 24px",cursor:"pointer"},buttonSubmit:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 18px":"8px 24px",cursor:"pointer",fontWeight:600},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 18px":"4px 14px",fontSize:e===u.SMALL?12:15,marginLeft:e===u.SMALL?8:16,cursor:"pointer"},error:{color:"#ff4d4f",fontSize:e===u.SMALL?12:13,marginTop:e===u.SMALL?2:4,textAlign:"left"},channelInfoBox:{marginTop:e===u.SMALL?8:10,padding:e===u.SMALL?"8px 10px":"10px 12px",borderRadius:6,background:"#F7F8FA",border:"1px solid #E5E6EB"},channelInfoItem:{color:"#222",fontSize:e===u.SMALL?12:13,lineHeight:1.6,wordBreak:"break-all"}},dark:{label:{marginBottom:e===u.SMALL?4:8,fontSize:e===u.SMALL?12:14,color:"#fff",textAlign:"left",display:"block"},input:{width:"100%",padding:e===u.SMALL?"8px 10px":"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #374151",background:"#23262F",color:"#fff",fontSize:e===u.SMALL?12:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},select:{width:"100%",padding:e===u.SMALL?"8px 10px":"10px 12px",borderRadius:6,border:"1px solid #374151",background:"#23262F",color:"#fff",fontSize:e===u.SMALL?12:15,outline:"none"},selectError:{border:"1px solid #ff4d4f"},upload:{border:"1px dashed #374151",borderRadius:8,background:"#181A20",padding:e===u.SMALL?12:24,textAlign:"center",cursor:"pointer",minHeight:e===u.SMALL?100:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:e===u.SMALL?12:14},uploadError:{border:"1px dashed #ff4d4f"},fileItem:{display:"flex",alignItems:"center",background:"#23262F",borderRadius:8,padding:e===u.SMALL?"8px 10px":"12px 16px",marginBottom:e===u.SMALL?6:8,fontSize:e===u.SMALL?12:15,color:"#fff",justifyContent:"space-between"},buttonCancel:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 18px":"8px 24px",fontSize:e===u.SMALL?12:15,cursor:"pointer"},buttonSubmit:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 18px":"8px 24px",fontSize:e===u.SMALL?12:14,cursor:"pointer",fontWeight:600},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 18px":"4px 14px",fontSize:e===u.SMALL?12:15,marginLeft:e===u.SMALL?8:16,cursor:"pointer"},error:{color:"#ff4d4f",fontSize:e===u.SMALL?12:13,marginTop:e===u.SMALL?2:4,textAlign:"left"},channelInfoBox:{marginTop:e===u.SMALL?8:10,padding:e===u.SMALL?"8px 10px":"10px 12px",borderRadius:6,background:"#23262F",border:"1px solid #374151"},channelInfoItem:{color:"#fff",fontSize:e===u.SMALL?12:13,lineHeight:1.6,wordBreak:"break-all"}}}}function Ko(){const e=k("theme"),t=k("themeConfig"),n=e===N.WHITE,r=Go(),o=n?r.white:r.dark;if(console.log(t,"themeConfig"),t){const s=n?t.white:t.dark;if(s?.color)return{...o,buttonSubmit:{...o.buttonSubmit,background:s.color}}}return o}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(),[a,d]=F([]),l=async c=>{c.preventDefault();let g=!0;t(h=>({...h,platformError:"",transactionIdError:"",filesError:""})),e.platform||(t(h=>({...h,platformError:L("请选择支付平台")})),g=!1),e.transactionId.trim()||(t(h=>({...h,transactionIdError:L("请输入转账交易ID")})),g=!1),(!e.files||e.files.length===0)&&(t(h=>({...h,filesError:L("请上传转账凭证")})),g=!1),g&&(await Eo({transferChannel:e.platform,transferNo:e.transactionId,voucherUrls:e.files}),n(),Xe.success(L("提交成功")))};function f(c){t(g=>({...g,platform:c,platformError:c?"":g.platformError})),console.log(c,"value"),To({code:c,bizType:"fulfill"}).then(g=>{console.log(g,"res"),d(Array.isArray(g)?g:g?[String(g)]:[])})}return m("form",{onSubmit:l,children:[m("div",{style:{marginBottom:18},children:[m("div",{style:i.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",L("第三方支付平台")]}),m(Ze,{value:e.platform,onChange:c=>{f(c)},options:[...s?.map(c=>({value:c.value,label:c.label}))],placeholder:L("请选择支付平台")}),e.platformError&&m("div",{style:i.error,children:e.platformError}),a.length>0&&m("div",{style:i.channelInfoBox,children:a.map((c,g)=>m("div",{style:i.channelInfoItem,children:c},g))})]}),m("div",{style:{marginBottom:18},children:[m("div",{style:i.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",L("交易ID")]}),m("input",{type:"text",placeholder:L("请输入转账交易ID"),value:e.transactionId,maxLength:200,onInput:c=>{let g=c.target.value;g.length>200&&(g=g.slice(0,200)),t(h=>({...h,transactionId:g,transactionIdError:g?"":h.transactionIdError}))},style:{...i.input,...e.transactionIdError?i.inputError:{}}}),e.transactionIdError&&m("div",{style:i.error,children:e.transactionIdError})]}),m("div",{style:{marginBottom:24},children:[m("div",{style:i.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",L("上传文件")]}),m(Vo,{value:e.files,onChange:c=>t(g=>({...g,files:c,filesError:""})),maxCount:10,accept:".jpg,.jpeg,.png,.pdf",multiple:!0}),e.filesError&&m("div",{style:i.error,children:e.filesError})]}),m("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[m("button",{type:"button",onClick:n,style:i.buttonCancel,children:L("取消")}),m("button",{type:"submit",disabled:r,style:i.buttonSubmit,children:L("确定")})]})]})};function Zo(){const e=k("size");return{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:e===u.SMALL?16:24,cursor:"pointer",color:"#999",padding:"0",width:e===u.SMALL?16:24,height:e===u.SMALL?16:24,display:"flex",alignItems:"center",justifyContent:"center"},title:{fontSize:e===u.SMALL?16:18,fontWeight:"600",marginBottom:e===u.SMALL?16:24,color:"#222"},tabBtn:(t,n)=>({flex:1,padding:e===u.SMALL?"8px 10px":"12px 16px",background:t?"#1890ff":"transparent",color:t?"#fff":"#666",border:"1px solid #d9d9d9",borderRight:n?"none":"1px solid #d9d9d9",cursor:"pointer",fontSize:e===u.SMALL?12:14,fontWeight:t?"600":"400",borderRadius:n?"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:e===u.SMALL?"12px":"16px",right:e===u.SMALL?"12px":"16px",background:"none",border:"none",fontSize:e===u.SMALL?16:24,cursor:"pointer",color:"#B5B8BE",padding:"0",width:e===u.SMALL?16:24,height:e===u.SMALL?16:24,display:"flex",alignItems:"center",justifyContent:"center"},title:{fontSize:e===u.SMALL?16:18,fontWeight:"600",marginBottom:e===u.SMALL?16:24,color:"#F5F6FA"},tabBtn:(t,n)=>({flex:1,padding:e===u.SMALL?"8px 10px":"12px 16px",background:t?"#00E8C6":"transparent",color:t?"#fff":"#B5B8BE",border:"1px solid #444C5C",borderRight:n?"none":"1px solid #444C5C",cursor:"pointer",fontSize:e===u.SMALL?12:14,fontWeight:t?"600":"400",borderRadius:n?"6px 0 0 6px":"0 6px 6px 0"})}}}function Yo(){const t=k("theme")===N.WHITE,n=Zo();return t?n.white:n.dark}const pe=k("size");function Qo({visible:e,onClose:t,title:n,children:r,width:o=pe===u.SMALL?300:400,maxWidth:s=pe===u.SMALL?300:400,showClose:i=!0,maskClosable:a=!0}){const[d,l]=F(!1),f=Yo(),c=h=>{h.target===h.currentTarget?l(!0):l(!1)},g=h=>{h.target===h.currentTarget&&d&&a&&t(),l(!1)};return e?m("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:f.mask,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},onMouseDown:c,onMouseUp:g,children:m("div",{style:{background:f.modalBg,padding:pe===u.SMALL?24:32,borderRadius:pe===u.SMALL?8:12,minWidth:o,maxWidth:s,color:f.modalColor,boxShadow:f.modalBoxShadow,position:"relative"},onClick:h=>h.stopPropagation(),children:[i&&m("button",{type:"button",onClick:t,style:f.closeBtn,"aria-label":"关闭",children:"×"}),n&&m("div",{style:f.title,children:n}),r]})}):null}function ei(){const e=k("size");return{white:{tabBtn:(t,n)=>({flex:1,background:t?"#fff":"#F7F8FA",color:t?"#1890ff":"#222",border:"1px solid #F0F1F3",borderRadius:n?"8px 0 0 8px":"0 8px 8px 0",fontWeight:500,fontSize:e===u.SMALL?12:16,height:e===u.SMALL?32:48,boxShadow:t?"0 2px 8px 0 rgba(20,20,20,0.04)":"none",outline:"none",cursor:"pointer"})},dark:{tabBtn:(t,n)=>({flex:1,background:t?"#23262F":"#181A20",color:t?"#00E8C6":"#fff",border:"1px solid #444C5C",borderRadius:n?"8px 0 0 8px":"0 8px 8px 0",fontWeight:500,fontSize:e===u.SMALL?12:16,height:e===u.SMALL?32:48,boxShadow:t?"0 2px 8px 0 rgba(20,20,20,0.10)":"none",outline:"none",cursor:"pointer"})}}}function ti(){const e=k("theme"),t=k("themeConfig"),n=e===N.WHITE,r=ei(),o=n?r.white:r.dark;if(t){const s=n?t.white:t.dark;if(s?.color)return{...o,tabBtn:(i,a)=>({...o.tabBtn(i,a),color:i?s.color:o.tabBtn(i,a).color})}}return o}const ni=k("size");function ri({visible:e,onClose:t,onSubmit:n}){const[r,o]=F({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),[s,i]=F({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}),[a,d]=F("online"),l=ti();le(()=>{e||(d("online"),o({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),i({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}))},[e]);const f=async c=>{c.preventDefault();let g=!0;if(o(h=>({...h,amountError:"",rechargeChannelError:""})),r.amount.trim()||(o(h=>({...h,amountError:L("请输入充值金额")})),g=!1),r.rechargeChannel||(o(h=>({...h,rechargeChannelError:L("请选择支付平台")})),g=!1),!!g){o(h=>({...h,loading:!0,error:""}));try{await n({amount:r.amount,rechargeChannel:r.rechargeChannel,currency:r.currency}),t()}catch{o(h=>({...h,error:L("提交失败,请重试")}))}finally{o(h=>({...h,loading:!1}))}}};return m(Qo,{visible:e,onClose:t,title:L("充值 / 转账"),children:[m("div",{style:{display:"flex",marginBottom:ni===u.SMALL?16:28},children:[m("button",{type:"button",onClick:()=>d("online"),style:l.tabBtn(a==="online",!0),children:L("在线充值")}),m("button",{type:"button",onClick:()=>d("offline"),style:l.tabBtn(a==="offline",!1),children:L("线下转账")})]}),m("div",{style:{display:a==="online"?"block":"none"},children:m("form",{onSubmit:f,children:m(Wo,{formState:r,setFormState:o,onClose:t,loading:r.loading})})}),m("div",{style:{display:a==="offline"?"block":"none"},children:m(Xo,{formState:s,setFormState:i,onClose:t,loading:s.loading})})]})}function st(){return(st=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 oi=["context","children"];function ii(e){this.getChildContext=function(){return e.context};var t=e.children,n=function(r,o){if(r==null)return{};var s,i,a={},d=Object.keys(r);for(i=0;i<d.length;i++)o.indexOf(s=d[i])>=0||(a[s]=r[s]);return a}(e,oi);return Ln(t,n)}function si(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=Y(ii,st({},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,d=n.childNodes;for(i=a.length;i--;)a[i].name!=="slot"&&(s[a[i].name]=a[i].value,s[Cn(a[i].name)]=a[i].value);for(i=d.length;i--;){var l=t(d[i],null),f=d[i].slot;f?s[f]=Y(Pt,{name:f},l):o[i]=l}var c=r?Y(Pt,null,o):o;return Y(r||n.nodeName.toLowerCase(),s,c)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?Sn:Oe)(this._vdom,this._root)}function Cn(e){return e.replace(/-(\w)/g,function(t,n){return n?n.toUpperCase():""})}function ai(e,t,n){if(this._vdom){var r={};r[e]=n=n??void 0,r[Cn(e)]=n,this._vdom=Ln(this._vdom,r),Oe(this._vdom,this._root)}}function li(){Oe(this._vdom=null,this._root)}function Pt(e,t){var n=this;return Y("slot",st({},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 at(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=si,o.prototype.attributeChangedCallback=ai,o.prototype.disconnectedCallback=li,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 ci(){const[e,t]=F(!1),n=async r=>{const o=await vo({amount:r.amount,currency:r.currency,rechargeChannel:r.rechargeChannel});window.open(o,"_blank")};return m("div",{children:[m(Tn,{onClick:()=>t(!0),children:L("充值/转账")}),m(ri,{visible:e,onClose:()=>t(!1),onSubmit:n})]})}at(ci,"best-recharge",["theme"],{shadow:!1});const It={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 ui(){return k("theme")===N.WHITE?It.white:It.dark}const di=({popover:e,children:t,popoverWidth:n,popoverMinWidth:r,offsetY:o,offsetX:s,popoverPosition:i="top"})=>{const a=k("size"),d=n??(a===u.SMALL?200:300),l=r??(a===u.SMALL?150:200),f=o??(a===u.SMALL?8:16),c=s??(a===u.SMALL?8:16),[g,h]=F(!1),[_,y]=F(i),b=Ee(null),x=Ee(null),S=ui(),v=()=>{if(x.current&&(clearTimeout(x.current),x.current=null),i==="top"||i==="bottom")if(b.current){const D=b.current.getBoundingClientRect();i==="top"&&D.top<100?y("bottom"):i==="bottom"&&window.innerHeight-D.bottom<100?y("top"):y(i)}else y(i);else y(i);h(!0)},w=()=>{x.current=window.setTimeout(()=>{h(!1)},120)};let E={position:"absolute",zIndex:999,borderRadius:6,fontSize:a===u.SMALL?12:15,minWidth:l,width:d,padding:a===u.SMALL?"6px 12px":"8px 14px",pointerEvents:"auto",textAlign:"center",animation:"fadeInUp 0.3s",...S.popover},C={position:"absolute",zIndex:11,width:0,height:0};return _==="top"?(E={...E,left:"50%",top:-48,transform:"translateX(-50%)"},C={...C,left:"50%",bottom:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderTop:`8px solid ${S.arrow.top}`}):_==="bottom"?(E={...E,left:"50%",top:"100%",marginTop:f,transform:"translateX(-50%)"},C={...C,left:"50%",top:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:`8px solid ${S.arrow.bottom}`}):_==="leftTop"?(E={...E,right:"100%",top:0,marginRight:c,transform:"none"},C={...C,right:-8,top:a===u.SMALL?8:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderLeft:`8px solid ${S.arrow.left}`}):_==="rightTop"&&(E={...E,left:"100%",top:0,marginLeft:c,transform:"translateY(0)"},C={...C,left:-8,top:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderRight:`8px solid ${S.arrow.right}`}),m("div",{ref:b,style:{position:"relative",display:"inline-block"},onMouseEnter:v,onMouseLeave:w,children:[t,g&&m("div",{style:E,onMouseEnter:v,onMouseLeave:w,children:[e,m("div",{style:C})]})]})};function fi(){const e=k("size");return{white:{popoverTitle:{fontSize:e===u.SMALL?12:16,fontWeight:600,color:"#222",marginBottom:e===u.SMALL?12:16,textAlign:"center"},detailRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:e===u.SMALL?"6px 0":"8px 0",borderBottom:"1px solid #e5e7eb",fontSize:e===u.SMALL?12:15},detailLabel:{display:"flex",alignItems:"center",color:"#6b7280",fontWeight:500},detailDot:t=>({display:"inline-block",width:e===u.SMALL?6:8,height:e===u.SMALL?6:8,borderRadius:"50%",background:t,marginRight:e===u.SMALL?6:8}),detailValue:t=>({color:t,fontWeight:600,fontSize:e===u.SMALL?12:15}),main:{fontSize:e===u.SMALL?18:24,fontWeight:800,color:"#111827",display:"inline-block"},currency:{fontSize:e===u.SMALL?16:18,color:"#6b7280",marginLeft:e===u.SMALL?6:8,fontWeight:600}},dark:{popoverTitle:{fontSize:e===u.SMALL?14:16,fontWeight:600,color:"#fff",marginBottom:e===u.SMALL?14:16,textAlign:"center"},detailRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:e===u.SMALL?"6px 0":"8px 0",borderBottom:"1px solid #374151",fontSize:e===u.SMALL?12:15},detailLabel:{display:"flex",alignItems:"center",color:"#B5B8BE",fontWeight:500},detailDot:t=>({display:"inline-block",width:e===u.SMALL?6:8,height:e===u.SMALL?6:8,borderRadius:"50%",background:t,marginRight:e===u.SMALL?6:8}),detailValue:t=>({color:t,fontWeight:600,fontSize:e===u.SMALL?12:15}),main:{fontSize:e===u.SMALL?18:24,fontWeight:800,color:"#fff",display:"inline-block"},currency:{fontSize:e===u.SMALL?16:18,color:"#B5B8BE",marginLeft:e===u.SMALL?6:8,fontWeight:600}}}}function pi(){const t=k("theme")===N.WHITE,n=fi();return t?n.white:n.dark}function Dt(e){return e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}function hi(e){const[t,n]=F({currBalance:0,currency:"USD",details:[]}),r=async()=>{try{const i=await vn(),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"}],d={currBalance:i.currBalance,currency:"USD",symbol:"$",details:a};n(d)}catch(i){console.error("获取余额失败:",i)}};le(()=>{r()},[]),le(()=>{const i=()=>{r()};return window.addEventListener("refresh-balance",i),()=>{window.removeEventListener("refresh-balance",i)}},[]);const o=pi(),s=[{label:L("真实金额"),value:t.details[0]?.value||0,color:"#15b36b",dot:"#15b36b"},{label:L("冻结金额"),value:t.details[1]?.value||0,color:"#f59e0b",dot:"#f59e0b"},...t.details.length>4?[{label:L("信用额度"),value:t.details[2]?.value||0,color:"#1890ff",dot:"#1890ff"},{label:L("已用额度"),value:t.details[3]?.value||0,color:"#ff0000",dot:"#ff0000"}]:[],{label:L("可用余额"),value:t.details[4]?.value||0,color:"#1890ff",dot:"#15b36b"}];return m(di,{popover:m(K,{children:[m("div",{style:o.popoverTitle,children:L("余额详情")}),s.map(i=>m("div",{style:o.detailRow,children:[m("span",{style:o.detailLabel,children:[m("span",{style:o.detailDot(i.dot)}),i.label]}),m("span",{style:o.detailValue(i.color),children:Dt(i.value)})]},i.label))]}),popoverPosition:e.popoverPosition||"bottom",children:m("div",{style:o.main,children:[Dt(t.currBalance),m("span",{style:o.currency,children:t.currency})]})})}at(hi,"best-statistical-balance");const he={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 mi(e){return k("theme")===N.WHITE?{...he.white,background:e||he.white.background}:{...he.dark,background:e||he.dark.background}}function _i(e){switch(e){case"small":return{fontSize:"12px",gap:"2px"};case"large":return{fontSize:"18px",gap:"6px"};default:return{fontSize:"14px",gap:"4px"}}}function gi({color:e,size:t="medium",children:n}){const[r,o]=F(!1),s=mi(e),i=_i(t),a={...s,...i,display:"flex",alignItems:"center"};return m(K,{children:[m("style",{children:`
|
|
60
|
+
`}),m("div",{onClick:()=>!i&&g(w=>!w),style:{minHeight:x===u.SMALL?32:40,borderRadius:6,display:"flex",alignItems:"center",padding:x===u.SMALL?"0 10px":"0 12px",fontSize:x===u.SMALL?12:15,cursor:i?"not-allowed":"pointer",boxSizing:"border-box",transition:"border 0.2s",opacity:i?.6:1,width:"100%",...v(),...o},tabIndex:0,children:[m("span",{style:{flex:1},children:S?S.label:m("span",{style:b.placeholder,children:r||"请选择"})}),m("span",{style:{marginLeft:8,display:"flex",alignItems:"center"},children:m("svg",{width:x===u.SMALL?16:20,height:x===u.SMALL?16: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&&!i&&m("div",{className:`custom-select-dropdown${l?" "+l:""}`,style:{position:"absolute",left:0,right:0,top:x===u.SMALL?32:44,zIndex:10,borderRadius:6,boxShadow:b.boxShadow,maxHeight:x===u.SMALL?160:220,overflowY:"auto",...b.dropdown,...a},children:[n.length===0&&m("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:x===u.SMALL?80:120,width:"100%",userSelect:"none"},children:[m("svg",{width:x===u.SMALL?48:64,height:x===u.SMALL?32:41,viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[m("title",{children:L("暂无数据")}),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:x===u.SMALL?12:15},children:L("暂无数据")})]}),n.map((w,E)=>m("div",{onClick:()=>{w.disabled||(g(!1),t?.(w.value))},onMouseEnter:()=>y(E),onMouseLeave:()=>y(null),style:{padding:x===u.SMALL?"6px 10px":"10px 16px",fontSize:x===u.SMALL?12:15,cursor:w.disabled?"not-allowed":"pointer",fontWeight:e===w.value?600:400,opacity:w.disabled?.6:1,...b.option(e===w.value,!!w.disabled,_===E)},children:w.label},w.value))]}),f]})};function Uo(){const e=k("size");return{white:{label:{marginBottom:e===u.SMALL?6:8,fontSize:e===u.SMALL?12:14,color:"#222",textAlign:"left",display:"block"},input:{width:"100%",padding:e===u.SMALL?"8px 10px":"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:e===u.SMALL?12:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},selectError:{border:"1px solid #ff4d4f"},error:{color:"#ff4d4f",fontSize:e===u.SMALL?12:13,marginTop:e===u.SMALL?2:4,textAlign:"left"},buttonCancel:{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:e===u.SMALL?"6px 16px":"8px 24px",fontSize:e===u.SMALL?12:15,cursor:"pointer"},buttonSubmit:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 16px":"8px 24px",fontSize:e===u.SMALL?12:15,cursor:"pointer",fontWeight:600},feeTip:{marginBottom:24,padding:e===u.SMALL?"8px 10px":"12px 16px",background:"#f6ffed",border:"1px solid #b7eb8f",borderRadius:6,fontSize:e===u.SMALL?12:14,color:"#52c41a"},feeDetailBox:{marginTop:e===u.SMALL?8:10,marginBottom:e===u.SMALL?16:20,padding:e===u.SMALL?"8px 10px":"12px 16px",background:"#fff",border:"1px solid #E5E6EB",borderRadius:6},feeDetailTitle:{fontSize:e===u.SMALL?12:14,color:"#222",fontWeight:600,marginBottom:e===u.SMALL?6:8},feeAmount:{color:"#F53F3F",marginLeft:4},feeDetailDesc:{fontSize:e===u.SMALL?12:13,color:"#6b7280",lineHeight:1.5}},dark:{label:{marginBottom:e===u.SMALL?6:8,fontSize:e===u.SMALL?12:14,color:"#fff",textAlign:"left",display:"block"},input:{width:"100%",padding:e===u.SMALL?"8px 10px":"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #374151",background:"#23262F",color:"#fff",fontSize:e===u.SMALL?12:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},selectError:{border:"1px solid #ff4d4f"},error:{color:"#ff4d4f",fontSize:e===u.SMALL?12:13,marginTop:e===u.SMALL?2:4,textAlign:"left"},buttonCancel:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 16px":"8px 24px",fontSize:e===u.SMALL?12:15,cursor:"pointer"},buttonSubmit:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 16px":"8px 24px",fontSize:e===u.SMALL?12:15,cursor:"pointer",fontWeight:600},feeTip:{marginBottom:e===u.SMALL?16:24,padding:e===u.SMALL?"8px 10px":"12px 16px",background:"#1a1a1a",border:"1px solid #333",borderRadius:6,fontSize:e===u.SMALL?12:14,color:"#52c41a"},feeDetailBox:{marginTop:e===u.SMALL?8:10,marginBottom:e===u.SMALL?16:20,padding:e===u.SMALL?"8px 10px":"12px 16px",background:"#23262F",border:"1px solid #374151",borderRadius:6},feeDetailTitle:{fontSize:e===u.SMALL?12:14,color:"#fff",fontWeight:600,marginBottom:e===u.SMALL?6:8},feeAmount:{color:"#FF6B6B",marginLeft:4},feeDetailDesc:{fontSize:e===u.SMALL?12:13,color:"#B5B8BE",lineHeight:1.5}}}}function Ho(){const e=k("theme"),t=k("themeConfig"),n=e===N.WHITE,r=Uo(),o=n?r.white:r.dark;if(t){const s=n?t.white:t.dark;if(s?.color)return{...o,buttonSubmit:{...o.buttonSubmit,background:s.color}}}return o}function jo(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 $o(e){if(!e)return"";const t=parseFloat(e);return isNaN(t)?"":t.toFixed(2)}const Wo=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}"),s=o?.currency||[],i=o?.channel?.filter(_=>_.payment_support)||[],[a,d]=F(""),[l,f]=F(""),[c,g]=F(!1),h=Ho();return le(()=>{e.currency&&e.amount&&e.rechargeChannel?ko({channel:e.rechargeChannel,amount:e.amount,currency:e.currency}).then(_=>{d(_.paymentAmount),f(_.fee),g(!0)}).catch(_=>{console.error("计算支付金额失败:",_),g(!1)}):g(!1)},[e.currency,e.amount,e.rechargeChannel]),m(K,{children:[m("div",{style:{marginBottom:18},children:[m("div",{style:h.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",L("充值币种")]}),m(Ze,{value:e.currency,onChange:_=>{t(y=>({...y,currency:_}))},options:s?.map(_=>({value:_.value,label:_.label})),placeholder:L("请选择充值币种")})]}),m("div",{style:{marginBottom:18},children:[m("div",{style:h.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",L("充值金额")]}),m("input",{type:"text",placeholder:L("请输入充值金额"),value:e.amount,onInput:_=>{let y=_.target.value;y=jo(y);let b="";if(y&&!y.endsWith(".")){let x=parseFloat(y);if(!isNaN(x)&&(x<1&&(x=1),x>999999.99&&(x=999999.99),y=x.toString(),/\./.test(_.target.value))){const S=_.target.value.split(".")[1];S!==void 0&&S.length>0&&(y=x.toFixed(Math.min(S.length,2)))}}t(x=>({...x,amount:y,amountError:b}))},onBlur:_=>{let y=_.target.value;y=$o(y),t(b=>({...b,amount:y,amountError:""}))},style:{...h.input,...e.amountError?h.inputError:{}}}),e.amountError&&m("div",{style:h.error,children:e.amountError})]}),m("div",{style:{marginBottom:24},children:[m("div",{style:h.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",L("支付平台")]}),m(Ze,{value:e.rechargeChannel,onChange:_=>{t(y=>({...y,rechargeChannel:_,rechargeChannelError:_?"":y.rechargeChannelError}))},options:i?.map(_=>({value:_.value,label:_.label})),placeholder:L("请选择支付平台")}),e.rechargeChannelError&&m("div",{style:h.error,children:e.rechargeChannelError})]}),c&&a&&m("div",{style:h.feeTip,children:[i.find(_=>_.value===e.rechargeChannel)?.label||e.rechargeChannel,L("需要收取手续费,实际支付金额约为:"),"$",a]}),c&&a&&m("div",{style:h.feeDetailBox,children:[m("div",{style:h.feeDetailTitle,children:[L("手续费约为:"),m("span",{style:h.feeAmount,children:["$",l]})]}),m("div",{style:h.feeDetailDesc,children:L("额外费用说明:您的地区、币种、支付卡类型等因素可能会导致手续费的变动,最终手续费以官方为准。")})]}),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:h.buttonCancel,children:L("取消")}),m("button",{type:"submit",disabled:r,style:h.buttonSubmit,children:L(r?"提交中...":"去支付")})]})]})};function qo(){const e=k("size");return{white:{container:{border:"1px dashed #E5E6EB",borderRadius:8,background:"#FCFCFD",padding:e===u.SMALL?16:24,textAlign:"center",cursor:"pointer",minHeight:e===u.SMALL?80:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:e===u.SMALL?12:15},fileItem:{display:"flex",alignItems:"center",background:"#F7F8FA",borderRadius:8,padding:e===u.SMALL?"8px 10px":"12px 16px",marginBottom:8,fontSize:e===u.SMALL?12:15,color:"#222",justifyContent:"space-between"},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 10px":"4px 14px",fontSize:e===u.SMALL?12:15,marginLeft:e===u.SMALL?8:16,cursor:"pointer"}},dark:{container:{border:"1.5px dashed #444C5C",borderRadius:8,background:"#181A20",padding:e===u.SMALL?16:24,textAlign:"center",cursor:"pointer",minHeight:e===u.SMALL?80:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:e===u.SMALL?12:15},fileItem:{display:"flex",alignItems:"center",background:"#23262F",borderRadius:8,padding:e===u.SMALL?"8px 10px":"12px 16px",marginBottom:8,fontSize:e===u.SMALL?12:15,color:"#fff",justifyContent:"space-between"},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 10px":"4px 14px",fontSize:e===u.SMALL?12:15,marginLeft:e===u.SMALL?8:16,cursor:"pointer"}}}}function Jo(){const t=k("theme")===N.WHITE,n=qo();return t?n.white:n.dark}const Vo=({value:e=[],onChange:t,maxCount:n=10,accept:r=".jpg,.jpeg,.png,.pdf",multiple:o=!0,disabled:s=!1})=>{const i=k("size"),a=Ee(null),[d,l]=F(!1),[f,c]=F(0),g=Jo(),h=async y=>{const b=Array.from(y.target.files).slice(0,n);if(!b.length)return;l(!0);const x=[];for(let S=0;S<b.length;S++){c(0);const v=new FormData;v.append("file",b[S]);try{const w=await Ao(v,E=>c(E));w&&x.push(w)}catch{}}l(!1),c(0),t?.([...e,...x]),a.current&&(a.current.value="")},_=y=>{const b=e.filter((x,S)=>S!==y);t?.(b)};return m("div",{children:[m("div",{style:{...g.container,cursor:s?"not-allowed":g.container.cursor,opacity:s?.6:1},onClick:()=>!s&&a.current?.click(),children:[m("div",{style:{fontSize:i===u.SMALL?32:48,marginBottom:i===u.SMALL?8:12},children:"📁"}),m("div",{style:{color:"#222",fontSize:i===u.SMALL?12:15,marginBottom:i===u.SMALL?4:8},children:L("点击或拖拽文件到此处上传")}),m("div",{style:{color:"#999",fontSize:i===u.SMALL?12:13},children:[L("支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传")," ",n," ",L("个文件")]}),m("input",{ref:a,type:"file",multiple:o,accept:r,style:{display:"none"},onChange:h,disabled:s}),d&&m("div",{style:{marginTop:i===u.SMALL?8:12,color:"#1677ff"},children:[L("正在上传...")," ",f,"%"]})]}),e&&e.length>0&&m("div",{style:{marginTop:i===u.SMALL?8:12},children:e.map((y,b)=>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:y.split("/").pop()})}),m("button",{type:"button",onClick:x=>{x.stopPropagation(),_(b)},style:g.removeBtn,disabled:s,children:L("移除")})]},y))})]})};function Go(){const e=k("size");return{white:{label:{marginBottom:e===u.SMALL?6:8,fontSize:e===u.SMALL?12:14,color:"#222",textAlign:"left",display:"block"},input:{width:"100%",padding:e===u.SMALL?"8px 10px":"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:e===u.SMALL?12:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},select:{width:"100%",padding:e===u.SMALL?"8px 10px":"10px 12px",borderRadius:6,border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:e===u.SMALL?12:15,outline:"none"},selectError:{border:"1px solid #ff4d4f"},upload:{border:"1px dashed #E5E6EB",borderRadius:8,background:"#FCFCFD",padding:e===u.SMALL?12:24,textAlign:"center",cursor:"pointer",minHeight:e===u.SMALL?100:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:e===u.SMALL?12:15},uploadError:{border:"1px dashed #ff4d4f"},fileItem:{display:"flex",alignItems:"center",background:"#F7F8FA",borderRadius:8,padding:e===u.SMALL?"8px 10px":"12px 16px",marginBottom:e===u.SMALL?6:8,fontSize:e===u.SMALL?12:15,color:"#222",justifyContent:"space-between"},buttonCancel:{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:e===u.SMALL?"6px 18px":"8px 24px",cursor:"pointer"},buttonSubmit:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 18px":"8px 24px",cursor:"pointer",fontWeight:600},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 18px":"4px 14px",fontSize:e===u.SMALL?12:15,marginLeft:e===u.SMALL?8:16,cursor:"pointer"},error:{color:"#ff4d4f",fontSize:e===u.SMALL?12:13,marginTop:e===u.SMALL?2:4,textAlign:"left"},channelInfoBox:{marginTop:e===u.SMALL?8:10,padding:e===u.SMALL?"8px 10px":"10px 12px",borderRadius:6,background:"#F7F8FA",border:"1px solid #E5E6EB"},channelInfoItem:{color:"#222",fontSize:e===u.SMALL?12:13,lineHeight:1.6,wordBreak:"break-all"}},dark:{label:{marginBottom:e===u.SMALL?4:8,fontSize:e===u.SMALL?12:14,color:"#fff",textAlign:"left",display:"block"},input:{width:"100%",padding:e===u.SMALL?"8px 10px":"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #374151",background:"#23262F",color:"#fff",fontSize:e===u.SMALL?12:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},select:{width:"100%",padding:e===u.SMALL?"8px 10px":"10px 12px",borderRadius:6,border:"1px solid #374151",background:"#23262F",color:"#fff",fontSize:e===u.SMALL?12:15,outline:"none"},selectError:{border:"1px solid #ff4d4f"},upload:{border:"1px dashed #374151",borderRadius:8,background:"#181A20",padding:e===u.SMALL?12:24,textAlign:"center",cursor:"pointer",minHeight:e===u.SMALL?100:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:e===u.SMALL?12:14},uploadError:{border:"1px dashed #ff4d4f"},fileItem:{display:"flex",alignItems:"center",background:"#23262F",borderRadius:8,padding:e===u.SMALL?"8px 10px":"12px 16px",marginBottom:e===u.SMALL?6:8,fontSize:e===u.SMALL?12:15,color:"#fff",justifyContent:"space-between"},buttonCancel:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 18px":"8px 24px",fontSize:e===u.SMALL?12:15,cursor:"pointer"},buttonSubmit:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 18px":"8px 24px",fontSize:e===u.SMALL?12:14,cursor:"pointer",fontWeight:600},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:e===u.SMALL?"6px 18px":"4px 14px",fontSize:e===u.SMALL?12:15,marginLeft:e===u.SMALL?8:16,cursor:"pointer"},error:{color:"#ff4d4f",fontSize:e===u.SMALL?12:13,marginTop:e===u.SMALL?2:4,textAlign:"left"},channelInfoBox:{marginTop:e===u.SMALL?8:10,padding:e===u.SMALL?"8px 10px":"10px 12px",borderRadius:6,background:"#23262F",border:"1px solid #374151"},channelInfoItem:{color:"#fff",fontSize:e===u.SMALL?12:13,lineHeight:1.6,wordBreak:"break-all"}}}}function Ko(){const e=k("theme"),t=k("themeConfig"),n=e===N.WHITE,r=Go(),o=n?r.white:r.dark;if(console.log(t,"themeConfig"),t){const s=n?t.white:t.dark;if(s?.color)return{...o,buttonSubmit:{...o.buttonSubmit,background:s.color}}}return o}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(),[a,d]=F([]),l=async c=>{c.preventDefault();let g=!0;t(h=>({...h,platformError:"",transactionIdError:"",filesError:""})),e.platform||(t(h=>({...h,platformError:L("请选择支付平台")})),g=!1),e.transactionId.trim()||(t(h=>({...h,transactionIdError:L("请输入转账交易ID")})),g=!1),(!e.files||e.files.length===0)&&(t(h=>({...h,filesError:L("请上传转账凭证")})),g=!1),g&&(await Eo({transferChannel:e.platform,transferNo:e.transactionId,voucherUrls:e.files}),n(),Xe.success(L("提交成功")))};function f(c){t(g=>({...g,platform:c,platformError:c?"":g.platformError})),To({code:c}).then(g=>{d(Array.isArray(g)?g:g?[String(g)]:[])})}return m("form",{onSubmit:l,children:[m("div",{style:{marginBottom:18},children:[m("div",{style:i.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",L("第三方支付平台")]}),m(Ze,{value:e.platform,onChange:c=>{f(c)},options:[...s?.map(c=>({value:c.value,label:c.label}))],placeholder:L("请选择支付平台")}),e.platformError&&m("div",{style:i.error,children:e.platformError}),a.length>0&&m("div",{style:i.channelInfoBox,children:a.map((c,g)=>m("div",{style:i.channelInfoItem,children:c},g))})]}),m("div",{style:{marginBottom:18},children:[m("div",{style:i.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",L("交易ID")]}),m("input",{type:"text",placeholder:L("请输入转账交易ID"),value:e.transactionId,maxLength:200,onInput:c=>{let g=c.target.value;g.length>200&&(g=g.slice(0,200)),t(h=>({...h,transactionId:g,transactionIdError:g?"":h.transactionIdError}))},style:{...i.input,...e.transactionIdError?i.inputError:{}}}),e.transactionIdError&&m("div",{style:i.error,children:e.transactionIdError})]}),m("div",{style:{marginBottom:24},children:[m("div",{style:i.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",L("上传文件")]}),m(Vo,{value:e.files,onChange:c=>t(g=>({...g,files:c,filesError:""})),maxCount:10,accept:".jpg,.jpeg,.png,.pdf",multiple:!0}),e.filesError&&m("div",{style:i.error,children:e.filesError})]}),m("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[m("button",{type:"button",onClick:n,style:i.buttonCancel,children:L("取消")}),m("button",{type:"submit",disabled:r,style:i.buttonSubmit,children:L("确定")})]})]})};function Zo(){const e=k("size");return{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:e===u.SMALL?16:24,cursor:"pointer",color:"#999",padding:"0",width:e===u.SMALL?16:24,height:e===u.SMALL?16:24,display:"flex",alignItems:"center",justifyContent:"center"},title:{fontSize:e===u.SMALL?16:18,fontWeight:"600",marginBottom:e===u.SMALL?16:24,color:"#222"},tabBtn:(t,n)=>({flex:1,padding:e===u.SMALL?"8px 10px":"12px 16px",background:t?"#1890ff":"transparent",color:t?"#fff":"#666",border:"1px solid #d9d9d9",borderRight:n?"none":"1px solid #d9d9d9",cursor:"pointer",fontSize:e===u.SMALL?12:14,fontWeight:t?"600":"400",borderRadius:n?"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:e===u.SMALL?"12px":"16px",right:e===u.SMALL?"12px":"16px",background:"none",border:"none",fontSize:e===u.SMALL?16:24,cursor:"pointer",color:"#B5B8BE",padding:"0",width:e===u.SMALL?16:24,height:e===u.SMALL?16:24,display:"flex",alignItems:"center",justifyContent:"center"},title:{fontSize:e===u.SMALL?16:18,fontWeight:"600",marginBottom:e===u.SMALL?16:24,color:"#F5F6FA"},tabBtn:(t,n)=>({flex:1,padding:e===u.SMALL?"8px 10px":"12px 16px",background:t?"#00E8C6":"transparent",color:t?"#fff":"#B5B8BE",border:"1px solid #444C5C",borderRight:n?"none":"1px solid #444C5C",cursor:"pointer",fontSize:e===u.SMALL?12:14,fontWeight:t?"600":"400",borderRadius:n?"6px 0 0 6px":"0 6px 6px 0"})}}}function Yo(){const t=k("theme")===N.WHITE,n=Zo();return t?n.white:n.dark}const pe=k("size");function Qo({visible:e,onClose:t,title:n,children:r,width:o=pe===u.SMALL?300:400,maxWidth:s=pe===u.SMALL?300:400,showClose:i=!0,maskClosable:a=!0}){const[d,l]=F(!1),f=Yo(),c=h=>{h.target===h.currentTarget?l(!0):l(!1)},g=h=>{h.target===h.currentTarget&&d&&a&&t(),l(!1)};return e?m("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:f.mask,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},onMouseDown:c,onMouseUp:g,children:m("div",{style:{background:f.modalBg,padding:pe===u.SMALL?24:32,borderRadius:pe===u.SMALL?8:12,minWidth:o,maxWidth:s,color:f.modalColor,boxShadow:f.modalBoxShadow,position:"relative"},onClick:h=>h.stopPropagation(),children:[i&&m("button",{type:"button",onClick:t,style:f.closeBtn,"aria-label":"关闭",children:"×"}),n&&m("div",{style:f.title,children:n}),r]})}):null}function ei(){const e=k("size");return{white:{tabBtn:(t,n)=>({flex:1,background:t?"#fff":"#F7F8FA",color:t?"#1890ff":"#222",border:"1px solid #F0F1F3",borderRadius:n?"8px 0 0 8px":"0 8px 8px 0",fontWeight:500,fontSize:e===u.SMALL?12:16,height:e===u.SMALL?32:48,boxShadow:t?"0 2px 8px 0 rgba(20,20,20,0.04)":"none",outline:"none",cursor:"pointer"})},dark:{tabBtn:(t,n)=>({flex:1,background:t?"#23262F":"#181A20",color:t?"#00E8C6":"#fff",border:"1px solid #444C5C",borderRadius:n?"8px 0 0 8px":"0 8px 8px 0",fontWeight:500,fontSize:e===u.SMALL?12:16,height:e===u.SMALL?32:48,boxShadow:t?"0 2px 8px 0 rgba(20,20,20,0.10)":"none",outline:"none",cursor:"pointer"})}}}function ti(){const e=k("theme"),t=k("themeConfig"),n=e===N.WHITE,r=ei(),o=n?r.white:r.dark;if(t){const s=n?t.white:t.dark;if(s?.color)return{...o,tabBtn:(i,a)=>({...o.tabBtn(i,a),color:i?s.color:o.tabBtn(i,a).color})}}return o}const ni=k("size");function ri({visible:e,onClose:t,onSubmit:n}){const[r,o]=F({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),[s,i]=F({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}),[a,d]=F("online"),l=ti();le(()=>{e||(d("online"),o({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),i({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}))},[e]);const f=async c=>{c.preventDefault();let g=!0;if(o(h=>({...h,amountError:"",rechargeChannelError:""})),r.amount.trim()||(o(h=>({...h,amountError:L("请输入充值金额")})),g=!1),r.rechargeChannel||(o(h=>({...h,rechargeChannelError:L("请选择支付平台")})),g=!1),!!g){o(h=>({...h,loading:!0,error:""}));try{await n({amount:r.amount,rechargeChannel:r.rechargeChannel,currency:r.currency}),t()}catch{o(h=>({...h,error:L("提交失败,请重试")}))}finally{o(h=>({...h,loading:!1}))}}};return m(Qo,{visible:e,onClose:t,title:L("充值 / 转账"),children:[m("div",{style:{display:"flex",marginBottom:ni===u.SMALL?16:28},children:[m("button",{type:"button",onClick:()=>d("online"),style:l.tabBtn(a==="online",!0),children:L("在线充值")}),m("button",{type:"button",onClick:()=>d("offline"),style:l.tabBtn(a==="offline",!1),children:L("线下转账")})]}),m("div",{style:{display:a==="online"?"block":"none"},children:m("form",{onSubmit:f,children:m(Wo,{formState:r,setFormState:o,onClose:t,loading:r.loading})})}),m("div",{style:{display:a==="offline"?"block":"none"},children:m(Xo,{formState:s,setFormState:i,onClose:t,loading:s.loading})})]})}function st(){return(st=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 oi=["context","children"];function ii(e){this.getChildContext=function(){return e.context};var t=e.children,n=function(r,o){if(r==null)return{};var s,i,a={},d=Object.keys(r);for(i=0;i<d.length;i++)o.indexOf(s=d[i])>=0||(a[s]=r[s]);return a}(e,oi);return Ln(t,n)}function si(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=Y(ii,st({},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,d=n.childNodes;for(i=a.length;i--;)a[i].name!=="slot"&&(s[a[i].name]=a[i].value,s[Cn(a[i].name)]=a[i].value);for(i=d.length;i--;){var l=t(d[i],null),f=d[i].slot;f?s[f]=Y(Pt,{name:f},l):o[i]=l}var c=r?Y(Pt,null,o):o;return Y(r||n.nodeName.toLowerCase(),s,c)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?Sn:Oe)(this._vdom,this._root)}function Cn(e){return e.replace(/-(\w)/g,function(t,n){return n?n.toUpperCase():""})}function ai(e,t,n){if(this._vdom){var r={};r[e]=n=n??void 0,r[Cn(e)]=n,this._vdom=Ln(this._vdom,r),Oe(this._vdom,this._root)}}function li(){Oe(this._vdom=null,this._root)}function Pt(e,t){var n=this;return Y("slot",st({},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 at(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=si,o.prototype.attributeChangedCallback=ai,o.prototype.disconnectedCallback=li,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 ci(){const[e,t]=F(!1),n=async r=>{const o=await vo({amount:r.amount,currency:r.currency,rechargeChannel:r.rechargeChannel});window.open(o,"_blank")};return m("div",{children:[m(Tn,{onClick:()=>t(!0),children:L("充值/转账")}),m(ri,{visible:e,onClose:()=>t(!1),onSubmit:n})]})}at(ci,"best-recharge",["theme"],{shadow:!1});const It={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 ui(){return k("theme")===N.WHITE?It.white:It.dark}const di=({popover:e,children:t,popoverWidth:n,popoverMinWidth:r,offsetY:o,offsetX:s,popoverPosition:i="top"})=>{const a=k("size"),d=n??(a===u.SMALL?200:300),l=r??(a===u.SMALL?150:200),f=o??(a===u.SMALL?8:16),c=s??(a===u.SMALL?8:16),[g,h]=F(!1),[_,y]=F(i),b=Ee(null),x=Ee(null),S=ui(),v=()=>{if(x.current&&(clearTimeout(x.current),x.current=null),i==="top"||i==="bottom")if(b.current){const D=b.current.getBoundingClientRect();i==="top"&&D.top<100?y("bottom"):i==="bottom"&&window.innerHeight-D.bottom<100?y("top"):y(i)}else y(i);else y(i);h(!0)},w=()=>{x.current=window.setTimeout(()=>{h(!1)},120)};let E={position:"absolute",zIndex:999,borderRadius:6,fontSize:a===u.SMALL?12:15,minWidth:l,width:d,padding:a===u.SMALL?"6px 12px":"8px 14px",pointerEvents:"auto",textAlign:"center",animation:"fadeInUp 0.3s",...S.popover},C={position:"absolute",zIndex:11,width:0,height:0};return _==="top"?(E={...E,left:"50%",top:-48,transform:"translateX(-50%)"},C={...C,left:"50%",bottom:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderTop:`8px solid ${S.arrow.top}`}):_==="bottom"?(E={...E,left:"50%",top:"100%",marginTop:f,transform:"translateX(-50%)"},C={...C,left:"50%",top:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:`8px solid ${S.arrow.bottom}`}):_==="leftTop"?(E={...E,right:"100%",top:0,marginRight:c,transform:"none"},C={...C,right:-8,top:a===u.SMALL?8:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderLeft:`8px solid ${S.arrow.left}`}):_==="rightTop"&&(E={...E,left:"100%",top:0,marginLeft:c,transform:"translateY(0)"},C={...C,left:-8,top:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderRight:`8px solid ${S.arrow.right}`}),m("div",{ref:b,style:{position:"relative",display:"inline-block"},onMouseEnter:v,onMouseLeave:w,children:[t,g&&m("div",{style:E,onMouseEnter:v,onMouseLeave:w,children:[e,m("div",{style:C})]})]})};function fi(){const e=k("size");return{white:{popoverTitle:{fontSize:e===u.SMALL?12:16,fontWeight:600,color:"#222",marginBottom:e===u.SMALL?12:16,textAlign:"center"},detailRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:e===u.SMALL?"6px 0":"8px 0",borderBottom:"1px solid #e5e7eb",fontSize:e===u.SMALL?12:15},detailLabel:{display:"flex",alignItems:"center",color:"#6b7280",fontWeight:500},detailDot:t=>({display:"inline-block",width:e===u.SMALL?6:8,height:e===u.SMALL?6:8,borderRadius:"50%",background:t,marginRight:e===u.SMALL?6:8}),detailValue:t=>({color:t,fontWeight:600,fontSize:e===u.SMALL?12:15}),main:{fontSize:e===u.SMALL?18:24,fontWeight:800,color:"#111827",display:"inline-block"},currency:{fontSize:e===u.SMALL?16:18,color:"#6b7280",marginLeft:e===u.SMALL?6:8,fontWeight:600}},dark:{popoverTitle:{fontSize:e===u.SMALL?14:16,fontWeight:600,color:"#fff",marginBottom:e===u.SMALL?14:16,textAlign:"center"},detailRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:e===u.SMALL?"6px 0":"8px 0",borderBottom:"1px solid #374151",fontSize:e===u.SMALL?12:15},detailLabel:{display:"flex",alignItems:"center",color:"#B5B8BE",fontWeight:500},detailDot:t=>({display:"inline-block",width:e===u.SMALL?6:8,height:e===u.SMALL?6:8,borderRadius:"50%",background:t,marginRight:e===u.SMALL?6:8}),detailValue:t=>({color:t,fontWeight:600,fontSize:e===u.SMALL?12:15}),main:{fontSize:e===u.SMALL?18:24,fontWeight:800,color:"#fff",display:"inline-block"},currency:{fontSize:e===u.SMALL?16:18,color:"#B5B8BE",marginLeft:e===u.SMALL?6:8,fontWeight:600}}}}function pi(){const t=k("theme")===N.WHITE,n=fi();return t?n.white:n.dark}function Dt(e){return e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}function hi(e){const[t,n]=F({currBalance:0,currency:"USD",details:[]}),r=async()=>{try{const i=await vn(),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"}],d={currBalance:i.currBalance,currency:"USD",symbol:"$",details:a};n(d)}catch(i){console.error("获取余额失败:",i)}};le(()=>{r()},[]),le(()=>{const i=()=>{r()};return window.addEventListener("refresh-balance",i),()=>{window.removeEventListener("refresh-balance",i)}},[]);const o=pi(),s=[{label:L("真实金额"),value:t.details[0]?.value||0,color:"#15b36b",dot:"#15b36b"},{label:L("冻结金额"),value:t.details[1]?.value||0,color:"#f59e0b",dot:"#f59e0b"},...t.details.length>4?[{label:L("信用额度"),value:t.details[2]?.value||0,color:"#1890ff",dot:"#1890ff"},{label:L("已用额度"),value:t.details[3]?.value||0,color:"#ff0000",dot:"#ff0000"}]:[],{label:L("可用余额"),value:t.details[4]?.value||0,color:"#1890ff",dot:"#15b36b"}];return m(di,{popover:m(K,{children:[m("div",{style:o.popoverTitle,children:L("余额详情")}),s.map(i=>m("div",{style:o.detailRow,children:[m("span",{style:o.detailLabel,children:[m("span",{style:o.detailDot(i.dot)}),i.label]}),m("span",{style:o.detailValue(i.color),children:Dt(i.value)})]},i.label))]}),popoverPosition:e.popoverPosition||"bottom",children:m("div",{style:o.main,children:[Dt(t.currBalance),m("span",{style:o.currency,children:t.currency})]})})}at(hi,"best-statistical-balance");const he={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 mi(e){return k("theme")===N.WHITE?{...he.white,background:e||he.white.background}:{...he.dark,background:e||he.dark.background}}function _i(e){switch(e){case"small":return{fontSize:"12px",gap:"2px"};case"large":return{fontSize:"18px",gap:"6px"};default:return{fontSize:"14px",gap:"4px"}}}function gi({color:e,size:t="medium",children:n}){const[r,o]=F(!1),s=mi(e),i=_i(t),a={...s,...i,display:"flex",alignItems:"center"};return m(K,{children:[m("style",{children:`
|
|
61
61
|
@keyframes spin {
|
|
62
62
|
from {
|
|
63
63
|
transform: rotate(0deg);
|
package/dist/best-unit.js
CHANGED
|
@@ -2332,12 +2332,17 @@ const xo = async () => X().get("/all-dicts", {}).then((e) => (sessionStorage.set
|
|
|
2332
2332
|
fee: n.fee,
|
|
2333
2333
|
currency: n.currency
|
|
2334
2334
|
};
|
|
2335
|
-
}), Eo = async (e) =>
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2335
|
+
}), Eo = async (e) => {
|
|
2336
|
+
const t = JSON.parse(
|
|
2337
|
+
sessionStorage.getItem("fund_unit_params") || "{}"
|
|
2338
|
+
);
|
|
2339
|
+
return X().get("/channel/info", {
|
|
2340
|
+
params: {
|
|
2341
|
+
code: e.code,
|
|
2342
|
+
biz_type: t.bizType
|
|
2343
|
+
}
|
|
2344
|
+
}).then((n) => n.data?.detail || []);
|
|
2345
|
+
};
|
|
2341
2346
|
async function Fi() {
|
|
2342
2347
|
return await vn();
|
|
2343
2348
|
}
|
|
@@ -3662,11 +3667,10 @@ const qo = ({ formState: e, setFormState: t, onClose: n, loading: r }) => {
|
|
|
3662
3667
|
...g,
|
|
3663
3668
|
platform: c,
|
|
3664
3669
|
platformError: c ? "" : g.platformError
|
|
3665
|
-
})),
|
|
3666
|
-
code: c
|
|
3667
|
-
bizType: "fulfill"
|
|
3670
|
+
})), Eo({
|
|
3671
|
+
code: c
|
|
3668
3672
|
}).then((g) => {
|
|
3669
|
-
|
|
3673
|
+
d(Array.isArray(g) ? g : g ? [String(g)] : []);
|
|
3670
3674
|
});
|
|
3671
3675
|
}
|
|
3672
3676
|
return /* @__PURE__ */ m("form", { onSubmit: l, children: [
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -138,15 +138,15 @@ export const calcPaymentAmount = async (data: CalcPaymentAmountParams) => {
|
|
|
138
138
|
};
|
|
139
139
|
|
|
140
140
|
// /sdk/channel/info
|
|
141
|
-
export const getChannelInfo = async (data: {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
export const getChannelInfo = async (data: { code: string }) => {
|
|
142
|
+
const fundUnitParams = JSON.parse(
|
|
143
|
+
sessionStorage.getItem("fund_unit_params") || "{}"
|
|
144
|
+
);
|
|
145
145
|
return http()
|
|
146
146
|
.get("/channel/info", {
|
|
147
147
|
params: {
|
|
148
148
|
code: data.code,
|
|
149
|
-
biz_type:
|
|
149
|
+
biz_type: fundUnitParams.bizType,
|
|
150
150
|
},
|
|
151
151
|
})
|
|
152
152
|
.then((res) => {
|
|
@@ -79,13 +79,9 @@ export const OfflineTransferForm: FunctionalComponent<
|
|
|
79
79
|
platform: value,
|
|
80
80
|
platformError: value ? "" : state.platformError,
|
|
81
81
|
}));
|
|
82
|
-
console.log(value, "value");
|
|
83
82
|
getChannelInfo({
|
|
84
83
|
code: value,
|
|
85
|
-
bizType: "fulfill",
|
|
86
84
|
}).then((res) => {
|
|
87
|
-
console.log(res, "res");
|
|
88
|
-
// 兼容空值与非数组返回
|
|
89
85
|
setChannelInfo(Array.isArray(res) ? res : res ? [String(res)] : []);
|
|
90
86
|
});
|
|
91
87
|
}
|