detail.38afc0.js 8.4 KB

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