2 lines
7.5 KiB
JavaScript
2 lines
7.5 KiB
JavaScript
import{aQ as e,ag as a,r as l,b6 as t,bX as o,bV as r,c as d,e as n,l as s,N as i,t as p,g as u,w as c,n as g,an as _,O as m,R as b,m as v,bY as h,bZ as w}from"./index.DjGThAdz.js";import{_ as y}from"./index.DiwcnuvH.js";import{getWithdrawalLsit as f,addMerchantWithdraw as F}from"./merchant.BuDP7swB.js";import{d as x,k as D,l as j}from"./commonOptions.CpODg7Hg.js";import"./el-col.BuQveV1c.js";import"./deposit.DUFaTeNT.js";import"./service.BCmiTIe4.js";import"./account.CuTixaZ8.js";const q={style:{padding:"10px 15px 0 15px"}},U={style:{"font-size":"30px"}},k={__name:"balance-withdrawal",setup(k){var A,L,R,E,T,O,V,z,I,S;const W=e();let C=[],G=[],N=[];const Q=a({columns:[{prop:"id",label:"ID",width:80,align:"center"},{prop:"merchant",label:"商户名称",align:"center",slot:"merchant_name_slot"},{prop:"withdraw_no",label:"提现单号",align:"center"},{prop:"amount",label:"提现金额",align:"center"},{prop:"fee",label:"手续费",align:"center"},{prop:"account_type",label:"提款账号类型",align:"center",slot:"account_type_slot"},{prop:"account_info",label:"提款账号信息",align:"center"},{prop:"created_at",label:"申请时间",align:"center"},{prop:"processed_at",label:"处理时间",align:"center"},{prop:"status",label:"状态",align:"center",slot:"status"}],tableData:[],searchFields:[{label:"提现单号",prop:"withdraw_no",type:"input",value:""},{label:"账号类型",type:"select",prop:"account_type",value:"",options:C},{label:"状态",type:"select",prop:"status",value:"",options:G},{prop:"created_at",label:"申请时间",type:"date",dateType:"datetimerange",value:[]},{prop:"processed_at",label:"处理时间",type:"date",dateType:"datetimerange",value:[]}],total:0,page:1,per_page:10,loading:!1,addForm:{title:"申请提现",fields:[{label:"商户名称",prop:"name",type:"input",value:"",disabled:!0},{label:"最低提现金额",prop:"withdraw_min",type:"number",value:"",disabled:!0},{label:"最高提现金额",prop:"withdraw_max",type:"number",value:"",disabled:!0},{label:"手续费",prop:"withdraw_fee",type:"number",value:"",disabled:!0},{label:"账户余额",prop:"balance",type:"number",value:"",disabled:!0},{label:"提现金额",prop:"amount",type:"number",value:""},{label:"提款账号",prop:"account_id",type:"select",options:N},{label:"支付密码",prop:"pay_password",type:"password",value:""},{label:"谷歌验证码",prop:"google_code",type:"input",value:""}],rules:{amount:[{required:!0,message:"请输入提现金额",trigger:"blur"}],account_id:[{required:!0,message:"请选择提款账号",trigger:"change"}],pay_password:[{required:!0,message:"请输入支付密码",trigger:"blur"}],google_code:[{required:!0,message:"请输入谷歌验证码",trigger:"blur"}]},values:{name:null==(L=null==(A=W.user)?void 0:A.info)?void 0:L.name,withdraw_min:null==(E=null==(R=W.user)?void 0:R.info)?void 0:E.withdraw_min,withdraw_max:null==(O=null==(T=W.user)?void 0:T.info)?void 0:O.withdraw_max,withdraw_fee:null==(z=null==(V=W.user)?void 0:V.info)?void 0:z.withdraw_fee,balance:(null==(S=null==(I=W.user)?void 0:I.info)?void 0:S.balance)||0,amount:"",account_id:"",pay_password:"",google_code:""}},btnLoading:!1,showAddDialog:!1}),X=(e,a)=>{let l="";return(0===a?C:G).some(a=>{if(a.value==e)return l=a.label,!0}),l},Y=()=>{Q.searchFields.forEach(e=>{"datetimerange"==e.dateType?e.value=[]:e.value=""}),J()},Z=l(null),B=h(async()=>{Z.value&&Z.value.hasValid&&Z.value.hasValid().validate(e=>{e&&(Q.btnLoading=!0,"申请提现"==Q.addForm.title&&F(Q.addForm.values).then(e=>{J(),Q.showAddDialog=!1,Q.btnLoading=!1,W.getUserInfo()}).catch(()=>{Q.btnLoading=!1}))})},300),H=(e,a)=>{var l,t,o,r,d,n,s,i,p,u;j().then(e=>{Q.addForm.fields.forEach(a=>{"account_id"===a.prop&&(a.options=N=e)})}).catch(()=>{item.options=N=[]}),Q.addForm={title:"申请提现",fields:[{label:"商户名称",prop:"name",type:"input",value:"",disabled:!0},{label:"最低提现金额",prop:"withdraw_min",type:"number",value:"",disabled:!0},{label:"最高提现金额",prop:"withdraw_max",type:"number",value:"",disabled:!0},{label:"手续费",prop:"withdraw_fee",type:"number",value:"",disabled:!0},{label:"账户余额",prop:"balance",type:"number",value:"",disabled:!0},{label:"提现金额",prop:"amount",type:"number",value:""},{label:"提款账号",prop:"account_id",type:"select",options:N},{label:"支付密码",prop:"pay_password",type:"password",value:""},{label:"谷歌验证码",prop:"google_code",type:"input",value:""}],rules:{amount:[{required:!0,message:"请输入提现金额",trigger:"blur"}],account_id:[{required:!0,message:"请选择提款账号",trigger:"change"}],pay_password:[{required:!0,message:"请输入支付密码",trigger:"blur"}],google_code:[{required:!0,message:"请输入谷歌验证码",trigger:"blur"}]},values:{name:null==(t=null==(l=W.user)?void 0:l.info)?void 0:t.name,withdraw_min:null==(r=null==(o=W.user)?void 0:o.info)?void 0:r.withdraw_min,withdraw_max:null==(n=null==(d=W.user)?void 0:d.info)?void 0:n.withdraw_max,withdraw_fee:null==(i=null==(s=W.user)?void 0:s.info)?void 0:i.withdraw_fee,balance:(null==(u=null==(p=W.user)?void 0:p.info)?void 0:u.balance)||0,amount:"",account_id:"",pay_password:"",google_code:""}},Q.showAddDialog=!0};t(()=>{Q.searchFields.forEach(e=>{"account_type"===e.prop&&(e.options=C=x()),"status"===e.prop&&(e.options=G=D())}),J()});const J=()=>{var e,a;Q.loading=!0;let l={per_page:Q.per_page,page:Q.page},t=function(e){const a={};return e.forEach(e=>{e.prop&&void 0!==e.value&&(a[e.prop]=e.value)}),a}(Q.searchFields);(null==(e=t.created_at)?void 0:e.length)>0&&(t.created_at_start=t.created_at[0]?o(t.created_at[0]):"",t.created_at_end=t.created_at[1]?o(t.created_at[1]):""),(null==(a=t.processed_at)?void 0:a.length)>0&&(t.processed_at_start=t.processed_at[0]?o(t.processed_at[0]):"",t.processed_at_end=t.processed_at[1]?o(t.processed_at[1]):""),delete t.created_at,delete t.processed_at,f(Object.assign(l,t)).then(e=>{Q.tableData=e.data,Q.total=e.total,Q.loading=!1}).catch(()=>{Q.loading=!1})};return(e,a)=>{var l,t;const o=_,h=y,f=w,F=r("click-debounce");return n(),d("div",null,[s("div",q,[a[6]||(a[6]=s("div",null,"余额",-1)),s("div",U,p((null==(t=null==(l=u(W).user)?void 0:l.info)?void 0:t.balance)||0),1)]),i(h,{type:"export",columns:u(Q).columns,searchFields:u(Q).searchFields,"onUpdate:searchFields":a[1]||(a[1]=e=>u(Q).searchFields=e),data:u(Q).tableData,per_page:u(Q).per_page,"onUpdate:per_page":a[2]||(a[2]=e=>u(Q).per_page=e),page:u(Q).page,"onUpdate:page":a[3]||(a[3]=e=>u(Q).page=e),total:u(Q).total,onGetTableData:J,onResetForm:Y,loading:u(Q).loading,showSelection:!1,showRightRefreshSlot:!1},{btns:c(()=>[s("div",null,[i(o,{size:"small",type:"primary",onClick:a[0]||(a[0]=a=>H(e.row))},{default:c(()=>a[7]||(a[7]=[m(" 申请提现 ")])),_:1,__:[7]})])]),account_type_slot:c(({row:e})=>{var a;return[s("div",null,p(X(null==(a=null==e?void 0:e.account)?void 0:a.account_type,0)),1)]}),merchant_name_slot:c(({row:e})=>{var a;return[s("div",null,p(null==(a=null==e?void 0:e.merchant)?void 0:a.name),1)]}),status:c(({row:e})=>[s("span",{class:g(["table-status-color-"+e.status])},p(X(e.status,1)),3)]),_:1},8,["columns","searchFields","data","per_page","page","total","loading"]),i(f,{showDialog:u(Q).showAddDialog,"onUpdate:showDialog":a[4]||(a[4]=e=>u(Q).showAddDialog=e),formData:u(Q).addForm,"onUpdate:formData":a[5]||(a[5]=e=>u(Q).addForm=e),ref_key:"addFormRef",ref:Z,labelWidth:"130px",dialogWidth:"600px"},{submit:c(()=>[b((n(),v(o,{type:"primary",loading:u(Q).btnLoading},{default:c(()=>a[8]||(a[8]=[m("确定")])),_:1,__:[8]},8,["loading"])),[[F,u(B)]])]),_:1},8,["showDialog","formData"])])}}};export{k as default};
|