import{u as k}from"./useInstance.233fbdde.js";import{d as q,a6 as x,r as c,b as F,p as U,c as p,e as w,k as y,i as r,h as t,u as o,a2 as N,q as R,m as D,E as P,bW as S,bX as $,bY as L,bZ as M,b_ as T,b$ as W}from"./index.0308b213.js";const X=D("\u63D0\u4EA4"),Y=D("\u53D6\u6D88"),z=q({props:{modelValue:{type:Boolean,default:!1},id:{default:0}},emits:["update:modelValue","onClose"],setup(E,{emit:g}){const s=E,{OpPlatform:m}=x(),{global:V}=k();let d=c(!1),_=c("");const f=c(),e=F({id:"",username:"",mobile:"",address:"",note:""}),B=F({username:[{required:!0,message:"\u6536\u8D27\u4EBA\u59D3\u540D\u4E0D\u80FD\u4E3A\u7A7A",trigger:"change"}],address:[{required:!0,message:"\u6536\u8D27\u4EBA\u5730\u5740\u4E0D\u80FD\u4E3A\u7A7A",trigger:"change"}],mobile:[{required:!0,message:"\u624B\u673A\u53F7\u4E0D\u80FD\u4E3A\u7A7A",trigger:"change"}]}),C=()=>m.value==="agent"?M(s.id):m.value==="store"?T(s.id):W(s.id),v=()=>{C().then(l=>{e.username=l.order.username,e.mobile=l.order.mobile,e.address=l.order.address,e.note=l.order.note,_.value=l.order.serial_sn})};U(()=>s.modelValue,l=>{console.log(l,s.id),l&&s.id&&(d.value=!0,v())});const I=()=>m.value==="agent"?S(e):m.value==="store"?$(e):L(e),O=()=>{var l;(l=f.value)==null||l.validate(u=>{console.log(u),u&&(e.id=s.id,I().then(n=>{P.success("\u66F4\u65B0\u6210\u529F"),A()}))})},A=()=>{g("update:modelValue",!1),g("onClose"),V.$resetForm(f.value,e)};return(l,u)=>{const n=p("el-input"),i=p("el-form-item"),b=p("el-button"),h=p("el-dialog");return w(),y(h,{modelValue:o(d),"onUpdate:modelValue":u[4]||(u[4]=a=>R(d)?d.value=a:d=a),title:`\u7F16\u8F91\u8BA2\u5355 ${o(_)}`,width:"50%",onClose:A},{default:r(()=>[t(o(N),{ref_key:"editFormRef",ref:f,model:o(e),rules:o(B),"label-width":"120px"},{default:r(()=>[t(i,{label:"\u6536\u8D27\u4EBA\u59D3\u540D",prop:"username"},{default:r(()=>[t(n,{modelValue:o(e).username,"onUpdate:modelValue":u[0]||(u[0]=a=>o(e).username=a),placeholder:"\u8BF7\u8F93\u5165\u6536\u8D27\u4EBA\u59D3\u540D"},null,8,["modelValue"])]),_:1}),t(i,{label:"\u6536\u8D27\u4EBA\u5730\u5740",prop:"address"},{default:r(()=>[t(n,{modelValue:o(e).address,"onUpdate:modelValue":u[1]||(u[1]=a=>o(e).address=a),placeholder:"\u8BF7\u8F93\u5165\u6536\u8D27\u4EBA\u5730\u5740"},null,8,["modelValue"])]),_:1}),t(i,{label:"\u624B\u673A\u53F7",prop:"mobile"},{default:r(()=>[t(n,{modelValue:o(e).mobile,"onUpdate:modelValue":u[2]||(u[2]=a=>o(e).mobile=a),placeholder:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7"},null,8,["modelValue"])]),_:1}),t(i,{label:"\u8BA2\u5355\u5907\u6CE8",prop:"note"},{default:r(()=>[t(n,{modelValue:o(e).note,"onUpdate:modelValue":u[3]||(u[3]=a=>o(e).note=a),placeholder:"\u8BF7\u8F93\u5165\u8BA2\u5355\u5907\u6CE8",type:"textarea",rows:5},null,8,["modelValue"])]),_:1}),t(i,null,{default:r(()=>[t(b,{type:"primary",onClick:O},{default:r(()=>[X]),_:1}),t(b,{onClick:A},{default:r(()=>[Y]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])}}});export{z as _};
