import{R as n,S as f,T as _}from"./index.DLhCD1Qz.js";import{_ as c}from"./yb_admin_plugin.DNFUAscl.js";import{aZ as a,aL as V,s as b,bJ as m,I as l}from"./@vue.Da0bZ210.js";import"./vue.Bj6dTZYa.js";import"./@element-plus.pQhr8KT1.js";import"./echarts.Dms41JYJ.js";import"./tslib.BDyQ-Jie.js";import"./zrender.BueMfJu3.js";import"./axios.BjtuyMK1.js";import"./pinia.Tngw-S_5.js";import"./vue-router.DaVMGKLh.js";import"./element-plus.DC208N5p.js";import"./lodash-es.DVGGNlzX.js";import"./@vueuse.BhH-hw9p.js";import"./async-validator.9PlIezaS.js";import"./@popperjs.C5az9QE8.js";import"./@ctrl.C4Rzlq_k.js";import"./dayjs.BLMYetss.js";import"./memoize-one.BdPwpGay.js";import"./normalize-wheel-es.BQoi3Ox2.js";import"./@floating-ui.DCXYYTka.js";import"./vue-i18n.C7BagGww.js";import"./@intlify.TnaUIxGf.js";import"./moment.C5S46NFB.js";const g={name:"AddPackage",props:{edit:{type:Object,default:()=>({id:0})}},data(){return{form:{id:0,name:"",market_price:0,price:0,price_num:0,valid_days:1,gift_price_num:0,status:1,sort:0,desc:""},rules:{name:[{required:!0,message:"请输入套餐名称",trigger:"blur"}],market_price:[{required:!0,message:"请输入原价",trigger:"blur"}],price:[{required:!0,message:"请输入销售价",trigger:"blur"}],price_num:[{required:!0,message:"请输入套点数",trigger:"blur"}],valid_days:[{required:!0,message:"请输入有效天数",trigger:"blur"}]}}},created(){this.edit.id&&_({id:this.edit.id}).then(i=>{this.form=i.data,this.form.id=this.edit.id})},methods:{onSubmit(){this.$refs.form.validate(async i=>{if(i)(this.edit.id?n:f)(this.form).then(s=>{this.$baseMessage("保存成功"),this.callBack&&this.callBack()});else return!1})}}};function h(i,r,s,k,e,y){const d=a("el-input"),t=a("el-form-item"),p=a("el-input-number"),u=a("el-form");return V(),b(u,{ref:"form",model:e.form,rules:e.rules,"label-width":"120px"},{default:m(()=>[l(t,{label:"套餐名称",prop:"name"},{default:m(()=>[l(d,{modelValue:e.form.name,"onUpdate:modelValue":r[0]||(r[0]=o=>e.form.name=o),placeholder:"请输入套餐名称"},null,8,["modelValue"])]),_:1}),l(t,{label:"点数",prop:"price_num"},{default:m(()=>[l(p,{modelValue:e.form.price_num,"onUpdate:modelValue":r[1]||(r[1]=o=>e.form.price_num=o),min:0,precision:2,placeholder:"请输入点数"},null,8,["modelValue"])]),_:1}),l(t,{label:"原价",prop:"market_price"},{default:m(()=>[l(p,{modelValue:e.form.market_price,"onUpdate:modelValue":r[2]||(r[2]=o=>e.form.market_price=o),min:0,precision:2,placeholder:"请输入原价"},null,8,["modelValue"])]),_:1}),l(t,{label:"销售价",prop:"price"},{default:m(()=>[l(p,{modelValue:e.form.price,"onUpdate:modelValue":r[3]||(r[3]=o=>e.form.price=o),min:0,precision:2,placeholder:"请输入销售价"},null,8,["modelValue"])]),_:1}),l(t,{label:i.translateI18n("有效天数"),prop:"valid_days"},{default:m(()=>[l(d,{modelValue:e.form.valid_days,"onUpdate:modelValue":r[4]||(r[4]=o=>e.form.valid_days=o),modelModifiers:{trim:!0},placeholder:i.translateI18n("有效天数"),type:"number",autocomplete:"off",min:1},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l(t,{label:"排序",prop:"sort"},{default:m(()=>[l(p,{modelValue:e.form.sort,"onUpdate:modelValue":r[5]||(r[5]=o=>e.form.sort=o),min:0,placeholder:"请输入排序值"},null,8,["modelValue"])]),_:1}),l(t,{label:"套餐描述",prop:"desc"},{default:m(()=>[l(d,{modelValue:e.form.desc,"onUpdate:modelValue":r[6]||(r[6]=o=>e.form.desc=o),type:"textarea",rows:4,placeholder:"请输入套餐描述"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])}const G=c(g,[["render",h]]);export{G as default};
