import{a6 as P,C as k,D as R,t as S,F as L}from"./element-plus.a63a26dd.js";import{_ as A}from"./picker.b3a6671e.js";import{P as I}from"./index.da3823b2.js";import{b as j,c as N,d as O}from"./store_branch_product.9586a3e4.js";import{a as T}from"./store_product_unit.b4bcebf8.js";import"./lodash.2473fc51.js";import{d as C,s as f,r as F,b as Z,Z as g,o as z,c as G,U as a,L as l,u as t}from"./@vue.18505fe0.js";const H={class:"edit-popup"},J=C({name:"storeBranchProductEdit"}),te=C({...J,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(K,{expose:B,emit:E}){const d=E,p=f(),n=f(),m=F("add"),b=Z(()=>m.value=="edit"?"\u7F16\u8F91\u95E8\u5E97\u5546\u54C1":"\u65B0\u589E\u95E8\u5E97\u5546\u54C1"),u=g({id:"",store_name:"",image:"",price:"",unit:"",status:""}),v=g({cate_id:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u5206\u7C7B",trigger:"blur"}],store_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u95E8\u5E97\u540D\u79F0",trigger:"blur"}],image:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u56FE\u7247",trigger:"blur"}],price:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u4EF7\u683C",trigger:"blur"}],cost:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u6210\u672C",trigger:"blur"}],bar_code:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u6761\u7801",trigger:"blur"}],unit:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u5355\u4F4D",trigger:"blur"}],status:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u72B6\u6001",trigger:"blur"}]}),c=F([]);(()=>{T({}).then(o=>{c.value=o.lists})})();const _=async o=>{for(const e in u)o[e]!=null&&o[e]!=null&&(u[e]=o[e])},V=async o=>{const e=await j({id:o.id});_(e)},D=async()=>{var e,s;await((e=p.value)==null?void 0:e.validate());const o={...u};m.value=="edit"?await N(o):await O(o),(s=n.value)==null||s.close(),d("success")},w=(o="add")=>{var e;m.value=o,(e=n.value)==null||e.open()},U=()=>{d("close")};return B({open:w,setFormData:_,getDetail:V}),(o,e)=>{const s=k,i=R,h=A,x=P,q=S,y=L;return z(),G("div",H,[a(I,{ref_key:"popupRef",ref:n,title:t(b),async:!0,width:"550px",onConfirm:D,onClose:U},{default:l(()=>[a(y,{ref_key:"formRef",ref:p,model:t(u),"label-width":"90px",rules:t(v)},{default:l(()=>[a(i,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:l(()=>[a(s,{modelValue:t(u).store_name,"onUpdate:modelValue":e[0]||(e[0]=r=>t(u).store_name=r),placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0"},null,8,["modelValue"])]),_:1}),a(i,{label:"\u5546\u54C1\u56FE\u7247",prop:"image"},{default:l(()=>[a(h,{modelValue:t(u).image,"onUpdate:modelValue":e[1]||(e[1]=r=>t(u).image=r),limit:1},null,8,["modelValue"])]),_:1}),a(i,{label:"\u5546\u54C1\u4EF7\u683C",prop:"price"},{default:l(()=>[a(s,{modelValue:t(u).price,"onUpdate:modelValue":e[2]||(e[2]=r=>t(u).price=r),placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u4EF7\u683C"},null,8,["modelValue"])]),_:1}),a(i,{label:"\u5546\u54C1\u5355\u4F4D",prop:"unit"},{default:l(()=>[a(x,{class:"w-[500px]",modelValue:t(u).unit,"onUpdate:modelValue":e[3]||(e[3]=r=>t(u).unit=r),options:t(c),props:{value:"id",label:"name",emitPath:!1},placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u5355\u4F4D"},null,8,["modelValue","options"])]),_:1}),a(i,{label:"\u5546\u54C1\u72B6\u6001"},{default:l(()=>[a(q,{modelValue:t(u).status,"onUpdate:modelValue":e[4]||(e[4]=r=>t(u).status=r),"active-value":1,"inactive-value":0,"active-text":"\u4E0A\u67B6","inactive-text":"\u4E0B\u67B6","inline-prompt":""},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{te as _};
