import{_ as ue,d as se,m as v,aH as G,V as ie,Q as re,a2 as F,r as U,ao as de,B as M,h as e,o as c,c as z,f as l,x as m,aL as g,A as h,a as C,e as w,G as T,bv as ne,a0 as me,a1 as p,H as O,br as B,bm as E,D as N,ac as pe,aK as ce,az as _}from"./index.js";import{o as fe,i as ve,a as Ce,C as he}from"./ChildGoodEditModal.b0de1a.js";import{u as be}from"./useDetail.33ec7a53.js";import{B as x}from"./basic-descriptions.e6b0a528.js";import ge from"./index.04a7a9.js";import{h as j,d as we}from"./index.004a0bb2.js";import{P as Fe}from"./index.1ed73e65.js";import{S as Ee}from"./index.5f93fc4f.js";import{a as _e}from"./calc.850c7422.js";import{B as De}from"./index.ea39302f.js";import{M as ke,F as ye}from"./index.cc66ea4e.js";import"./status.b7512d56.js";import"./shared.b741187d.js";import"./tootip.c6ca5db9.js";import"./shared.110b48c6.js";import"./use-page-search.dfa27a70.js";import"./index.0d3e4f3d.js";import"./columnRenderHelper.8411add2.js";import"./columns.74c15f1e.js";import"./index.4109350c.js";import"./find.5020d717.js";const Te={class:"padding__container"},Be={class:"w-full flex justify-between mb-[10px]"},Ne={class:"w-full flex justify-between"},xe={class:"flex w-full justify-end"},Ae=se({__name:"detail",setup(Ve){const{title:L,collapses:D,id:b}=be({baseName:"\u51FA\u5E93",collapseLen:5}),k=v(!1),A=v(!1),V=v(!1),P=v(0),y=G(),i=G(),{isSuperUser:$}=ie(),f=re({editVisible:!1,index:-1,data:{}}),S=v(!1),I=v(null),q=F(()=>{var o,a;return i.data?{...{},good_type:String((o=i.data)==null?void 0:o.goodType),status:"1",good_source:String((a=i.data)==null?void 0:a.source)}:{}}),J=F(()=>{const u=t.value.goods.map(({id:r,goodNum:n})=>({id:r,num:n})),o={};let a=0;for(const r of u)if(!o[r.id]){o[r.id]=!0;const{num:n="0"}=r;a=_e(n,a)}return a}),H=F(()=>t.value.goods.map(({id:o,goodNum:a,isJT:r})=>({id:o,num:a,isJT:r})).some(({isJT:o})=>o)),R=F(()=>t.value.goods.filter(u=>!u.isJT)),t=v({goods:[],month:""}),K={goods:[{required:!0,message:"\u8BF7\u9009\u62E9\u64CD\u4F5C\u5546\u54C1"}],month:[{required:!0,message:"\u8BF7\u9009\u62E9\u5165\u8D26\u6708\u4EFD"}]};function Q(u){const o=t.value.goods.map(({id:r})=>r),a=[];u.forEach(r=>{o.includes(r.id)||a.push(r)}),t.value.goods=[...t.value.goods,...a]}function W(u){f.index=u,f.editVisible=!0,f.data={...t.value.goods[u]}}function X(u,o){let a=Array.isArray(u)?u.length:0;if(a>0){let r=0,n=u[0][o],s=[1];for(let d=1;d({id:d,unit_price:te,num:le,subunit_price:ae})),o=[],a={};for(const d of u)a[d.id]||(o.push(d),a[d.id]=!0);if(Number(i.data.balance_num)!==Number(J.value)){_.warning("\u64CD\u4F5C\u6570\u91CF\u5FC5\u987B\u7B49\u4E8E\u5F85\u5904\u7406\u6570\u91CF");return}if(t.value.goods.filter(d=>!!d.num).length!==0){_.warning("\u5546\u54C1\u64CD\u4F5C\u6570\u91CF\u4E0D\u80FD\u4E3A\u7A7A");return}S.value=!0;const{code:n,message:s}=await we({relaArr:o,manager_id:b.value,is_checkOrder:H.value?"1":"0",fz_date:t.value.month});S.value=!1,n==0?(_.success("\u64CD\u4F5C\u5B8C\u6210"),i.run(j({id:b.value}))):_.warning(s)}catch{}}function ee(u,o){const{id:a}=t.value.goods[u];t.value.goods.forEach((r,n)=>{if(r.id===a){t.value.goods[n].goodNum=o.goodNum;const{goodNum:s,residue_stock:d}=o;t.value.goods[n].isJT=s>d,t.value.goods[n].childNum&&(t.value.goods[n].isJT=s>d,t.value.goods[n].childActionNum=t.value.goods[n].childNum*o.goodNum)}})}function oe(u){const{id:o}=t.value.goods[u];t.value.goods=t.value.goods.filter(a=>a.id!==o)}return b.value&&i.run(j({id:b.value})),(u,o)=>{const a=U("ElFormItem"),r=U("ElDialog"),n=de("loading");return M((c(),z("div",Te,[l(ye,{id:e(b),mode:e(ke).OUT},null,8,["id","mode"]),l(e(ce),{modelValue:e(D),"onUpdate:modelValue":o[2]||(o[2]=s=>pe(D)?D.value=s:null)},{default:m(()=>[l(e(g),{title:e(L),name:"1"},{default:m(()=>[e(i).data?(c(),h(e(x),{key:0,columns:e(fe),data:e(i).data},null,8,["columns","data"])):C("v-if",!0)]),_:1},8,["title"]),l(e(g),{title:"\u8BA2\u5355\u8BE6\u60C5",name:"2"},{default:m(()=>[e(i).data?(c(),h(e(x),{key:0,columns:e(ve),data:e(i).data},null,8,["columns","data"])):C("v-if",!0)]),_:1}),l(e(g),{title:"\u53D1\u7968\u8BE6\u60C5",name:"3"},{default:m(()=>[e(i).data?(c(),h(e(x),{key:0,columns:e(Ce),data:e(i).data},null,8,["columns","data"])):C("v-if",!0)]),_:1}),e(i).data&&e(i).data.ProductRela.length!==0?(c(),h(e(g),{key:0,title:"\u5546\u54C1\u4FE1\u606F",name:"4"},{default:m(()=>[C(` \r \r \r \r \r \r \r \r \r \r `),l(De,{ProductRela:e(i).data.ProductRela},null,8,["ProductRela"])]),_:1})):C("v-if",!0),!e($)&&e(i).data&&(e(i).data.status=="1"||e(i).data.status=="4")?(c(),h(e(g),{key:1,name:"5",title:"\u5F85\u5904\u7406\u4FE1\u606F"},{default:m(()=>[w("div",Be,[w("p",null,"\u5F85\u5904\u7406 "+T(Number(e(i).data.balance_num))+" / "+T(J.value),1)]),l(e(ne),{ref_key:"formRef",ref:I,rules:K,model:t.value},{default:m(()=>[l(a,{label:"\u64CD\u4F5C\u5546\u54C1",prop:"goods"},{default:m(()=>[l(e(me),{"span-method":Y,border:"",size:"small",data:t.value.goods},{default:m(()=>[l(e(p),{label:"\u5546\u54C1ID",prop:"id",width:"60px","show-overflow-tooltip":""}),l(e(p),{label:"\u5546\u54C1\u7F16\u53F7",prop:"skuCode","show-overflow-tooltip":""}),l(e(p),{label:"\u5546\u54C1\u540D\u79F0",prop:"goodName","show-overflow-tooltip":""}),l(e(p),{label:"\u662F\u5426\u4E3A\u8BA1\u63D0",prop:"residue_stock",width:"80px","show-overflow-tooltip":""},{default:m(({row:s})=>[O(T(s.isJT?"\u662F":"\u5426"),1)]),_:1}),l(e(p),{label:"\u7ED3\u5B58\u6570",prop:"residue_stock",width:"80px","show-overflow-tooltip":""}),l(e(p),{label:"\u64CD\u4F5C\u6570\u91CF",prop:"goodNum",width:"80px","show-overflow-tooltip":""}),l(e(p),{label:"\u5B50\u5546\u54C1\u7F16\u53F7",prop:"childCode","show-overflow-tooltip":""}),l(e(p),{label:"\u5B50\u5546\u54C1\u6BD4\u4F8B",prop:"childNum","show-overflow-tooltip":""}),l(e(p),{label:"\u5B50\u5546\u54C1\u64CD\u4F5C\u6570\u91CF",prop:"childActionNum",width:"110px","show-overflow-tooltip":""}),l(e(p),{width:"70px",label:"\u64CD\u4F5C"},{header:m(()=>[w("div",Ne,[o[6]||(o[6]=w("span",null,"\u64CD\u4F5C",-1)),l(e(B),{content:"\u6DFB\u52A0",placement:"top"},{default:m(()=>[l(e(E),{link:"",size:"small",type:"primary",icon:e(N)("add"),onClick:o[0]||(o[0]=s=>{A.value=!1,k.value=!0})},null,8,["icon"])]),_:1})])]),default:m(({$index:s})=>[l(e(B),{content:"\u7F16\u8F91",placement:"top"},{default:m(()=>[l(e(E),{icon:e(N)("edits"),type:"primary",size:"small",link:"",onClick:d=>W(s)},null,8,["icon","onClick"])]),_:2},1024),l(e(B),{content:"\u5220\u9664",placement:"top"},{default:m(()=>[l(e(E),{icon:e(N)("delete"),type:"danger",size:"small",link:"",onClick:d=>oe(s)},null,8,["icon","onClick"])]),_:2},1024)]),_:1})]),_:1},8,["data"])]),_:1}),l(a,{label:"\u5165\u8D26\u6708\u4EFD",prop:"month"},{default:m(()=>[l(Ee,{placeholder:"\u5165\u8D26\u6708\u4EFD",modelValue:t.value.month,"onUpdate:modelValue":o[1]||(o[1]=s=>t.value.month=s),company_code:e(i).data.inv_seller_code},null,8,["modelValue","company_code"])]),_:1})]),_:1},8,["model"]),w("div",xe,[l(e(E),{type:"primary",onClick:Z},{default:m(()=>o[7]||(o[7]=[O("\u4FDD\u5B58")])),_:1})])]),_:1})):C("v-if",!0)]),_:1},8,["modelValue"]),l(ge,{visible:k.value,"onUpdate:visible":o[3]||(o[3]=s=>k.value=s),isJT:A.value,otherSearchParameter:q.value,onSubmit:Q,skuCode:R.value.length===0?"":R.value[0].skuCode},null,8,["visible","isJT","otherSearchParameter","skuCode"]),l(he,{data:f.data,index:f.index,visible:f.editVisible,"onUpdate:visible":o[4]||(o[4]=s=>f.editVisible=s),onSubmit:ee},null,8,["data","index","visible"]),l(r,{center:"",title:"\u5546\u54C1\u8BE6\u60C5",modelValue:V.value,"onUpdate:modelValue":o[5]||(o[5]=s=>V.value=s),style:{overflow:"hidden"}},{default:m(()=>[M((c(),z("div",null,[e(y).data?(c(),h(Fe,{key:0,data:e(y).data,num:e(i).data.ProductRela[P.value].num,time:e(i).data.ProductRela[P.value].create_time},null,8,["data","num","time"])):C("v-if",!0)])),[[n,e(y).loading]])]),_:1},8,["modelValue"])])),[[n,e(i).loading]])}}});var eo=ue(Ae,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/invoiceInOut/outManager/detail.vue"]]);export{eo as default};