index.1c4000.js 9.7 KB

1
  1. import{_ as $,d as H,Q as L,O as Q,a2 as A,j as K,m as k,aH as W,az as h,w as X,r as w,o as Y,A as Z,x as r,f as o,H as b,G as g,h as a,e as F,br as _,bm as C,D as E,bv as oo}from"./index.js";import eo from"./index.9ebf5a.js";import{t as uo,a as lo}from"./shared.e8e6f3b6.js";import{u as to,c as ro}from"./status.b7512d56.js";import so from"./index.64c3fd.js";import ao from"./ChildGoodEditModal.d0c9e8.js";import{S as io}from"./index.5f93fc4f.js";import{h as no}from"./index.3a2f6f6a.js";import{a as N}from"./calc.850c7422.js";import{b as po}from"./columns.74c15f1e.js";import"./use-page-search.dfa27a70.js";import"./shared.129caa24.js";import"./columnRenderHelper.8411add2.js";import"./index.0d3e4f3d.js";import"./tootip.c6ca5db9.js";import"./columns.633d859e.js";import"./basic-descriptions.e6b0a528.js";const mo={class:"flex justify-between"},co={class:"w-full flex justify-between"},fo={class:"w-full flex justify-end"},vo=H({__name:"index",setup(go){const c=L({orderVisible:!1,goodvisible:!1,editVisible:!1,data:{},index:-1}),{getCurrentLicense:x}=Q(),T=A(()=>{var t,u;return{status:"1",good_type:String((t=l.value.orders[0])==null?void 0:t.goodType),good_source:String((u=l.value.orders[0])==null?void 0:u.source)}}),S=K(),l=k({orders:[],goods:[],month:""}),V=W({success(){h.success("\u521B\u5EFA\u6210\u529F"),S.push("/invoiceInOut/clinetC")}}),D=k(null),B=A(()=>({order:l.value.orders.reduce((t,{balance_num:u})=>N(t,u),0),good:l.value.goods.reduce((t,{goodNum:u})=>N(t,u),0)}));function z(){if(l.value.orders.length==0){h.warning("\u8BF7\u9009\u62E9\u81F3\u5C11\u4E00\u4E2A\u8BA2\u5355");return}c.goodvisible=!0}function O(t,u){let e=Array.isArray(t)?t.length:0;if(e>0){let i=0,m=t[0][u],f=[1];for(let d=1;d<e;d++)t[d][u]==m?(f[i]+=1,f[d]=0):(i=d,f[d]=1,m=t[d][u]);return f}else return[0]}function G({row:t,column:u,rowIndex:e,columnIndex:i}){if([0,1,2,3,4,5,9].includes(Number(i)))return{rowspan:O(l.value.goods,"id")[e],colspan:1}}function I(t){const u=l.value.orders.map(({id:e})=>e);t.forEach(e=>{u.includes(e.id)||l.value.orders.push(e)})}function M(t){c.index=t,c.editVisible=!0,c.data={...l.value.goods[t]}}function j(t){const{id:u}=l.value.goods[t];l.value.goods=l.value.goods.filter(e=>e.id!==u)}function U(t){const u=l.value.goods.map(({id:i})=>i),e=[];t.forEach(i=>{u.includes(i.id)||e.push(i)}),l.value.goods=[...e,...l.value.goods]}function J(t,u){const{id:e}=l.value.goods[t];l.value.goods.forEach((i,m)=>{if(i.id===e){l.value.goods[m].goodNum=u.goodNum;const{goodNum:f,residue_stock:d}=u;l.value.goods[m].isJT=f>d,l.value.goods[m].childNum&&(l.value.goods[m].isJT=f>d,l.value.goods[m].childActionNum=l.value.goods[m].childNum*u.goodNum)}})}async function P(){var t;try{await((t=D.value)==null?void 0:t.validate());const{orders:u,goods:e,month:i}=l.value;if([...new Set(u.map(({goodNo:p})=>p))].length!==1){h.warning("\u9009\u62E9\u8BA2\u5355\u7684\u5546\u54C1\u7F16\u53F7\u5FC5\u987B\u4E00\u81F4");return}if([...new Set(e.map(({skuCode:p})=>p))].length!==1){h.warning("\u9009\u62E9\u5546\u54C1\u7684\u5546\u54C1\u7F16\u53F7\u5FC5\u987B\u4E00\u81F4");return}if(l.value.goods.filter(p=>!!p.goodNum).length===0){h.warning("\u5546\u54C1\u64CD\u4F5C\u6570\u91CF\u4E0D\u80FD\u4E3A\u7A7A");return}const y={manager_id:u.map(p=>p.id),is_checkOrder:R.value?"1":"0",relaArr:e.map(p=>({id:p.id,num:p.goodNum,unit_price:p.unit_price,subunit_price:p.subunit_price})),fz_date:i};V.run(no(y))}catch{}}const R=A(()=>l.value.goods.map(({id:u,goodNum:e,isJT:i})=>({id:u,num:e,isJT:i})).some(({isJT:u})=>u)),q={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 X(()=>l.value.orders,()=>{l.value.orders.length===0&&(l.value.goods=[])},{deep:!0}),(t,u)=>{const e=w("ElTableColumn"),i=w("ElTag"),m=w("el-tag"),f=w("ElTable"),d=w("ElFormItem");return Y(),Z(a(oo),{ref_key:"formRef",ref:D,"label-width":"100px",model:l.value,rules:q},{default:r(()=>{var y,p;return[o(d,{label:"toC\u8BA2\u5355\u4FE1\u606F",prop:"orders"},{default:r(()=>[o(f,{border:"",size:"small",data:l.value.orders},{default:r(()=>[o(e,{label:"\u786E\u8BA4\u5355\u7F16\u53F7",prop:"orderCode","show-overflow-tooltip":""}),o(e,{label:"\u9500\u552E\u4E3B\u5355\u53F7",prop:"cxCode","show-overflow-tooltip":""}),o(e,{label:"\u4E1A\u52A1\u7C7B\u578B"},{default:r(({row:s})=>[o(i,{size:"small"},{default:r(()=>{var n;return[b(g(((n=a(uo).find(v=>v.value==s.type))==null?void 0:n.label)||"--"),1)]}),_:2},1024)]),_:1}),o(e,{label:"\u72B6\u6001"},{default:r(({row:s})=>[o(i,{size:"small"},{default:r(()=>{var n;return[b(g(((n=a(lo).find(v=>v.value==s.status))==null?void 0:n.label)||"--"),1)]}),_:2},1024)]),_:1}),o(e,{label:"\u5E73\u53F0\u8BA2\u5355\u53F7",prop:"poCode","show-overflow-tooltip":""}),o(e,{label:"\u5E73\u53F0\u7C7B\u578B"},{default:r(({row:s})=>[o(i,{size:"small"},{default:r(()=>{var n;return[b(g(((n=a(to).find(v=>v.value==s.status))==null?void 0:n.label)||"--"),1)]}),_:2},1024)]),_:1}),o(e,{label:"\u5356\u51FA\u65B9\u516C\u53F8",prop:"seller_name","show-overflow-tooltip":""}),o(e,{label:"\u5BA2\u6237\u516C\u53F8",prop:"buyer_name","show-overflow-tooltip":""}),o(e,{label:"\u5546\u54C1\u7F16\u7801",prop:"goodNo",width:"160px","show-overflow-tooltip":""}),o(e,{label:"\u5546\u54C1\u540D\u79F0",prop:"goodName",width:"160px","show-overflow-tooltip":""}),o(e,{label:"\u5546\u54C1\u7C7B\u578B",prop:"goodName",width:"95px","show-overflow-tooltip":""},{default:r(({row:s})=>[o(m,null,{default:r(()=>{var n;return[b(g(((n=a(ro).find(v=>v.value==s.goodType))==null?void 0:n.label)||"--"),1)]}),_:2},1024)]),_:1}),o(e,{label:"\u5546\u54C1\u6765\u6E90",prop:"goodName",width:"95px","show-overflow-tooltip":""},{default:r(({row:s})=>[o(m,null,{default:r(()=>{var n;return[b(g(((n=a(po).find(v=>v.value==s.source))==null?void 0:n.label)||"--"),1)]}),_:2},1024)]),_:1}),o(e,{label:"\u4E0B\u5355\u6570\u91CF",prop:"balance_num","show-overflow-tooltip":""}),o(e,{label:"\u9500\u552E\u5355\u4EF7",prop:"goodPrice","show-overflow-tooltip":""}),o(e,{label:"\u9500\u552E\u5408\u8BA1",prop:"totalPrice","show-overflow-tooltip":""}),o(e,{label:"\u51FA\u5E93\u65F6\u95F4",porp:"fz_date","show-overflow-tooltip":""}),o(e,{label:"\u64CD\u4F5C",fixed:"right",width:"60px"},{header:r(()=>[F("div",mo,[u[5]||(u[5]=F("span",null,"\u64CD\u4F5C",-1)),o(a(_),{content:"\u6DFB\u52A0",placement:"top"},{default:r(()=>[o(a(C),{icon:a(E)("add"),link:"",size:"small",type:"primary",onClick:u[0]||(u[0]=s=>c.orderVisible=!0)},null,8,["icon"])]),_:1})])]),default:r(({$index:s})=>[o(a(_),{content:"\u5220\u9664",placement:"top"},{default:r(()=>[o(a(C),{onClick:n=>l.value.orders.splice(s,1),icon:a(E)("delete"),size:"small",type:"danger",link:""},null,8,["onClick","icon"])]),_:2},1024)]),_:1})]),_:1},8,["data"])]),_:1}),o(d,{label:"\u64CD\u4F5C\u5546\u54C1",prop:"goods"},{default:r(()=>[b(" \u5F85\u5904\u7406\u6570\u91CF: "+g(Number(B.value.order))+" / "+g(Number(B.value.good))+", \u672A\u5904\u7406\u6570\u91CF: "+g(Number(B.value.order)-Number(B.value.good))+" ",1),o(f,{"span-method":G,border:"",size:"small",data:l.value.goods},{default:r(()=>[o(e,{label:"\u5546\u54C1ID",prop:"id",width:"60px","show-overflow-tooltip":""}),o(e,{label:"\u5546\u54C1\u7F16\u53F7",prop:"skuCode","show-overflow-tooltip":""}),o(e,{label:"\u5546\u54C1\u540D\u79F0",prop:"goodName","show-overflow-tooltip":""}),o(e,{label:"\u662F\u5426\u4E3A\u8BA1\u63D0",prop:"residue_stock",width:"80px","show-overflow-tooltip":""},{default:r(({row:s})=>[b(g(s.isJT?"\u662F":"\u5426"),1)]),_:1}),o(e,{label:"\u7ED3\u5B58\u6570",prop:"residue_stock",width:"80px","show-overflow-tooltip":""}),o(e,{label:"\u64CD\u4F5C\u6570\u91CF",prop:"goodNum",width:"80px","show-overflow-tooltip":""}),o(e,{label:"\u5B50\u5546\u54C1\u7F16\u53F7",prop:"childCode","show-overflow-tooltip":""}),o(e,{label:"\u5B50\u5546\u54C1\u6BD4\u4F8B",prop:"childNum","show-overflow-tooltip":""}),o(e,{label:"\u5B50\u5546\u54C1\u64CD\u4F5C\u6570\u91CF",prop:"childActionNum",width:"110px","show-overflow-tooltip":""}),o(e,{width:"70px",label:"\u64CD\u4F5C"},{header:r(()=>[F("div",co,[u[6]||(u[6]=F("span",null,"\u64CD\u4F5C",-1)),o(a(_),{content:"\u6DFB\u52A0",placement:"top"},{default:r(()=>[o(a(C),{link:"",size:"small",type:"primary",icon:a(E)("add"),onClick:z},null,8,["icon"])]),_:1})])]),default:r(({$index:s})=>[o(a(_),{content:"\u7F16\u8F91",placement:"top"},{default:r(()=>[o(a(C),{icon:a(E)("edits"),type:"primary",size:"small",link:"",onClick:n=>M(s)},null,8,["icon","onClick"])]),_:2},1024),o(a(_),{content:"\u5220\u9664",placement:"top"},{default:r(()=>[o(a(C),{icon:a(E)("delete"),type:"danger",size:"small",link:"",onClick:n=>j(s)},null,8,["icon","onClick"])]),_:2},1024)]),_:1})]),_:1},8,["data"])]),_:1}),o(d,{label:"\u5165\u8D26\u6708\u4EFD",prop:"month"},{default:r(()=>[o(io,{modelValue:l.value.month,"onUpdate:modelValue":u[1]||(u[1]=s=>l.value.month=s),placeholder:"\u5165\u8D26\u6708\u4EFD",company_code:a(x)()},null,8,["modelValue","company_code"])]),_:1}),F("div",fo,[o(a(C),{type:"primary",onClick:P},{default:r(()=>u[7]||(u[7]=[b("\u4FDD\u5B58")])),_:1})]),o(eo,{visible:c.orderVisible,"onUpdate:visible":u[2]||(u[2]=s=>c.orderVisible=s),onSubmit:I,goodType:(y=l.value.orders[0])==null?void 0:y.goodType,source:(p=l.value.orders[0])==null?void 0:p.source},null,8,["visible","goodType","source"]),o(so,{visible:c.goodvisible,"onUpdate:visible":u[3]||(u[3]=s=>c.goodvisible=s),onSubmit:U,"other-search-parameter":T.value},null,8,["visible","other-search-parameter"]),o(ao,{data:c.data,index:c.index,visible:c.editVisible,"onUpdate:visible":u[4]||(u[4]=s=>c.editVisible=s),onSubmit:J},null,8,["data","index","visible"])]}),_:1},8,["model"])}}});var zo=$(vo,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/invoiceInOut/clientC/components/BaseForm/index.vue"]]);export{zo as default};