ProcessModal.45259b.js 12 KB

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