import{_ as S,d as M,W as O,n as G,w as E,aY as j,az as I,r as F,o as R,G as U,C as t,j as e,M as g,L as h,l as r,h as v,b0 as b,aR as f,J as C,aK as $}from"./index.js";import q from"./index.656b8f.js";import{t as P,a as J}from"./shared.e62a6d9e.js";import{u as K}from"./status.0f771e9a.js";import L from"./index.563420.js";import{C as W}from"./ChildGoodEditModal.b8748c.js";import{S as Y}from"./index.0270321a.js";import{h as H}from"./index.642450e9.js";import"./use-page-search.c6a73876.js";import"./columnRenderHelper.c9666c60.js";import"./index.0e8d4646.js";import"./tootip.f8ec1491.js";import"./basic-descriptions.898fa2c0.js";const Q={class:"flex justify-between"},X={class:"w-full flex justify-between"},Z={class:"w-full flex justify-end"},ee=M({__name:"index",setup(oe){const d=O({orderVisible:!1,goodvisible:!1,editVisible:!1,data:{},index:-1}),_=G(),i=E({orders:[],goods:[],month:""}),B=j({success(){I.success("\u521B\u5EFA\u6210\u529F"),_.push("/invoiceInOut/clinetC")}}),w=E(null);function D(s,l){let o=Array.isArray(s)?s.length:0;if(o>0){let a=0,p=s[0][l],n=[1];for(let u=1;uo);s.forEach(o=>{l.includes(o.id)||i.value.orders.push(o)})}function A(s){d.index=s,d.editVisible=!0,d.data={...i.value.goods[s]}}function x(s){const{id:l}=i.value.goods[s];i.value.goods=i.value.goods.filter(o=>o.id!==l)}function N(s){const l=i.value.goods.map(({id:a})=>a),o=[];s.forEach(a=>{l.includes(a.id)||o.push(a)}),i.value.goods=[...o,...i.value.goods]}function V(s,l){const{id:o}=i.value.goods[s];i.value.goods=i.value.goods.map(a=>{if(a.id===o){const p=l.goodNum,n=a.childNum?Number(a.childNum)*Number(p):void 0;return{...a,goodNum:p,childActionNum:n}}return a})}async function z(){var s;try{await((s=w.value)==null?void 0:s.validate());const{orders:l,goods:o,month:a}=i.value,p={manager_id:l.map(n=>n.id),relaArr:o.map(n=>({id:n.id,num:n.goodNum})),fz_date:a};B.run(H(p))}catch{}}const T={orders:[{required:!0,message:"\u8BF7\u9009\u62E9toC\u8BA2\u5355\u4FE1\u606F",trigger:"change"}],goods:[{required:!0,message:"\u8BF7\u9009\u62E9\u64CD\u4F5C\u5546\u54C1",trigger:"change"}],month:[{required:!0,message:"\u8BF7\u9009\u62E9\u5165\u8D26\u6708\u4EFD",trigger:"change"}]};return(s,l)=>{const o=F("ElTableColumn"),a=F("ElTag"),p=F("ElTable"),n=F("ElFormItem");return R(),U(r($),{ref_key:"formRef",ref:w,"label-width":"100px",model:i.value,rules:T},{default:t(()=>[e(n,{label:"toC\u8BA2\u5355\u4FE1\u606F",prop:"orders"},{default:t(()=>[e(p,{border:"",size:"small",data:i.value.orders},{default:t(()=>[e(o,{label:"\u786E\u8BA4\u5355\u7F16\u53F7",prop:"orderCode","show-overflow-tooltip":""}),e(o,{label:"\u9500\u552E\u4E3B\u5355\u53F7",prop:"cxCode","show-overflow-tooltip":""}),e(o,{label:"\u4E1A\u52A1\u7C7B\u578B"},{default:t(({row:u})=>[e(a,{size:"small"},{default:t(()=>{var m;return[g(h(((m=r(P).find(c=>c.value==u.type))==null?void 0:m.label)||"--"),1)]}),_:2},1024)]),_:1}),e(o,{label:"\u72B6\u6001"},{default:t(({row:u})=>[e(a,{size:"small"},{default:t(()=>{var m;return[g(h(((m=r(J).find(c=>c.value==u.status))==null?void 0:m.label)||"--"),1)]}),_:2},1024)]),_:1}),e(o,{label:"\u5E73\u53F0\u8BA2\u5355\u53F7",prop:"poCode","show-overflow-tooltip":""}),e(o,{label:"\u5E73\u53F0\u7C7B\u578B"},{default:t(({row:u})=>[e(a,{size:"small"},{default:t(()=>{var m;return[g(h(((m=r(K).find(c=>c.value==u.status))==null?void 0:m.label)||"--"),1)]}),_:2},1024)]),_:1}),e(o,{label:"\u5356\u51FA\u65B9\u516C\u53F8",prop:"seller_name","show-overflow-tooltip":""}),e(o,{label:"\u5BA2\u6237\u516C\u53F8",prop:"buyer_name","show-overflow-tooltip":""}),e(o,{label:"\u5546\u54C1\u540D\u79F0",prop:"goodName","show-overflow-tooltip":""}),e(o,{label:"\u4E0B\u5355\u6570\u91CF",prop:"num","show-overflow-tooltip":""}),e(o,{label:"\u9500\u552E\u5355\u4EF7",prop:"goodPrice","show-overflow-tooltip":""}),e(o,{label:"\u9500\u552E\u5408\u8BA1",prop:"totalPrice","show-overflow-tooltip":""}),e(o,{label:"\u51FA\u5E93\u65F6\u95F4",porp:"fz_date","show-overflow-tooltip":""}),e(o,{label:"\u64CD\u4F5C",fixed:"right",width:"60px"},{header:t(()=>[v("div",Q,[l[6]||(l[6]=v("span",null,"\u64CD\u4F5C",-1)),e(r(b),{content:"\u6DFB\u52A0",placement:"top"},{default:t(()=>[e(r(f),{icon:r(C)("add"),link:"",size:"small",type:"primary",onClick:l[0]||(l[0]=u=>d.orderVisible=!0)},null,8,["icon"])]),_:1})])]),default:t(({$index:u})=>[e(r(b),{content:"\u5220\u9664",placement:"top"},{default:t(()=>[e(r(f),{onClick:m=>i.value.orders.splice(u,1),icon:r(C)("delete"),size:"small",type:"danger",link:""},null,8,["onClick","icon"])]),_:2},1024)]),_:1})]),_:1},8,["data"])]),_:1}),e(n,{label:"\u64CD\u4F5C\u5546\u54C1",prop:"goods"},{default:t(()=>[e(p,{"span-method":y,border:"",size:"small",data:i.value.goods},{default:t(()=>[e(o,{label:"\u5546\u54C1\u7F16\u53F7",prop:"skuCode","show-overflow-tooltip":""}),e(o,{label:"\u5546\u54C1\u540D\u79F0",prop:"goodName","show-overflow-tooltip":""}),e(o,{label:"\u64CD\u4F5C\u6570\u91CF",prop:"goodNum","show-overflow-tooltip":""}),e(o,{label:"\u5B50\u5546\u54C1\u7F16\u53F7",prop:"childCode","show-overflow-tooltip":""}),e(o,{label:"\u9500\u552E\u65B9\u516C\u53F8\u7EB3\u7A0E\u8BC6\u522B\u53F7",width:"140px",prop:"seller_code","show-overflow-tooltip":""}),e(o,{label:"\u5B50\u5546\u54C1\u6BD4\u4F8B",prop:"childNum","show-overflow-tooltip":""}),e(o,{label:"\u5B50\u5546\u54C1\u64CD\u4F5C\u6570\u91CF",prop:"childActionNum","show-overflow-tooltip":""}),e(o,{width:"70px",label:"\u64CD\u4F5C"},{header:t(()=>[v("div",X,[l[7]||(l[7]=v("span",null,"\u64CD\u4F5C",-1)),e(r(b),{content:"\u6DFB\u52A0",placement:"top"},{default:t(()=>[e(r(f),{link:"",size:"small",type:"primary",icon:r(C)("add"),onClick:l[1]||(l[1]=u=>d.goodvisible=!0)},null,8,["icon"])]),_:1})])]),default:t(({$index:u})=>[e(r(b),{content:"\u7F16\u8F91",placement:"top"},{default:t(()=>[e(r(f),{icon:r(C)("edits"),type:"primary",size:"small",link:"",onClick:m=>A(u)},null,8,["icon","onClick"])]),_:2},1024),e(r(b),{content:"\u5220\u9664",placement:"top"},{default:t(()=>[e(r(f),{icon:r(C)("delete"),type:"danger",size:"small",link:"",onClick:m=>x(u)},null,8,["icon","onClick"])]),_:2},1024)]),_:1})]),_:1},8,["data"])]),_:1}),e(n,{label:"\u5165\u8D26\u6708\u4EFD",prop:"month"},{default:t(()=>[e(Y,{modelValue:i.value.month,"onUpdate:modelValue":l[2]||(l[2]=u=>i.value.month=u),placeholder:"\u5165\u8D26\u6708\u4EFD"},null,8,["modelValue"])]),_:1}),v("div",Z,[e(r(f),{type:"primary",onClick:z},{default:t(()=>l[8]||(l[8]=[g("\u4FDD\u5B58")])),_:1})]),e(q,{visible:d.orderVisible,"onUpdate:visible":l[3]||(l[3]=u=>d.orderVisible=u),onSubmit:k},null,8,["visible"]),e(L,{visible:d.goodvisible,"onUpdate:visible":l[4]||(l[4]=u=>d.goodvisible=u),onSubmit:N},null,8,["visible"]),e(W,{data:d.data,index:d.index,visible:d.editVisible,"onUpdate:visible":l[5]||(l[5]=u=>d.editVisible=u),onSubmit:V},null,8,["data","index","visible"])]),_:1},8,["model"])}}});var ve=S(ee,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/invoiceInOut/clientC/components/BaseForm/index.vue"]]);export{ve as default};