1 |
- import{_ as ae,d as se,w as C,aY as z,a4 as ie,W as de,a7 as D,r as M,at as ne,H as U,l as e,o as c,c as R,j as t,C as r,aJ as w,G as h,a as f,aM as j,aN as p,b0 as E,aR as g,J as k,h as b,L as T,aK as re,M as $,ah as me,aI as pe,az as y}from"./index.js";import{o as ce,i as fe,a as ve,C as Ce}from"./ChildGoodEditModal.b0de1a.js";import{u as he}from"./useDetail.2f487ca5.js";import{B as x}from"./basic-descriptions.17783a41.js";import we from"./index.865268.js";import{h as L,b as ge}from"./index.ac9c33da.js";import{a as be}from"./index.3e4a56da.js";import{P as Fe}from"./index.4186705a.js";import{S as _e}from"./index.3d5a635c.js";import{a as De}from"./calc.850c7422.js";import"./status.0f771e9a.js";import"./shared.cf063854.js";import"./tootip.c29898b9.js";import"./shared.4cd09a2f.js";import"./use-page-search.496e3eda.js";import"./columns.eaa2d03d.js";const Ee={class:"padding__container"},ke={class:"w-full flex justify-between mb-[10px]"},ye={class:"w-full flex justify-between"},Be={class:"flex w-full justify-end"},Ne=se({__name:"detail",setup(Ae){const{title:O,collapses:B,id:F}=he({baseName:"\u51FA\u5E93",collapseLen:5}),N=C(!1),V=C(!1),A=C(!1),J=C(0),_=z(),d=z(),{isSuperUser:q}=ie(),v=de({editVisible:!1,index:-1,data:{}}),S=C(!1),I=C(null),H=D(()=>{var o;return d.data?{...d.data.type=="2"?{basic_status:"1"}:{basic_status:"2"},good_type:(o=d.data)==null?void 0:o.goodType}:{}}),P=D(()=>{const l=a.value.goods.map(({id:i,goodNum:m})=>({id:i,num:m})),o={};let s=0;for(const i of l)if(!o[i.id]){o[i.id]=!0;const{num:m="0"}=i;s=De(m,s)}return s}),K=D(()=>a.value.goods.map(({id:o,goodNum:s,isJT:i})=>({id:o,num:s,isJT:i})).some(({isJT:o})=>o)),G=D(()=>a.value.goods.filter(l=>!l.isJT)),a=C({goods:[],month:""}),W={goods:[{required:!0,message:"\u8BF7\u9009\u62E9\u64CD\u4F5C\u5546\u54C1"}],month:[{required:!0,message:"\u8BF7\u9009\u62E9\u5165\u8D26\u6708\u4EFD"}]};function Y(l){const o=a.value.goods.map(({id:i})=>i),s=[];l.forEach(i=>{o.includes(i.id)||s.push(i)}),a.value.goods=[...a.value.goods,...s]}function Q(l){v.index=l,v.editVisible=!0,v.data={...a.value.goods[l]}}function X(l,o){let s=Array.isArray(l)?l.length:0;if(s>0){let i=0,m=l[0][o],u=[1];for(let n=1;n<s;n++)l[n][o]==m?(u[i]+=1,u[n]=0):(i=n,u[n]=1,m=l[n][o]);return u}else return[0]}function Z({row:l,column:o,rowIndex:s,columnIndex:i}){if([0,1,2,3,8].includes(Number(i)))return{rowspan:X(a.value.goods,"id")[s],colspan:1}}async function ee(){try{await I.value.validate();const l=a.value.goods.map(({id:n,goodNum:le})=>({id:n,num:le})),o=[],s={};for(const n of l)s[n.id]||(o.push(n),s[n.id]=!0);if(Number(d.data.balance_num)!==Number(P.value)){y.warning("\u64CD\u4F5C\u6570\u91CF\u5FC5\u987B\u7B49\u4E8E\u5F85\u5904\u7406\u6570\u91CF");return}if(a.value.goods.filter(n=>!!n.num).length!==0){y.warning("\u5546\u54C1\u64CD\u4F5C\u6570\u91CF\u4E0D\u80FD\u4E3A\u7A7A");return}S.value=!0;const{code:m,message:u}=await ge({relaArr:o,manager_id:F.value,is_checkOrder:K.value?"1":"0",fz_date:a.value.month});S.value=!1,m==0?(y.success("\u64CD\u4F5C\u5B8C\u6210"),d.run(L({id:F.value}))):y.warning(u)}catch{}}function oe(l,o){const{id:s}=a.value.goods[l];a.value.goods.forEach((i,m)=>{if(i.id===s){a.value.goods[m].goodNum=o.goodNum;const{goodNum:u,residue_stock:n}=o;a.value.goods[m].isJT=u>n,a.value.goods[m].childNum&&(a.value.goods[m].isJT=u>n,a.value.goods[m].childActionNum=a.value.goods[m].childNum*o.goodNum)}})}function te(l,o){A.value=!0,J.value=o,_.run(be({id:l}))}function ue(l){const{id:o}=a.value.goods[l];a.value.goods=a.value.goods.filter(s=>s.id!==o)}return F.value&&d.run(L({id:F.value})),(l,o)=>{const s=M("ElFormItem"),i=M("ElDialog"),m=ne("loading");return U((c(),R("div",Ee,[t(e(pe),{modelValue:e(B),"onUpdate:modelValue":o[2]||(o[2]=u=>me(B)?B.value=u:null)},{default:r(()=>[t(e(w),{title:e(O),name:"1"},{default:r(()=>[e(d).data?(c(),h(e(x),{key:0,columns:e(ce),data:e(d).data},null,8,["columns","data"])):f("v-if",!0)]),_:1},8,["title"]),t(e(w),{title:"\u8BA2\u5355\u8BE6\u60C5",name:"2"},{default:r(()=>[e(d).data?(c(),h(e(x),{key:0,columns:e(fe),data:e(d).data},null,8,["columns","data"])):f("v-if",!0)]),_:1}),t(e(w),{title:"\u53D1\u7968\u8BE6\u60C5",name:"3"},{default:r(()=>[e(d).data?(c(),h(e(x),{key:0,columns:e(ve),data:e(d).data},null,8,["columns","data"])):f("v-if",!0)]),_:1}),e(d).data&&e(d).data.status=="3"?(c(),h(e(w),{key:0,title:"\u5546\u54C1\u4FE1\u606F",name:"4"},{default:r(()=>[t(e(j),{size:"small",border:"",data:e(d).data.ProductRela},{default:r(()=>[t(e(p),{label:"\u5546\u54C1ID",prop:"product_id",width:"60px","show-overflow-tooltip":""}),t(e(p),{label:"\u5546\u54C1\u7F16\u53F7",prop:"skuCode","show-overflow-tooltip":""}),t(e(p),{label:"\u5546\u54C1\u540D\u79F0",prop:"goodName","show-overflow-tooltip":""}),t(e(p),{label:"\u64CD\u4F5C\u6570\u91CF",prop:"num",width:"60px","show-overflow-tooltip":""}),t(e(p),{label:"\u521B\u5EFA\u65F6\u95F4",prop:"create_time","show-overflow-tooltip":""}),t(e(p),{label:"\u64CD\u4F5C",width:"100px"},{default:r(u=>[t(e(E),{content:"\u67E5\u770B\u8BE6\u60C5"},{default:r(()=>[t(e(g),{type:"primary",link:"",icon:e(k)("eye-view"),onClick:n=>te(u.row.product_id,u.$index)},null,8,["icon","onClick"])]),_:2},1024)]),_:1})]),_:1},8,["data"])]),_:1})):f("v-if",!0),!e(q)&&e(d).data&&(e(d).data.status=="1"||e(d).data.status=="4")?(c(),h(e(w),{key:1,name:"5",title:"\u5F85\u5904\u7406\u4FE1\u606F"},{default:r(()=>[b("div",ke,[b("p",null,"\u5F85\u5904\u7406 "+T(Number(e(d).data.balance_num))+" / "+T(P.value),1),f(' <ElButton type="primary" size="small" @click="handleAddTJProduct">\u6DFB\u52A0\u8BA1\u63D0\u5546\u54C1</ElButton> ')]),t(e(re),{ref_key:"formRef",ref:I,rules:W,model:a.value},{default:r(()=>[t(s,{label:"\u64CD\u4F5C\u5546\u54C1",prop:"goods"},{default:r(()=>[t(e(j),{"span-method":Z,border:"",size:"small",data:a.value.goods},{default:r(()=>[t(e(p),{label:"\u5546\u54C1ID",prop:"id",width:"60px","show-overflow-tooltip":""}),t(e(p),{label:"\u5546\u54C1\u7F16\u53F7",prop:"skuCode","show-overflow-tooltip":""}),t(e(p),{label:"\u5546\u54C1\u540D\u79F0",prop:"goodName","show-overflow-tooltip":""}),t(e(p),{label:"\u662F\u5426\u4E3A\u8BA1\u63D0",prop:"residue_stock",width:"80px","show-overflow-tooltip":""},{default:r(({row:u})=>[$(T(u.isJT?"\u662F":"\u5426"),1)]),_:1}),t(e(p),{label:"\u7ED3\u5B58\u6570",prop:"residue_stock",width:"80px","show-overflow-tooltip":""}),t(e(p),{label:"\u64CD\u4F5C\u6570\u91CF",prop:"goodNum","show-overflow-tooltip":""}),t(e(p),{label:"\u5B50\u5546\u54C1\u7F16\u53F7",prop:"childCode","show-overflow-tooltip":""}),f(' <ElTableColumn label="\u9500\u552E\u65B9\u516C\u53F8\u7EB3\u7A0E\u8BC6\u522B\u53F7" width="140px" prop="seller_code" show-overflow-tooltip /> '),t(e(p),{label:"\u5B50\u5546\u54C1\u6BD4\u4F8B",prop:"childNum","show-overflow-tooltip":""}),t(e(p),{label:"\u5B50\u5546\u54C1\u64CD\u4F5C\u6570\u91CF",prop:"childActionNum",width:"110px","show-overflow-tooltip":""}),t(e(p),{width:"70px",label:"\u64CD\u4F5C"},{header:r(()=>[b("div",ye,[o[6]||(o[6]=b("span",null,"\u64CD\u4F5C",-1)),t(e(E),{content:"\u6DFB\u52A0",placement:"top"},{default:r(()=>[t(e(g),{link:"",size:"small",type:"primary",icon:e(k)("add"),onClick:o[0]||(o[0]=u=>{V.value=!1,N.value=!0})},null,8,["icon"])]),_:1})])]),default:r(({$index:u})=>[t(e(E),{content:"\u7F16\u8F91",placement:"top"},{default:r(()=>[t(e(g),{icon:e(k)("edits"),type:"primary",size:"small",link:"",onClick:n=>Q(u)},null,8,["icon","onClick"])]),_:2},1024),t(e(E),{content:"\u5220\u9664",placement:"top"},{default:r(()=>[t(e(g),{icon:e(k)("delete"),type:"danger",size:"small",link:"",onClick:n=>ue(u)},null,8,["icon","onClick"])]),_:2},1024)]),_:1})]),_:1},8,["data"])]),_:1}),t(s,{label:"\u5165\u8D26\u6708\u4EFD",prop:"month"},{default:r(()=>[t(_e,{placeholder:"\u5165\u8D26\u6708\u4EFD",modelValue:a.value.month,"onUpdate:modelValue":o[1]||(o[1]=u=>a.value.month=u)},null,8,["modelValue"])]),_:1})]),_:1},8,["model"]),b("div",Be,[t(e(g),{type:"primary",onClick:ee},{default:r(()=>o[7]||(o[7]=[$("\u4FDD\u5B58")])),_:1})])]),_:1})):f("v-if",!0)]),_:1},8,["modelValue"]),t(we,{visible:N.value,"onUpdate:visible":o[3]||(o[3]=u=>N.value=u),isJT:V.value,otherSearchParameter:H.value,onSubmit:Y,skuCode:G.value.length===0?"":G.value[0].skuCode},null,8,["visible","isJT","otherSearchParameter","skuCode"]),t(Ce,{data:v.data,index:v.index,visible:v.editVisible,"onUpdate:visible":o[4]||(o[4]=u=>v.editVisible=u),onSubmit:oe},null,8,["data","index","visible"]),t(i,{center:"",title:"\u5546\u54C1\u8BE6\u60C5",modelValue:A.value,"onUpdate:modelValue":o[5]||(o[5]=u=>A.value=u),style:{overflow:"hidden"}},{default:r(()=>[U((c(),R("div",null,[e(_).data?(c(),h(Fe,{key:0,data:e(_).data,num:e(d).data.ProductRela[J.value].num},null,8,["data","num"])):f("v-if",!0)])),[[m,e(_).loading]])]),_:1},8,["modelValue"])])),[[m,e(d).loading]])}}});var qe=ae(Ne,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/invoiceInOut/outManager/detail.vue"]]);export{qe as default};
|