import{$,w as q,Q as j,R as M,C as Q,I as T,F as z}from"./element-plus.9cae3cb1.js";import{f as d,b as G}from"./index.60ed7c6d.js";import{P as H}from"./index.3b15f80f.js";import{e as J,f as K}from"./shop_orders.5b749b15.js";import{d as W}from"./shop_express.c81d0a6d.js";import{d as X,s as V,w as Y,_ as Z,r as F,o as r,c as p,V as i,M as n,u,U as m,aa as g,L as c,S as ee}from"./@vue.96c135a1.js";const oe={class:"logistic-popup"},ie=X({__name:"logistic",props:{dictData:{type:Object,default:()=>({})},show:{type:Boolean,required:!0},id:{type:[Number,String],required:!0}},emits:["update:show"],setup(b,{emit:k}){const B=V(),_=V(),E=b;Y(()=>E.show,e=>{var s,t;e?(D(),C(E),(s=_.value)==null||s.open()):(t=_.value)==null||t.close()});const C=async e=>{const s=await J({id:e.id});L(s)},x=()=>{l.orderlogistic.push({id:0,shop_goods_id:null,express_id:null,logistic_number:null,logistic_status:null})},U=async(e,s)=>{(s.id>0||s.logistic_number)&&await d.confirm("\u786E\u5B9A\u5220\u9664\u8BE5\u6570\u636E\u5417\uFF1F"),l.orderlogistic.splice(e,1)},v=k,l=Z({id:"",sn:"",goods:F([]),orderlogistic:F([])}),w=F([]),D=async()=>{const e=await W({status:1,page:1,limit:1e3});w.value=e},L=async e=>{(e.orderlogistic.length==0||!e.orderlogistic)&&(e.orderlogistic=[{id:0,shop_goods_id:null,express_id:null,logistic_number:null,logistic_status:null}]);for(const s in l)e[s]!=null&&e[s]!=null&&(l[s]=e[s])},R=async()=>{var s;for(const t of l.orderlogistic){if(t.shop_goods_id==null||t.shop_goods_id==null){d.alertError("\u8BF7\u9009\u62E9\u5546\u54C1");return}if(t.express_id==null||t.express_id==null){d.alertError("\u8BF7\u9009\u62E9\u5FEB\u9012\u7C7B\u578B");return}if(t.logistic_number==null||t.logistic_number==null){d.alertError("\u8BF7\u8F93\u5165\u5FEB\u9012\u5355\u53F7");return}if(t.logistic_status==null||t.logistic_status==null){d.alertError("\u8BF7\u9009\u62E9\u7269\u6D41\u72B6\u6001");return}}const e={logistic_data:l.orderlogistic,id:l.id};await K(e),(s=_.value)==null||s.close(),v("success")},S=()=>{var e;v("update:show",!1),(e=B.value)==null||e.resetFields()};return(e,s)=>{const t=G,y=q,f=j,h=M,O=Q,A=$,I=T,N=z;return r(),p("div",oe,[i(H,{ref_key:"popupRef",ref:_,async:!0,width:"70%",title:"\u8BA2\u5355\u7F16\u53F7:"+u(l).sn,onConfirm:R,onClose:S},{default:n(()=>[i(N,{ref_key:"formRef",ref:B,model:u(l),"label-width":"90px"},{default:n(()=>[i(I,{class:"mt-4 !border-none",header:"\u586B\u5199\u7269\u6D41\u4FE1\u606F",shadow:"never"},{default:n(()=>[(r(!0),p(m,null,g(u(l).orderlogistic,(P,a)=>(r(),c(A,{key:a,style:{"margin-bottom":"8px"}},{default:n(()=>[a===0?(r(),c(y,{key:0,type:"success",plain:"",circle:"",onClick:x},{icon:n(()=>[i(t,{name:"el-icon-Plus"})]),_:1})):(r(),c(y,{key:1,type:"danger",plain:"",circle:"",onClick:o=>U(a,P)},{icon:n(()=>[i(t,{name:"el-icon-minus"})]),_:2},1032,["onClick"])),ee(" \u2003 \u2003 "),i(h,{class:"w-[380px]",modelValue:u(l).orderlogistic[a].shop_goods_id,"onUpdate:modelValue":o=>u(l).orderlogistic[a].shop_goods_id=o,clearable:"",placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1"},{default:n(()=>[(r(!0),p(m,null,g(u(l).goods,o=>(r(),c(f,{key:o.shop_goods_id,label:o.goods_name,value:o.shop_goods_id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"]),i(h,{class:"w-[150px]",modelValue:u(l).orderlogistic[a].express_id,"onUpdate:modelValue":o=>u(l).orderlogistic[a].express_id=o,clearable:"",filterable:"",placeholder:"\u8BF7\u9009\u62E9\u5FEB\u9012\u7C7B\u578B"},{default:n(()=>[(r(!0),p(m,null,g(u(w),o=>(r(),c(f,{key:o.id,label:o.name,value:o.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"]),i(O,{class:"w-[350px]",modelValue:u(l).orderlogistic[a].logistic_number,"onUpdate:modelValue":o=>u(l).orderlogistic[a].logistic_number=o,clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5FEB\u9012\u5355\u53F7"},null,8,["modelValue","onUpdate:modelValue"]),i(h,{class:"w-[150px]",modelValue:u(l).orderlogistic[a].logistic_status,"onUpdate:modelValue":o=>u(l).orderlogistic[a].logistic_status=o,clearable:"",placeholder:"\u8BF7\u9009\u62E9\u7269\u6D41\u72B6\u6001"},{default:n(()=>[(r(!0),p(m,null,g(b.dictData.logistic_status,o=>(r(),c(f,{key:o.value,label:o.name,value:parseInt(o.value)},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024))),128))]),_:1})]),_:1},8,["model"])]),_:1},8,["title"])])}}});export{ie as _};
