ProcessModal.2118d4.js 10 KB

1
  1. import{a6 as j,a7 as Y,a9 as I,aa as K,ab as W,s as Z,ac as Q,_ as J,d as ee,aV as te,w as ue,Z as oe,x as ae,A as le,z as re,r as _,aD as ne,o as F,G as y,D as n,l as t,M as T,L as q,H as G,h as S,c as P,F as L,E as U,m as g,bK as se,bO as ie,b4 as B,ar as pe,aZ as de,bP as ce,bQ as me,b7 as fe,be as O}from"./index.js";import{I as M}from"./InvoiceTitle.7da670.js";const ve={baseURL:"",timeout:1e4,headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},paramsSerializer:e=>Y.stringify(e,{indices:!1})},w=class{constructor(){this.httpInterceptorsRequest(),this.httpInterceptorsResponse()}httpInterceptorsRequest(){w.axiosInstance.interceptors.response.use(e=>e),w.axiosInstance.interceptors.request.use(e=>{const u=e;if(I.start(),typeof e.beforeRequestCallback=="function")return e.beforeRequestCallback(u),u;if(w.initConfig.beforeRequestCallback)return w.initConfig.beforeRequestCallback(u),u;const s=K(),b=W(),E=Z.state.value["pure-user"].isSuperUser;return s&&e&&e.data&&(e.data.token=s,e.data.relaComNo=e.data.relaComNo?e.data.relaComNo:b,(e.data.noRela||E)&&(e.data.relaComNo="",delete e.data.noRela),(e.data.emptyRela||E)&&(delete e.data.relaComNo,delete e.data.emptyRela)),u},e=>Promise.reject(e))}httpInterceptorsResponse(){w.axiosInstance.interceptors.response.use(u=>{const s=u.config;return I.done(),typeof s.beforeResponseCallback=="function"?(s.beforeResponseCallback(u),u.data):(w.initConfig.beforeResponseCallback&&w.initConfig.beforeResponseCallback(u),u.data)},u=>{const s=u;return s.isCancelRequest=j.isCancel(s),I.done(),Promise.reject(s)})}request(e,u,s,b){const E={method:e,url:u,...s,...b};return new Promise((R,l)=>{w.axiosInstance.request(E).then(o=>{R(o)}).catch(o=>{l(o)})})}post(e,u,s){return this.request("post",e,u,s)}get(e,u,s){return this.request("get",e,u,s)}};let V=w;V.initConfig={};V.axiosInstance=j.create(ve);const $=new V,{VITE_PROXY_DOMAIN_REAL:Ne,VITE_PROXY_USER_REAL:_e,VITE_WORKORDER_REAL:ye}=Q(),H=_e+"/admin/",be=e=>$.request("post",`${H}orderquery`,{data:e}),Ee=e=>$.request("post",`${H}orderinvadd`,{data:e}),we={class:"flex flex-col w-full"},he={class:"flex flex-col w-full"},Ce=ee({__name:"ProcessModal",props:{data:{type:Array,required:!0},visible:{type:Boolean,required:!0},companyNo:{type:String,required:!0},sellerInvoiceTitle:{type:null,required:!0},purchaserInvoiceTitle:{type:null,required:!0}},emits:["updateGroup","updateSequenceNo","download","refresh"],setup(e,{emit:u}){const s=e,b=te(s,"visible"),{logout:E}=ue(),R=()=>({email:"",invtype:"",platform_type:"",orderArr:[],remark:""}),l=oe({tableloading:!1,formloading:!1,orderData:[],currentGroup:1,groupCount:0}),o=ae({...R()});async function X(v){o.value={email:v[0].email,invtype:ce[v[0].invtype],platform_type:me[v[0].platform_type],remark:v.map(({poCode:r})=>r).join(""),orderArr:[]};const i={};for(const r of v){const{sequenceNo:d,inv_fee:c}=r;i[d]?i[d].push({inv_fee:c}):(i[d]=[],i[d].push({inv_fee:c}))}for(const r of Object.keys(i))o.value.orderArr.push({sequenceNo:r,platform_type:o.value.platform_type,inv_fee:i[r].reduce((d,c)=>Number(B(d,c.inv_fee)).toFixed(2),0)});const h={inv_is:"1",status:"3",is_comon:"1",cat_status:"2",inv_status:"0",companyNo:s.companyNo,customerNo:"GS2404151642335170",platform_type:o.value.platform_type,sequenceNo:o.value.orderArr.map(({sequenceNo:r})=>r).join(",")};try{l.tableloading=!0;const r=await be(h);if(l.tableloading=!1,r.code==0){if(r.data.length!==o.value.orderArr.length){const f=r.data.map(({sequenceNo:m})=>m),C=o.value.orderArr.map(({sequenceNo:m})=>m),p=C.filter(m=>!f.includes(m));C.filter(m=>!f.includes(m)).forEach(m=>{u("updateSequenceNo",{sequenceNo:m,remark:"\u67E5\u8BE2\u4E0D\u5230\u8BE5\u8BA2\u5355",status:3})}),p.forEach(m=>{o.value.orderArr=o.value.orderArr.filter(N=>N.sequenceNo!==m)})}const d=[];if(r.data.forEach(f=>{const C=o.value.orderArr.findIndex(({sequenceNo:z})=>z===f.sequenceNo),p=o.value.orderArr[C];f.current_inv_fee=p.inv_fee,f.current_inv_num=Number(fe(p.inv_fee,f.goodPrice)).toFixed(8),o.value.orderArr[C].num=f.current_inv_num;const{current_inv_fee:m,ainv_fee:N,inv_fee:k,apay_fee:A,sequenceNo:a}=f;Number(m)+Number(N)+Number(k)>A&&(u("updateSequenceNo",{sequenceNo:a,remark:"\u8BA2\u5355\u5DF2\u5F00\u7968\u91D1\u989D+\u672A\u5F00\u7968\u91D1\u989D+\u672C\u6B21\u5F00\u7968\u91D1\u989D\u5FC5\u987B\u5C0F\u4E8E\u6216\u7B49\u4E8E\u5DF2\u8BA4\u6B3E\u91D1\u989D",status:3}),d.push(a))}),o.value.orderArr=o.value.orderArr.filter(({sequenceNo:f})=>!d.includes(f)),o.value.orderArr.length===0){x();return}l.orderData=r.data,l.formloading=!0;const{code:c,message:D}=await Ee({...o.value,companyType:"01",buyNo:"GS2404151642335170",companyNo:s.companyNo,is_comon:"1",exam_remark:""});if(l.formloading=!1,c==0)u("updateGroup",{group:l.currentGroup,remark:"\u521B\u5EFA\u6210\u529F",status:2}),x();else if(Number(c)>=101&&Number(c)<=140){O.alert("\u4E0B\u8F7D\u5F53\u524D\u5BFC\u5165\u8FDB\u5EA6\u540E\u5C06\u4F1A\u767B\u51FA","\u767B\u5F55\u5931\u6548",{type:"error"}).then(()=>{u("download"),E()}).catch(()=>{u("download"),E()});return}else u("updateGroup",{group:l.currentGroup,remark:D,status:3}),x()}else if(Number(r.code)){O.alert("\u4E0B\u8F7D\u5F53\u524D\u5BFC\u5165\u8FDB\u5EA6\u540E\u5C06\u4F1A\u767B\u51FA","\u767B\u5F55\u5931\u6548",{type:"error"}).then(()=>{u("download"),E()}).catch(()=>{u("download"),E()});return}else u("updateGroup",{group:l.currentGroup,remark:r.message,status:3}),x()}catch(r){l.tableloading=!1,u("updateGroup",{group:l.currentGroup,remark:r.message,status:3}),x()}}function x(){const v=l.currentGroup+1;if(v>l.groupCount){b.value=!1,de.success("\u6279\u91CF\u521B\u5EFA\u5B8C\u6210");return}else u("updateGroup",{group:v,status:1,remark:""});l.currentGroup=v;const i=s.data.filter(({group:h})=>h==l.currentGroup);X(i)}return le(()=>b.value,()=>{!b.value||re(()=>{const v=[...new Set(s.data.map(({group:h})=>h))],i=Number(v[v.length-1]);l.groupCount=i,l.currentGroup=0,x()})},{immediate:!0}),(v,i)=>{const h=_("ElTag"),r=_("ElInput"),d=_("ElFormItem"),c=_("ElCol"),D=_("ElOption"),f=_("ElSelect"),C=_("ElRow"),p=_("ElTableColumn"),m=_("ElTable"),N=_("ElForm"),k=_("ElDialog"),A=ne("loading");return F(),y(k,{width:"1200px",modelValue:g(b),"onUpdate:modelValue":i[4]||(i[4]=a=>pe(b)?b.value=a:null),title:"\u5F00\u7968\u7533\u8BF7\u521B\u5EFA",center:"",top:"10px"},{default:n(()=>[t(h,{class:"font-bold mb-[10px]"},{default:n(()=>[T("\u5F53\u524D\u7B2C "+q(l.currentGroup)+" \u7EC4 , \u5171 "+q(l.groupCount)+" \u7EC4",1)]),_:1}),G((F(),y(N,null,{default:n(()=>[t(C,{gutter:10},{default:n(()=>[t(c,{span:12},{default:n(()=>[t(d,{label:"\u9500\u552E\u65B9\u516C\u53F8\u62AC\u5934"},{default:n(()=>[S("div",we,[t(r,{modelValue:(e.sellerInvoiceTitle||{}).invoice_title,class:"mb-[10px]",disabled:""},null,8,["modelValue"]),t(M,{detail:e.sellerInvoiceTitle||{}},null,8,["detail"])])]),_:1})]),_:1}),t(c,{span:12},{default:n(()=>[t(d,{label:"\u8D2D\u4E70\u65B9\u516C\u53F8\u62AC\u5934"},{default:n(()=>[S("div",he,[t(r,{modelValue:(e.purchaserInvoiceTitle||{}).invoice_title,class:"mb-[10px]",disabled:""},null,8,["modelValue"]),t(M,{detail:e.purchaserInvoiceTitle||{}},null,8,["detail"])])]),_:1})]),_:1}),t(c,{span:8},{default:n(()=>[t(d,{label:"\u53D1\u7968\u7C7B\u578B"},{default:n(()=>[t(f,{modelValue:o.value.invtype,"onUpdate:modelValue":i[0]||(i[0]=a=>o.value.invtype=a),class:"w-full",disabled:""},{default:n(()=>[(F(!0),P(L,null,U(g(se),a=>(F(),y(D,{value:a.value,label:a.label,key:a.value},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),t(c,{span:8},{default:n(()=>[t(d,{label:"\u7535\u5B50\u90AE\u7BB1"},{default:n(()=>[t(r,{modelValue:o.value.email,"onUpdate:modelValue":i[1]||(i[1]=a=>o.value.email=a),disabled:""},null,8,["modelValue"])]),_:1})]),_:1}),t(c,{span:8},{default:n(()=>[t(d,{label:"\u5E73\u53F0\u7C7B\u578B"},{default:n(()=>[t(f,{modelValue:o.value.platform_type,"onUpdate:modelValue":i[2]||(i[2]=a=>o.value.platform_type=a),class:"w-full",disabled:""},{default:n(()=>[(F(!0),P(L,null,U(g(ie),a=>(F(),y(D,{value:a.value,label:a.label,key:a.value},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),t(c,{span:24},{default:n(()=>[t(d,{label:"\u53D1\u7968\u5907\u6CE8"},{default:n(()=>[t(r,{modelValue:o.value.remark,"onUpdate:modelValue":i[3]||(i[3]=a=>o.value.remark=a),disabled:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),G((F(),y(m,{border:"",size:"small",data:l.orderData},{default:n(()=>[t(p,{label:"\u4EA7\u54C1\u7F16\u53F7",width:"120px",prop:"goodNo","show-overflow-tooltip":""}),t(p,{label:"\u5546\u54C1\u540D\u79F0",width:"120px",prop:"goodName","show-overflow-tooltip":""}),t(p,{label:"\u5F00\u7968\u5546\u54C1\u540D\u79F0","show-overflow-tooltip":"",prop:"inv_good_name",width:"140px"}),t(p,{label:"\u54C1\u724C",width:"60px",prop:"goodBrand","show-overflow-tooltip":""}),t(p,{label:"\u5355\u4F4D",width:"60px",prop:"goodUnit","show-overflow-tooltip":""}),t(p,{label:"\u5355\u4EF7",width:"60px",prop:"goodPrice","show-overflow-tooltip":""}),t(p,{label:"\u6570\u91CF",align:"center"},{default:n(()=>[t(p,{label:"\u603B\u8BA1",width:"80px","show-overflow-tooltip":""},{default:n(({row:a})=>[T(q(Number(g(B)(Number(g(B)(a.inv_num,a.winv_num)).toFixed(2),a.current_inv_num)).toFixed(8)),1)]),_:1}),t(p,{label:"\u5DF2\u6838\u9500",prop:"inv_num",width:"80px","show-overflow-tooltip":""}),t(p,{label:"\u672A\u6838\u9500",prop:"winv_num",width:"80px","show-overflow-tooltip":""}),t(p,{label:"\u6B64\u6B21\u6838\u9500",prop:"current_inv_num",width:"80px","show-overflow-tooltip":""})]),_:1}),t(p,{label:"\u603B\u4EF7",width:"80px","show-overflow-tooltip":""},{default:n(({row:a})=>[T(q(Number(g(B)(Number(g(B)(a.inv_fee,a.winv_fee)).toFixed(2),a.current_inv_fee)).toFixed(2)),1)]),_:1}),t(p,{label:"\u5173\u8054\u53D1\u7968\u4FE1\u606F",align:"center"},{default:n(()=>[t(p,{label:"\u5DF2\u6838\u9500\u91D1\u989D",prop:"inv_fee",width:"100px","show-overflow-tooltip":""}),t(p,{label:"\u672A\u6838\u9500\u91D1\u989D",prop:"winv_fee",width:"100px","show-overflow-tooltip":""}),t(p,{label:"\u6B64\u6B21\u6838\u9500\u91D1\u989D",prop:"current_inv_fee",width:"100px","show-overflow-tooltip":""})]),_:1})]),_:1},8,["data"])),[[A,l.tableloading]])]),_:1})),[[A,l.formloading]])]),_:1},8,["modelValue"])}}});var Be=J(Ce,[["__file","C:/Users/63107/Desktop/mine/settle-vue3/src/views/InvoiceSales/batchImportYunlong/ProcessModal.vue"]]);export{Be as default};