import{u as P}from"./useInstance.233fbdde.js";import{g as R,a as j,e as G,b as I,c as M,d as O}from"./index.78db0dd0.js";import{s as S,m as T}from"./category.da132df4.js";import{d as $,a6 as q,s as z,r as v,b as g,p as H,c as d,e as y,k as B,i as u,h as o,u as a,f as J,j as K,F as Q,a2 as W,m as r,E as m}from"./index.0308b213.js";const X=r("\u5F00\u542F"),Y=r("\u5173\u95ED"),Z=r("\u63D0\u4EA4"),ee=r("\u53D6\u6D88"),ue=$({props:{modelValue:{type:Boolean,default:!1},id:null},emits:["update:modelValue","onClose"],setup(w,{emit:V}){const i=w,{OpPlatform:c}=q(),{global:A}=P();let C=z(()=>Number(i.id)>0);const f=v(!1),h=v(),e=g({id:"",category_id:"",title:"",deadline_by_month:"",discount:"",old_price:"",price:"",can_bind_person_num:"",show_min_person:"",show_max_person:"",save_money:"",status:1}),b=g({list:[]});(()=>{c.value=="shangpu"?S().then(l=>{b.list=l}):T().then(l=>{b.list=l})})();const x=()=>{c.value=="shangpu"?e.id>0?G(e).then(l=>{m({message:"\u7F16\u8F91\u6210\u529F",type:"success"}),_()}):I(e).then(l=>{m({message:"\u65B0\u589E\u6210\u529F",type:"success"}),_()}):e.id>0?M(e).then(l=>{m({message:"\u7F16\u8F91\u6210\u529F",type:"success"}),_()}):O(e).then(l=>{m({message:"\u65B0\u589E\u6210\u529F",type:"success"}),_()})};H(()=>i.modelValue,l=>{f.value=l,l&&i.id&&(e.id=i.id,D())}),g({list:[]});const D=()=>{c.value=="shangpu"?R({id:i.id}).then(l=>{l=l.data,e.id=l.id,e.category_id=l.category_id,e.title=l.title,e.deadline_by_month=l.deadline_by_month,e.discount=l.discount,e.old_price=l.old_price,e.price=l.price,e.can_bind_person_num=l.can_bind_person_num,e.show_min_person=l.show_min_person,e.show_max_person=l.show_max_person,e.save_money=l.save_money,e.status=l.status}):j({id:i.id}).then(l=>{l=l.data,e.id=l.id,e.category_id=l.category_id,e.title=l.title,e.deadline_by_month=l.deadline_by_month,e.discount=l.discount,e.old_price=l.old_price,e.price=l.price,e.can_bind_person_num=l.can_bind_person_num,e.show_min_person=l.show_min_person,e.show_max_person=l.show_max_person,e.save_money=l.save_money,e.status=l.status})},_=()=>{V("update:modelValue",!1),V("onClose"),A.$resetForm(h.value,e)};return(l,n)=>{const U=d("el-option"),k=d("el-select"),s=d("el-form-item"),p=d("el-input"),F=d("el-radio"),L=d("el-radio-group"),E=d("el-button"),N=d("el-dialog");return y(),B(N,{modelValue:f.value,"onUpdate:modelValue":n[8]||(n[8]=t=>f.value=t),title:a(C)?"\u67E5\u770B":"\u65B0\u589E",width:"70%","destroy-on-close":"",onClose:_},{default:u(()=>[o(a(W),{ref_key:"formRef",ref:h,model:a(e),"inline-message":!0,"label-width":"160px"},{default:u(()=>[o(s,{label:"\u7C7B\u578B",prop:"category_id"},{default:u(()=>[o(k,{modelValue:a(e).category_id,"onUpdate:modelValue":n[0]||(n[0]=t=>a(e).category_id=t),placeholder:"\u8BF7\u9009\u62E9",clearable:"",filterable:""},{default:u(()=>[(y(!0),J(Q,null,K(a(b).list,t=>(y(),B(U,{key:t.id,label:t.title,value:t.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),o(s,{label:"\u6807\u9898",prop:"title"},{default:u(()=>[o(p,{modelValue:a(e).title,"onUpdate:modelValue":n[1]||(n[1]=t=>a(e).title=t)},null,8,["modelValue"])]),_:1}),o(s,{label:"\u6709\u6548\u671F(\u6708)",prop:"deadline_by_month"},{default:u(()=>[o(p,{modelValue:a(e).deadline_by_month,"onUpdate:modelValue":n[2]||(n[2]=t=>a(e).deadline_by_month=t)},null,8,["modelValue"])]),_:1}),o(s,{label:"\u539F\u4EF7",prop:"old_price"},{default:u(()=>[o(p,{modelValue:a(e).old_price,"onUpdate:modelValue":n[3]||(n[3]=t=>a(e).old_price=t)},null,8,["modelValue"])]),_:1}),o(s,{label:"\u552E\u4EF7",prop:"price"},{default:u(()=>[o(p,{modelValue:a(e).price,"onUpdate:modelValue":n[4]||(n[4]=t=>a(e).price=t)},null,8,["modelValue"])]),_:1}),o(s,{label:"\u53EF\u7ED1\u5B9A\u4EBA\u6570",prop:"can_bind_person_num"},{default:u(()=>[o(p,{modelValue:a(e).can_bind_person_num,"onUpdate:modelValue":n[5]||(n[5]=t=>a(e).can_bind_person_num=t)},null,8,["modelValue"])]),_:1}),o(s,{label:"\u9884\u8BA1\u53EF\u7701",prop:"save_money"},{default:u(()=>[o(p,{modelValue:a(e).save_money,"onUpdate:modelValue":n[6]||(n[6]=t=>a(e).save_money=t)},null,8,["modelValue"])]),_:1}),o(s,{label:"\u72B6\u6001",prop:"status"},{default:u(()=>[o(L,{modelValue:a(e).status,"onUpdate:modelValue":n[7]||(n[7]=t=>a(e).status=t)},{default:u(()=>[o(F,{label:1},{default:u(()=>[X]),_:1}),o(F,{label:0},{default:u(()=>[Y]),_:1})]),_:1},8,["modelValue"])]),_:1}),o(s,null,{default:u(()=>[o(E,{type:"primary",onClick:x},{default:u(()=>[Z]),_:1}),o(E,{onClick:_},{default:u(()=>[ee]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{ue as _};
