import{C as h,I as B,J as q,B as I,D}from"./element-plus-z3MwpXC9.js";import{P as F}from"./index-CdmO5-Ss.js";import{f as v}from"./index-DXEGVToZ.js";import{d as S,s as w,Z as j,b as M,w as V,o as P,L as T,M as r,a as U,V as a,u as n,S as u,T as y}from"./@vue-TMcuEboY.js";const G={class:"pr-8"},A=S({__name:"account-adjust",props:{show:{type:Boolean,required:!0},value:{type:[Number,String],required:!0}},emits:["update:show","confirm"],setup(d,{emit:k}){const s=w(),i=d,f=k,o=j({action:1,num:"",remark:""}),m=w(),c=M(()=>Number(i.value)+Number(o.num)*(o.action==1?1:-1)),R={num:[{required:!0,message:"请输入调整的金额"}]},x=e=>{if(e.includes("-"))return v.msgError("请输入正整数");o.num=e},C=async()=>{var e;await((e=s.value)==null?void 0:e.validate()),f("confirm",o)},E=()=>{var e;f("update:show",!1),(e=s.value)==null||e.resetFields()};return V(()=>i.show,e=>{var t,l;e?(t=m.value)==null||t.open():(l=m.value)==null||l.close()}),V(c,e=>{e<0&&(v.msgError("调整后余额需大于0"),o.num="")}),(e,t)=>{const l=h,_=B,g=q,b=I,N=D;return P(),T(F,{ref_key:"popupRef",ref:m,title:"余额调整",width:"500px",onConfirm:C,async:!0,onClose:E},{default:r(()=>[U("div",G,[a(N,{ref_key:"formRef",ref:s,model:n(o),"label-width":"120px",rules:R},{default:r(()=>[a(l,{label:"当前余额"},{default:r(()=>[u("¥ "+y(d.value),1)]),_:1}),a(l,{label:"余额增减",required:"",prop:"action"},{default:r(()=>[a(g,{modelValue:n(o).action,"onUpdate:modelValue":t[0]||(t[0]=p=>n(o).action=p)},{default:r(()=>[a(_,{value:1},{default:r(()=>t[2]||(t[2]=[u("增加余额")])),_:1}),a(_,{value:2},{default:r(()=>t[3]||(t[3]=[u("扣减余额")])),_:1})]),_:1},8,["modelValue"])]),_:1}),a(l,{label:"调整余额",prop:"num"},{default:r(()=>[a(b,{"model-value":n(o).num,placeholder:"请输入调整的金额",type:"number",onInput:x},null,8,["model-value"])]),_:1}),a(l,{label:"调整后余额"},{default:r(()=>[u(" ¥ "+y(n(c)),1)]),_:1}),a(l,{label:"备注",prop:"remark"},{default:r(()=>[a(b,{modelValue:n(o).remark,"onUpdate:modelValue":t[1]||(t[1]=p=>n(o).remark=p),type:"textarea",rows:4},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])])]),_:1},512)}}});export{A as _};
