detail.81a26f.js 8.8 KB

1
  1. import{_ as me,d as pe,w as b,a4 as fe,aY as P,W as ve,a7 as S,z as Ce,r as f,at as be,H as $,l as t,o as g,c as H,j as u,C as d,ah as ge,G as _,a as F,M as K,L as x,aK as he,aL as O,h as I,J as U,ba as _e,aP as Fe,aQ as Q,az as w}from"./index.js";import{o as Ee,i as ke,C as De}from"./ChildGoodEditModal.6c6e20.js";import{u as we}from"./useDetail.b5b5c0c3.js";import{B as W}from"./basic-descriptions.6f62a32b.js";import ye from"./index.c1687a.js";import{h as Be,f as Y,g as Ae}from"./index.61485ef8.js";import{h as Ne}from"./index.c02ef4cf.js";import{P as X}from"./index.d46ecec6.js";import{a as z,m as Te}from"./calc.850c7422.js";import"./status.b7512d56.js";import"./shared.5e18e776.js";import"./tootip.ea18ff9f.js";import"./use-page-search.c6b00ede.js";import"./index.3af3fa8d.js";import"./columnRenderHelper.ea97af9d.js";import"./columns.21f24441.js";const Ve={class:"padding__container"},Pe={class:"w-full flex justify-between"},Se={class:"flex w-full justify-end"},xe=pe({__name:"detail",setup(Oe){const{title:M,collapses:y,id:E}=we({baseName:"\u8BA1\u63D0\u51FA\u5E93\u660E\u7EC6\u5904\u7406",collapseLen:5}),B=b(!1),{isSuperUser:Z}=fe(),h=P(),i=P({success({manager_id:a}){h.run(Be({id:a}))}}),k=b(0),A=b(!1),D=P(),G=b(!1),v=ve({editVisible:!1,index:-1,data:{}}),R=b(!1),j=b(null),q=S(()=>{var e;if(!((e=i.data)!=null&&e.ProductTz))return{};if(i.data.ProductTz.length===0)return{};const a=i.data.ProductTz.find(({type:l})=>l==2);return(a==null?void 0:a.Product)||{}}),ee=S(()=>{var e,l;return i.data?{...i.data.type=="2"?{basic_status:"1"}:{basic_status:"1"},good_type:String((e=i.data)==null?void 0:e.Manager.goodType),status:"1",good_source:String((l=h.data)==null?void 0:l.source)}:{}}),o=b({goods:[],checkFee:"",is_CheckOrder:""}),ae={goods:[{required:!0,message:"\u8BF7\u9009\u62E9\u64CD\u4F5C\u5546\u54C1"}],checkFee:[{required:!0,message:"\u8BF7\u8F93\u5165\u8C03\u6574\u91D1\u989D"}],is_CheckOrder:[{required:!0,message:"\u8BF7\u9009\u62E9\u662F\u5426\u52A0\u5165\u8C03\u6574\u5355"}]};function te(a){const e=o.value.goods.map(({id:s})=>s),l=[];a.forEach(s=>{e.includes(s.id)||l.push(s)}),o.value.goods=[...l,...o.value.goods],de()}function ue(a){v.index=a,v.editVisible=!0,v.data={...o.value.goods[a]}}function oe(a,e){let l=Array.isArray(a)?a.length:0;if(l>0){let s=0,n=a[0][e],m=[1];for(let r=1;r<l;r++)a[r][e]==n?(m[s]+=1,m[r]=0):(s=r,m[r]=1,n=a[r][e]);return m}else return[0]}function le({row:a,column:e,rowIndex:l,columnIndex:s}){if([0,1,2,7].includes(Number(s)))return{rowspan:oe(o.value.goods,"id")[l],colspan:1}}async function se(){try{await j.value.validate();const a=o.value.goods.map(({id:c,goodNum:N,subunit_price:T,unit_price:V})=>({id:c,num:N,unit_price:V,subunit_price:T})),e=[],l={};for(const c of a)l[c.id]||(e.push(c),l[c.id]=!0);if([...new Set(e.map(({skuCode:c})=>c))].length!==1){w.warning("\u9009\u62E9\u5546\u54C1\u7684\u5546\u54C1\u7F16\u53F7\u5FC5\u987B\u4E00\u81F4");return}let n=0;if(a.forEach(c=>{n=z(c.num,n)}),Number(n)!==Number(i.data.num)){w.warning("\u64CD\u4F5C\u6570\u91CF\u4E0E\u8BA1\u63D0\u6570\u91CF\u5FC5\u987B\u4E00\u81F4");return}R.value=!0;const{code:m,message:r}=await Ae({status:"2",id:E.value,idArr:e,checkFee:o.value.checkFee,isAddCheck:o.value.is_CheckOrder});R.value=!1,m==0?(w.success("\u64CD\u4F5C\u5B8C\u6210"),i.run(Y({id:E.value}))):w.warning(r)}catch{}}function ie(a,e){const{id:l}=o.value.goods[a];o.value.goods.forEach((s,n)=>{s.id===l&&(o.value.goods[n].goodNum=e.goodNum,o.value.goods[n].childNum&&(o.value.goods[n].childActionNum=o.value.goods[n].childNum*e.goodNum))})}function ne(a){const{id:e}=o.value.goods[a];o.value.goods=o.value.goods.filter(l=>l.id!==e)}function de(){let a="0";o.value.goods.forEach(e=>{a+=Number(Number(e.goodNum*e.subunit_price).toFixed(2)).toFixed(2)}),o.value.checkFee=a}function re(a,e){A.value=!0,k.value=e,D.run(Ne({id:a}))}const J=S(()=>{const a=o.value.goods.map(({id:s,goodNum:n})=>({id:s,num:n})),e={};let l=0;for(const s of a)if(!e[s.id]){e[s.id]=!0;const{num:n="0"}=s;l=z(n,l)}return l});return Ce(()=>o.value.goods,()=>{if(!i.data)return;let a=0;o.value.goods.forEach(e=>{a=z(Te(e.goodNum,e.subunit_price),a)}),o.value.checkFee=String(i.data.out_fee-a),Number(o.value.checkFee)===0&&o.value.is_CheckOrder=="1"&&(o.value.is_CheckOrder=""),G.value=Number(o.value.checkFee)===0},{deep:!0,immediate:!0}),E.value&&i.run(Y({id:E.value})),(a,e)=>{const l=f("ElCollapseItem"),s=f("ElTableColumn"),n=f("ElButton"),m=f("ElTooltip"),r=f("ElTable"),c=f("ElCollapse"),N=f("ElTabPane"),T=f("ElTabs"),V=f("ElDialog"),L=be("loading");return $((g(),H("div",Ve,[u(T,null,{default:d(()=>[u(N,{label:t(M)},{default:d(()=>[u(c,{modelValue:t(y),"onUpdate:modelValue":e[3]||(e[3]=p=>ge(y)?y.value=p:null)},{default:d(()=>{var p;return[u(l,{title:t(M),name:"1"},{default:d(()=>[t(i).data?(g(),_(t(W),{key:0,columns:t(Ee),data:t(i).data},null,8,["columns","data"])):F("v-if",!0)]),_:1},8,["title"]),u(l,{title:"\u51FA\u5E93\u8BE6\u60C5",name:"2"},{default:d(()=>[t(h).data&&t(i).data?(g(),_(t(W),{key:0,columns:t(ke)(re),data:{...t(h).data,...t(i).data}},null,8,["columns","data"])):F("v-if",!0)]),_:1}),q.value&&((p=t(i).data)==null?void 0:p.status)=="2"?(g(),_(l,{key:0,title:"\u8BA1\u63D0\u5546\u54C1",name:"4"},{default:d(()=>[u(X,{data:q.value},null,8,["data"])]),_:1})):F("v-if",!0),t(i).data&&t(i).data.status=="1"&&!t(Z)?(g(),_(l,{key:1,title:"\u51FA\u5165\u5E93\u4FE1\u606F\u786E\u8BA4",name:"2"},{default:d(()=>[K(" \u8BA1\u63D0\u5F85\u5904\u7406\u6570\u91CF "+x(Number(t(i).data.num))+" / "+x(J.value)+", \u672A\u5904\u7406\u6570\u91CF "+x(t(i).data.num-J.value)+" ",1),u(t(he),{ref_key:"formRef",ref:j,rules:ae,model:o.value,"label-width":"140px"},{default:d(()=>[u(t(O),{label:"\u5173\u8054\u51ED\u8BC1",prop:"goods"},{default:d(()=>[u(r,{"span-method":le,border:"",size:"small",data:o.value.goods},{default:d(()=>[u(s,{label:"\u5546\u54C1ID",prop:"id",width:"60","show-overflow-tooltip":""}),u(s,{label:"\u5546\u54C1\u7F16\u53F7",prop:"skuCode","show-overflow-tooltip":""}),u(s,{label:"\u5546\u54C1\u540D\u79F0",prop:"goodName","show-overflow-tooltip":""}),u(s,{label:"\u8D26\u9762\u6570\u91CF",prop:"total_stock","show-overflow-tooltip":""}),u(s,{label:"\u76EE\u6807\u5546\u54C1\u6BD4\u4F8B",prop:"spbl","show-overflow-tooltip":""}),u(s,{label:"\u5173\u8054\u6570\u91CF",prop:"goodNum","show-overflow-tooltip":""}),u(s,{label:"\u7A0E\u524D\u5355\u4EF7",prop:"subunit_price","show-overflow-tooltip":""}),u(s,{label:"\u7A0E\u540E\u603B\u4EF7",prop:"unit_price",width:"140px","show-overflow-tooltip":""}),u(s,{width:"70px",label:"\u64CD\u4F5C"},{header:d(()=>[I("div",Pe,[e[7]||(e[7]=I("span",null,"\u64CD\u4F5C",-1)),u(m,{content:"\u6DFB\u52A0",placement:"top"},{default:d(()=>[u(n,{type:"primary",link:"",size:"small",icon:t(U)("add"),onClick:e[0]||(e[0]=C=>B.value=!0)},null,8,["icon"])]),_:1})])]),default:d(({$index:C})=>[u(m,{content:"\u7F16\u8F91",placement:"top"},{default:d(()=>[u(n,{icon:t(U)("edits"),type:"primary",size:"small",link:"",onClick:ce=>ue(C)},null,8,["icon","onClick"])]),_:2},1024),u(m,{content:"\u5220\u9664",placement:"top"},{default:d(()=>[u(n,{icon:t(U)("delete"),type:"danger",size:"small",link:"",onClick:ce=>ne(C)},null,8,["icon","onClick"])]),_:2},1024)]),_:1})]),_:1},8,["data"])]),_:1}),u(t(O),{label:"\u8C03\u6574\u8D39\u7528",prop:"checkFee"},{default:d(()=>[u(t(_e),{disabled:"",modelValue:o.value.checkFee,"onUpdate:modelValue":e[1]||(e[1]=C=>o.value.checkFee=C),unit:"\u5143",placeholder:"\u8C03\u6574\u8D39\u7528"},null,8,["modelValue"])]),_:1}),u(t(O),{label:"\u662F\u5426\u6DFB\u52A0\u81F3\u8C03\u6574\u5355",prop:"is_CheckOrder"},{default:d(()=>[u(t(Fe),{modelValue:o.value.is_CheckOrder,"onUpdate:modelValue":e[2]||(e[2]=C=>o.value.is_CheckOrder=C)},{default:d(()=>[u(t(Q),{label:"\u662F",value:"1"}),u(t(Q),{label:"\u5426",value:"0",disabled:G.value},null,8,["disabled"])]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model"]),I("div",Se,[u(n,{type:"primary",onClick:se},{default:d(()=>e[8]||(e[8]=[K("\u4FDD\u5B58")])),_:1})])]),_:1})):F("v-if",!0)]}),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1}),u(ye,{visible:B.value,"onUpdate:visible":e[4]||(e[4]=p=>B.value=p),otherSearchParameter:ee.value,onSubmit:te},null,8,["visible","otherSearchParameter"]),u(De,{data:v.data,index:v.index,visible:v.editVisible,"onUpdate:visible":e[5]||(e[5]=p=>v.editVisible=p),onSubmit:ie},null,8,["data","index","visible"]),u(V,{center:"",title:"\u5546\u54C1\u8BE6\u60C5",modelValue:A.value,"onUpdate:modelValue":e[6]||(e[6]=p=>A.value=p),style:{overflow:"hidden"}},{default:d(()=>[$((g(),H("div",null,[t(D).data?(g(),_(X,{key:0,data:t(D).data,num:t(i).data.Manager.ProductRela[k.value].num,time:t(i).data.Manager.ProductRela[k.value].create_time,name:t(i).data.Manager.ProductRela[k.value].apply_name},null,8,["data","num","time","name"])):F("v-if",!0)])),[[L,t(D).loading]])]),_:1},8,["modelValue"])])),[[L,t(i).loading||t(h).loading]])}}});var Xe=me(xe,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/invoiceInOut/provisionOut/detail.vue"]]);export{Xe as default};