import{d as e,a,r as l,w as i,y as r,f as o,z as t,p as d,u as s,l as n}from"./index-ip5gDR6L.js";/* empty css               *//* empty css                *//* empty css                  *//* empty css              *//* empty css                     *//* empty css            *//* empty css               *//* empty css                  *//* empty css               *//* empty css               */import{E as m,a as p}from"./index-CxGOZAw2.js";import{E as u}from"./index-HtXsSizM.js";import{E as v,a as c}from"./index-Br3btmwp.js";import{E as f}from"./index-DfrOVkw6.js";import{E as b}from"./index-opP5No9I.js";import{E as k}from"./index-BpP4itD-.js";const _=e({__name:"add-points-dialog",props:{visible:{type:Boolean}},emits:["update:visible","submit"],setup(e,{emit:_}){const j=e,y=_,h=a(),g=a(!1),x=l({points:null,kind:"admin_add",remark:""});i(()=>j.visible,e=>{});const V={points:[{required:!0,message:"请输入积分数量",trigger:"blur"}],kind:[{required:!0,message:"请选择积分类型",trigger:"change"}]},w=()=>{return e=this,a=null,l=function*(){var e;try{yield null==(e=h.value)?void 0:e.validate(),g.value=!0,y("submit",{points:x.points,kind:x.kind,remark:x.remark})}catch(a){}finally{g.value=!1}},new Promise((i,r)=>{var o=e=>{try{d(l.next(e))}catch(a){r(a)}},t=e=>{try{d(l.throw(e))}catch(a){r(a)}},d=e=>e.done?i(e.value):Promise.resolve(e.value).then(o,t);d((l=l.apply(e,a)).next())});var e,a,l},E=()=>{y("update:visible",!1)},U=()=>{var e;x.points=null,x.kind="admin_add",x.remark="",null==(e=h.value)||e.clearValidate()};return(a,l)=>(o(),r(s(k),{"model-value":e.visible,title:"增加积分",width:"400px","close-on-click-modal":!1,"onUpdate:modelValue":l[3]||(l[3]=e=>y("update:visible",e)),onClosed:U},{footer:t(()=>[d(s(b),{onClick:E},{default:t(()=>[...l[4]||(l[4]=[n("取消",-1)])]),_:1}),d(s(b),{type:"primary",loading:g.value,onClick:w},{default:t(()=>[...l[5]||(l[5]=[n(" 确定 ",-1)])]),_:1},8,["loading"])]),default:t(()=>[d(s(m),{ref_key:"formRef",ref:h,model:x,rules:V,"label-width":"80px"},{default:t(()=>[d(s(p),{label:"积分数量",prop:"points"},{default:t(()=>[d(s(u),{modelValue:x.points,"onUpdate:modelValue":l[0]||(l[0]=e=>x.points=e),placeholder:"请输入积分数量",min:1,precision:0,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),d(s(p),{label:"积分类型",prop:"kind"},{default:t(()=>[d(s(v),{modelValue:x.kind,"onUpdate:modelValue":l[1]||(l[1]=e=>x.kind=e),placeholder:"请选择积分类型",style:{width:"100%"}},{default:t(()=>[d(s(c),{label:"管理员增加",value:"admin_add"}),d(s(c),{label:"活动奖励",value:"activity_reward"}),d(s(c),{label:"签到奖励",value:"sign_reward"}),d(s(c),{label:"消费返还",value:"consume_return"})]),_:1},8,["modelValue"])]),_:1}),d(s(p),{label:"备注",prop:"remark"},{default:t(()=>[d(s(f),{modelValue:x.remark,"onUpdate:modelValue":l[2]||(l[2]=e=>x.remark=e),type:"textarea",placeholder:"请输入备注",rows:3},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["model-value"]))}});export{_};
