import{d as I,h as J,r as m,e as j,J as D,o as y,q as V,w as u,f as l,a as t,m as p,v as N,N as b,U as R,z as S,bb as A,ag as E,ah as G,C as K,B as L,H as M,__tla as O}from"./index-2eab2d23.js";import{_ as Q,__tla as W}from"./Dialog-c2716df6.js";import{g as X,a as Y,__tla as Z}from"./index-6a949eb2.js";import{u as $,__tla as ee}from"./useMessage-171aa63e.js";import"./_plugin-vue_export-helper-1b428a4d.js";let P,ae=Promise.all([(()=>{try{return O}catch{}})(),(()=>{try{return W}catch{}})(),(()=>{try{return Z}catch{}})(),(()=>{try{return ee}catch{}})()]).then(async()=>{P=I({name:"UpdatePointForm",__name:"UserPointUpdateForm",emits:["success"],setup(le,{expose:w,emit:U}){const{t:x}=J(),_=$(),n=m(!1),d=m(!1),e=m({id:void 0,nickname:void 0,point:0,changePoint:0,changeType:1}),k=j({changePoint:[{required:!0,message:"\u53D8\u52A8\u79EF\u5206\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),r=m();w({open:async s=>{if(n.value=!0,F(),s){d.value=!0;try{e.value=await X(s),e.value.changeType=1,e.value.changePoint=0}finally{d.value=!1}}}});const T=U,C=async()=>{if(r&&await r.value.validate())if(e.value.changePoint<1)_.error("\u53D8\u52A8\u79EF\u5206\u4E0D\u80FD\u5C0F\u4E8E 1");else if(c.value<0)_.error("\u53D8\u52A8\u540E\u7684\u79EF\u5206\u4E0D\u80FD\u5C0F\u4E8E 0");else{d.value=!0;try{await Y({id:e.value.id,point:e.value.changePoint*e.value.changeType}),_.success(x("common.updateSuccess")),n.value=!1,T("success")}finally{d.value=!1}}},F=()=>{var s;e.value={id:void 0,nickname:void 0,levelId:void 0,reason:void 0},(s=r.value)==null||s.resetFields()},c=D(()=>e.value.point+e.value.changePoint*e.value.changeType);return(s,a)=>{const f=R,i=S,v=A,h=E,q=G,z=K,g=L,B=Q,H=M;return y(),V(B,{title:"\u4FEE\u6539\u7528\u6237\u79EF\u5206",modelValue:t(n),"onUpdate:modelValue":a[7]||(a[7]=o=>b(n)?n.value=o:null),width:"600"},{footer:u(()=>[l(g,{onClick:C,type:"primary",disabled:t(d)},{default:u(()=>[p("\u786E \u5B9A")]),_:1},8,["disabled"]),l(g,{onClick:a[6]||(a[6]=o=>n.value=!1)},{default:u(()=>[p("\u53D6 \u6D88")]),_:1})]),default:u(()=>[N((y(),V(z,{ref_key:"formRef",ref:r,model:t(e),rules:t(k),"label-width":"100px"},{default:u(()=>[l(i,{label:"\u7528\u6237\u7F16\u53F7",prop:"id"},{default:u(()=>[l(f,{modelValue:t(e).id,"onUpdate:modelValue":a[0]||(a[0]=o=>t(e).id=o),class:"!w-240px",disabled:""},null,8,["modelValue"])]),_:1}),l(i,{label:"\u7528\u6237\u6635\u79F0",prop:"nickname"},{default:u(()=>[l(f,{modelValue:t(e).nickname,"onUpdate:modelValue":a[1]||(a[1]=o=>t(e).nickname=o),class:"!w-240px",disabled:""},null,8,["modelValue"])]),_:1}),l(i,{label:"\u53D8\u52A8\u524D\u79EF\u5206",prop:"point"},{default:u(()=>[l(v,{modelValue:t(e).point,"onUpdate:modelValue":a[2]||(a[2]=o=>t(e).point=o),class:"!w-240px",disabled:""},null,8,["modelValue"])]),_:1}),l(i,{label:"\u53D8\u52A8\u7C7B\u578B",prop:"changeType"},{default:u(()=>[l(q,{modelValue:t(e).changeType,"onUpdate:modelValue":a[3]||(a[3]=o=>t(e).changeType=o)},{default:u(()=>[l(h,{label:1},{default:u(()=>[p("\u589E\u52A0")]),_:1}),l(h,{label:-1},{default:u(()=>[p("\u51CF\u5C11")]),_:1})]),_:1},8,["modelValue"])]),_:1}),l(i,{label:"\u53D8\u52A8\u79EF\u5206",prop:"changePoint"},{default:u(()=>[l(v,{modelValue:t(e).changePoint,"onUpdate:modelValue":a[4]||(a[4]=o=>t(e).changePoint=o),class:"!w-240px",min:0,precision:0},null,8,["modelValue"])]),_:1}),l(i,{label:"\u53D8\u52A8\u540E\u79EF\u5206"},{default:u(()=>[l(v,{modelValue:t(c),"onUpdate:modelValue":a[5]||(a[5]=o=>b(c)?c.value=o:null),class:"!w-240px",disabled:""},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[H,t(d)]])]),_:1},8,["modelValue"])}}})});export{ae as __tla,P as default};