import{T as a,a6 as e,a as l,O as t,o as u,e as o,h as s,w as n,i,F as r,u as c,B as d,I as m,j as f,z as p,l as v,k as _,m as y,A as x,a5 as j,G as h,H as b,Q as k,p as w}from"./index-90c12cc1.js";import{_ as g,a as V}from"./u-radio-group.226ac9ee.js";import{H as C}from"./index.0e2fd26a.js";import{u as N}from"./useScroll.50272fa4.js";import{u as M}from"./useInterface.bd4f041a.js";import{M as I}from"./index.4bde3b32.js";import{P as H}from"./Popup.4e72ea57.js";import{g as P,w as U,u as $}from"./index.24c948a7.js";import{H as B,I as D}from"./images.cf3befb9.js";import{l as E}from"./lodash.b1309c50.js";import{_ as R}from"./_plugin-vue_export-helper.1b428a4d.js";import"./u-icon.ec8b667f.js";import"./uv-icon.c815b875.js";import"./uv-icon.vue_vue_type_style_index_0_scoped_23936b10_lang.7145f5b2.js";import"./utils.80a0ac72.js";import"./index.188c29d6.js";import"./_commonjsHelpers.02d3be64.js";const S=R({__name:"index",setup(R){const{toast:S,loading:T,hideLoading:z}=M(),{scrollTop:A}=N(),{getParams:F,goBack:G}=c(),J=a();e(J);const L=l([]),O=l(),Q=l();async function W(){L.value=await P(),Q.value=L.value[0].id}const q=l(!1),K=l();async function X(){if(!q.value){if(!K.value.realName)return S({title:"请输入真实姓名"});if(!K.value.accountNum)return S({title:"请输入账号"});await $(K.value),S({title:"设置成功"}),await W(),O.value.close()}}const Y=l(0),Z=l(),aa=l("");function ea(){ua.value.amount=Y.value}function la(){if(ua.value.amount<=0)return S({title:"提现金额必须大于0"});const a=L.value.find((a=>a.id===Q.value));aa.value=`确定要提现 ${ua.value.amount} 到 ${a.paymentMethod} 吗？`,Z.value.show()}const ta=l(!1),ua=l({amount:0});async function oa(){try{ta.value=!0,ua.value.id=L.value.find((a=>a.id===Q.value)).id,await U(ua.value),S({title:"提现成功"}),ua.value.id=void 0,Y.value-=ua.value.amount,ua.value.amount=0,G({},2e3)}finally{ta.value=!1}}return t((async a=>{const e=F(a);if(await W(),Y.value=e.maxMoney||0,e&&1===Number(e.type)){const a=L.value.find((a=>"余额"===a.paymentMethod));if(!a)return;Q.value=a.id}})),(a,e)=>{const l=d,t=x,c=j,N=w,M=h(b("u-radio"),g),P=h(b("u-radio-group"),V);return u(),o(r,null,[s(C,{"scroll-top":i(A),"system-bar-area-bg":"#fff","header-area-bg":"#fff"},{default:n((()=>[m(" 提现 ")])),_:1},8,["scroll-top"]),s(l,null,{default:n((()=>[s(l,{class:"verification"},{default:n((()=>[s(l,{class:"ver-card"},{default:n((()=>[s(l,{class:"title"},{default:n((()=>[m("提现金额")])),_:1}),s(l,{class:"input row"},{default:n((()=>[s(l,{class:"flex flex-ai__center"},{default:n((()=>[s(t,{class:"price"},{default:n((()=>[m("￥")])),_:1}),s(c,{modelValue:ua.value.amount,"onUpdate:modelValue":e[0]||(e[0]=a=>ua.value.amount=a),max:Y.value,type:"digit",placeholder:"请输入提现金额"},null,8,["modelValue","max"])])),_:1}),Y.value>0?(u(),f(t,{key:0,class:"btn",onClick:ea},{default:n((()=>[m("全部提现 ")])),_:1})):p("",!0)])),_:1}),s(l,{class:"row"},{default:n((()=>[m(" 可提现金额"+v(Y.value)+"元 ",1)])),_:1})])),_:1}),s(l,{class:"ver-card"},{default:n((()=>[s(l,{class:"title"},{default:n((()=>[m("提现至")])),_:1}),s(P,{activeColor:"#EE6D46",modelValue:Q.value,"onUpdate:modelValue":e[1]||(e[1]=a=>Q.value=a),placement:"column"},{default:n((()=>[(u(!0),o(r,null,_(L.value,(a=>(u(),f(l,{key:a.id,class:"flex flex-jc__sb flex-ai__center",onClick:e=>Q.value=a.id},{default:n((()=>[s(l,{class:"input row method"},{default:n((()=>[s(l,{class:"flex flex-ai__center"},{default:n((()=>{return[s(N,{class:"icon",src:(e=a.type,[B,D][e])},null,8,["src"]),s(t,{class:"text"},{default:n((()=>[m(v(a.paymentMethod),1)])),_:2},1024)];var e})),_:2},1024),0!==a.type?(u(),f(t,{key:0,class:"btn primary-color",onClick:k((e=>async function(a){K.value=E.cloneDeep(a),O.value.show()}(a)),["stop"])},{default:n((()=>[m(" 更新账户 ")])),_:2},1032,["onClick"])):p("",!0)])),_:2},1024),s(M,{customStyle:{marginBottom:"8px"},label:" ",name:a.id},null,8,["name"])])),_:2},1032,["onClick"])))),128))])),_:1},8,["modelValue"])])),_:1}),s(l,{class:y(["btn-row row animation-button",{disabled:ua.value.amount<=0}]),onClick:la},{default:n((()=>[m(" 确认提现 ")])),_:1},8,["class"])])),_:1})])),_:1}),s(I,{ref_key:"modalRef",ref:Z,content:aa.value,onConfirm:oa},null,8,["content"]),s(H,{ref_key:"updatePopupRef",ref:O,title:`绑定${K.value&&K.value.paymentMethod||""}`,mode:"center","show-closeable":!1},{default:n((()=>[K.value?(u(),f(l,{key:0,class:"ali-popup"},{default:n((()=>[s(l,{class:"input"},{default:n((()=>[s(c,{type:"text",placeholder:"请输入真实姓名",modelValue:K.value.realName,"onUpdate:modelValue":e[2]||(e[2]=a=>K.value.realName=a)},null,8,["modelValue"])])),_:1}),s(l,{class:"input"},{default:n((()=>[s(c,{type:"text",placeholder:"请输入账号",modelValue:K.value.accountNum,"onUpdate:modelValue":e[3]||(e[3]=a=>K.value.accountNum=a)},null,8,["modelValue"])])),_:1}),s(l,{class:"btn animation-button",onClick:X},{default:n((()=>[m(" 保存 ")])),_:1})])),_:1})):p("",!0)])),_:1},8,["title"])],64)}}},[["__scopeId","data-v-6498c777"]]);export{S as default};
