import{bf as a,aj as s,i,eh as e,E as t,ei as r,ej as o,ek as n,el as h,em as d,cR as w,cS as l,en as c,eo as g,ep as u}from"./index-BhrLSE9x.js";const f=new Map([[1,"银行卡"],[2,"支付宝"],[3,"微信"],[4,"数字货币"],[8,"三方钱包"]]),y=a("withdrawal",{persist:!0,state:()=>({cardId:1,walletInfo:[],bankCardsList:[],deviceList:[],vrtualList:[],vrtualChanelList:[],withdrawConfig:{},userWithdrawInfo:{},withdrawRecord:[],loading:!0,allWithdrawConfig:[],withdrawalChannel:{},ways:[],selectedWay:0,isShowWithdrawalDialog:!1,isShowAddWithdrawalWayDialog:!1,isShowLockRecords:!1,isShowLockRecords2:!1,isShowPassowrDialog:!1,isShowPassowrdDialog:!1,isShowPhoneValidation:!1,isShowEmailValidation:!1,isShowPhoneDialogValidation:!1,isShowEmailDialogValidation:!1,validateByPhone:!1,validateByEmail:!1}),getters:{userStore:()=>s(),currentWay(){return this.ways&&this.ways.length&&this.ways.find((a=>a.id===this.selectedWay))||null},currentChannels(){return this.selectedWay?this.withdrawalChannel[this.selectedWay]??[]:[]},userWallets(){const{cardInfoList:a,alipayList:s,wechatList:i,virtualAccountInfoList:e,userUsdtAccountInfoRespVO:t}=this.userWithdrawInfo;return{1:a,2:s,3:i,4:t,8:e}},currentType(){return this.currentChannels&&this.currentChannels.length?this.currentChannels[0]??{}:{}}},actions:{setWithdrawalShowAction(a){this.isShowWithdrawalDialog=a},setAddWithdrawalWayShowAction(a){this.isShowAddWithdrawalWayDialog=a},setLockRecordsShowAction(a){this.isShowLockRecords=a},setLockRecords2ShowAction(a){this.isShowLockRecords2=a},setPasswordShowAction(a){this.isShowPassowrDialog=a},setPasswordDialogShowAction(a){this.isShowPassowrdDialog=a},setShowPhoneValidation(a){this.isShowPhoneValidation=a},setShowEmailValidation(a){this.isShowEmailValidation=a},setShowPhoneDialogValidation(a){this.isShowPhoneDialogValidation=a},setShowEmailDialogValidation(a){this.isShowEmailDialogValidation=a},handleCardId(a){this.cardId=a},async getWalletInfo(){if(!i())return;const a=await e();if(1!==a.code)return a.message&&t(a.message);this.walletInfo=a.data},async recycleBalance(a=!0){const s=await r();if(1!==s.code)return s.message&&t(s.message);this.getWalletInfo(),a&&t({message:"回收成功",type:"success"})},async queryAllUserBankCard(){const a=await o();if(1!==a.code)return a.message&&t(a.message);this.bankCardsList=a?.data?.cardList??[]},async queryUserLoginLog(a){const s=await n({pageNo:a?.pageNo??1,pageSize:a?.pageSize??10,userId:a?.userId??this.userStore.userInfo.userId,userName:a?.userName??this.userStore.userInfo.userName});if(!s.message)return s.message&&t(s.message);this.deviceList=s?.data?.records??[]},async handleDeleteUserLoginLog(a){const s=await h({id:a.id});if(!s.message)return s.message&&t(s.message);this.queryUserLoginLog()},async queryUserUnbindVirtualList(){const a=await d();if(!a.message)return a.message&&t(a.message);this.vrtualList=a?.data??[]},async bindBankCard(a){const s=await w(a);if(!s.message)return s.message&&t(s.message);this.queryAllUserBankCard()},async bindUserVirtual(a){const s=await l(a);if(!s.message)return s.message&&t(s.message);this.queryUserUnbindVirtualList()},async getWithdrawConfigs(a){const s=await c(a);if(!s.message)return s.message&&t(s.message);this.withdrawConfig=s?.data??{};let i=!1;if(2==+this.withdrawConfig?.verificationFrequency)i=!0;else if(1==+this.withdrawConfig?.verificationFrequency&&0==+this.withdrawConfig?.userWithdrawTime)i=!0;else if(3==+this.withdrawConfig?.verificationFrequency){i=this.withdrawConfig.withdrawalCount.split(",").map((a=>+a)).includes(this.withdrawConfig?.userWithdrawTime+1)}this.validateByPhone=1==+this.withdrawConfig?.verificationMethod&&i,this.validateByEmail=2==+this.withdrawConfig?.verificationMethod&&i},async withdrawInfo(){const a=await g();if(!a.message)return a.message&&t(a.message);this.userWithdrawInfo=a?.data??{};try{if(this.allWithdrawConfig=[...new Set(this.userWithdrawInfo.withdrawTypeConfigs.map((a=>a.withdrawType)))],this.ways=this.allWithdrawConfig.map((a=>({name:f.get(a),id:a}))),this.ways.length>0){for(const a of this.ways)this.withdrawalChannel[a.id]=this.userWithdrawInfo.withdrawTypeConfigs.filter((s=>s.withdrawType===a.id));this.selectedWay=this.ways[0].id}}catch(s){this.ways=[],this.selectedWay=null}},async queryPageWithdrawRecords(a){const s=await u({pageNo:1,pageSize:6,...a});if(!s.message)return s.message&&t(s.message);this.loading=!1,this.withdrawRecord=s?.data?.records??[]}}});export{y as u};
