import{a1 as b,a2 as g}from"./index.DLhCD1Qz.js";import{_ as h}from"./yb_admin_plugin.DNFUAscl.js";import{aZ as a,aL as i,s as d,bJ as m,I as o,u as V,F as k,aX as y,H as v,v as u,bb as x}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 Y={title:"添加兑换码",name:"add",data(){return{meal_list:[],form:{meal_id:"",start_time:"",end_time:"",exchange_count:1,remarks:""},rules:{meal_id:[{required:!0,message:"请选择套餐",trigger:"blur"}],start_time:[{required:!0,message:"开始时间不能为空",trigger:"blur"}],end_time:[{required:!0,message:"结束时间不能为空",trigger:"blur"}]}}},created(){g().then(r=>{this.meal_list=r.data,this.meal_list.length>0&&(this.form.meal_id=this.meal_list[0].id)})},mounted(){},methods:{onSubmit(){this.$refs.form.validate(async r=>{if(r)b(this.form).then(e=>{this.$baseMessage("保存成功"),this.callBack&&this.callBack()});else return!1})}}},B={style:{display:"flex"}},I={class:"to"};function M(r,e,w,D,t,H){const _=a("el-option"),f=a("el-select"),s=a("el-form-item"),n=a("el-input"),p=a("el-date-picker"),c=a("el-form");return i(),d(c,{ref:"form",model:t.form,rules:t.rules,"label-width":"110px"},{default:m(()=>[o(s,{label:"套餐",prop:"meal_id"},{default:m(()=>[o(f,{modelValue:t.form.meal_id,"onUpdate:modelValue":e[0]||(e[0]=l=>t.form.meal_id=l),placeholder:"请选择"},{default:m(()=>[(i(!0),V(k,null,y(t.meal_list,l=>(i(),d(_,{key:l.id,label:l.name,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),o(s,{label:"生成数量",prop:"exchange_count"},{default:m(()=>[o(n,{modelValue:t.form.exchange_count,"onUpdate:modelValue":e[1]||(e[1]=l=>t.form.exchange_count=l),"controls-position":"right",min:1,type:"number",style:{width:"120px"}},null,8,["modelValue"]),e[5]||(e[5]=v(" 个 ",-1))]),_:1}),u("div",B,[o(s,{label:r.translateI18n("有效期"),prop:"start_time"},{default:m(()=>[o(p,{modelValue:t.form.start_time,"onUpdate:modelValue":e[2]||(e[2]=l=>t.form.start_time=l),type:"datetime",placeholder:r.translateI18n("选择开始时间"),"value-format":"YYYY-MM-DD HH:mm:ss"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),u("span",I,x(r.translateI18n("至")),1),o(s,{"label-width":"0",prop:"end_time"},{default:m(()=>[o(p,{modelValue:t.form.end_time,"onUpdate:modelValue":e[3]||(e[3]=l=>t.form.end_time=l),type:"datetime",placeholder:r.translateI18n("选择结束时间"),"value-format":"YYYY-MM-DD HH:mm:ss"},null,8,["modelValue","placeholder"])]),_:1})]),o(s,{label:"备注",prop:"notice"},{default:m(()=>[o(n,{modelValue:t.form.remarks,"onUpdate:modelValue":e[4]||(e[4]=l=>t.form.remarks=l),type:"textarea",rows:3},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])}const te=h(Y,[["render",M],["__scopeId","data-v-e6b73849"]]);export{te as default};
