import{C as U,D as R,F as S}from"./element-plus.8e273e86.js";import{P as B}from"./index.8afed1db.js";import{a as I,b as L,c as N}from"./store_product_price.6b2da8ae.js";import{d as b,s as y,r as T,b as j,Z as F,o as p,c,U as a,L as r,u as t,T as A,a9 as O,a as V,S as Z}from"./@vue.76ce7aa3.js";import"./lodash.41b9567d.js";const q={class:"edit-popup"},z={style:{display:"inline-block","margin-right":"6px"}},G={style:{display:"inline-block"}},H=b({name:"storeProductPriceEdit"}),Y=b({...H,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(J,{expose:E,emit:v}){const m=v,f=y(),d=y(),i=T("add"),C=j(()=>i.value=="edit"?"\u7F16\u8F91\u5546\u54C1\u4EF7\u683C\u66F4\u6539":"\u65B0\u589E\u5546\u54C1\u4EF7\u683C\u66F4\u6539"),o=F({id:"",store_name:"",purchase:"",cost:"",price:"",price_config:[]}),P=F({}),_=async s=>{for(const e in o)s[e]!=null&&s[e]!=null&&(o[e]=s[e])},g=async s=>{const e=await I({id:s.id});_(e)},w=async()=>{var e,u;await((e=f.value)==null?void 0:e.validate());const s={...o};i.value=="edit"?await L(s):await N(s),(u=d.value)==null||u.close(),m("success")},x=(s="add")=>{var e;i.value=s,(e=d.value)==null||e.open()},D=()=>{m("close")};return E({open:x,setFormData:_,getDetail:g}),(s,e)=>{const u=U,n=R,h=S;return p(),c("div",q,[a(B,{ref_key:"popupRef",ref:d,title:t(C),async:!0,width:"550px",onConfirm:w,onClose:D},{default:r(()=>[a(h,{ref_key:"formRef",ref:f,model:t(o),"label-width":"90px",rules:t(P)},{default:r(()=>[a(n,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:r(()=>[a(u,{modelValue:t(o).store_name,"onUpdate:modelValue":e[0]||(e[0]=l=>t(o).store_name=l),clearable:"",readonly:!1,disabled:""},null,8,["modelValue"])]),_:1}),a(n,{label:"\u4F9B\u8D27\u4EF7",prop:"purchase"},{default:r(()=>[a(u,{modelValue:t(o).purchase,"onUpdate:modelValue":e[1]||(e[1]=l=>t(o).purchase=l),clearable:"",readonly:!1},null,8,["modelValue"])]),_:1}),a(n,{label:"\u5546\u6237\u4EF7",prop:"cost"},{default:r(()=>[a(u,{modelValue:t(o).cost,"onUpdate:modelValue":e[2]||(e[2]=l=>t(o).cost=l),clearable:"",readonly:!1},null,8,["modelValue"])]),_:1}),a(n,{label:"\u96F6\u552E\u4EF7",prop:"price"},{default:r(()=>[a(u,{modelValue:t(o).price,"onUpdate:modelValue":e[3]||(e[3]=l=>t(o).price=l),clearable:"",readonly:!1},null,8,["modelValue"])]),_:1}),a(n,{label:"\u5206\u7EC4\u4EF7\u683C",prop:"price_config"},{default:r(()=>[(p(!0),c(A,null,O(t(o).price_config,l=>(p(),c("div",{class:"m-1 flex",key:l.id},[V("div",z,Z(l.group_name)+":",1),V("div",G,[a(u,{modelValue:l.price,"onUpdate:modelValue":k=>l.price=k,style:{width:"80px"}},null,8,["modelValue","onUpdate:modelValue"])])]))),128))]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{Y as _};
