import{_ as X,d as Z,aG as q,m as Y,Q as H,w as tt,r as G,o as Q,A as et,x as y,e as R,a as ot,f as c,G as x,h,H as S,c as ut,F as at,y as lt}from"./index.js";import{b as j,h as I}from"./index.6036f908.js";import{a as f,s as T,m as k,d as w,u as n,f as E}from"./calc.850c7422.js";const nt={\u6CD3\u6E90:"\u6CD3\u6E90\u5E7F\u8BDA",\u767E\u8FB0:"\u767E\u8FB0\u8363\u8FBE",\u666E\u6DA6:"\u666E\u6DA6\u5FC3\u5802&\u9526\u5174\u5F18\u660C"},st=[{label:"\u90E8\u95E8",prop:"depart",cellRenderer({row:t}){const m=nt[t.depart];return m||t.depart}},{label:"\u672C\u65E5\u9500\u552E\u989D",prop:"sale_total",cellRenderer({row:t}){return n(t.dayinfo.sale_total)}},{label:"\u672C\u6708\u91D1\u989D",prop:"total_tips",align:"center",children:[{label:"\u9500\u552E\u6307\u6807",prop:"total_tips",cellRenderer({row:t}){return n(t.total_tips)}},{label:"\u51C0\u9500\u552E",prop:"monthNetSales",cellRenderer({row:t}){return n(t.monthinfo.monthNetSales)}},{label:"\u51C0\u9500\u552E\u5B8C\u6210\u7387",prop:"pure_month_sale",cellRenderer({row:t}){return t.monthinfo.monthProportion+"%"}}]}],M={title:"",superUserNoAction:!1,handleData(t=[]){const m=t.map(({depart:r,msale_total:o,mth_total:d,sale_total:_,th_total:l,total_tips:u})=>({depart:r,total_tips:u,dayinfo:{sale_total:_,th_total:l},monthinfo:{msale_total:o,mth_total:d}})),C=m.reduce((r,o)=>{const{total_tips:d=0,day:_=0,month:l=0}=o;return{total_tips:f(d,r.total_tips),month:f(l,r.month),day:f(_,r.day)}},{total_tips:0,month:0,day:0});return m.map(({depart:r,total_tips:o,dayinfo:d,monthinfo:_})=>{const l=T(_.msale_total,_.mth_total),u=k(w(l,o),100).toFixed(2);return{depart:r,total_tips:o,dayinfo:{...d,sale_total:T(d.sale_total,d.th_total)},monthinfo:{monthNetSales:l,monthProportion:u},proportion:k(w(_.msale_total,C.month)||0,100)||0}})},columns:st,apis:{httpList:t=>j({...t,companyNo:"GS2203161855277894"})}},rt={\u6CD3\u6E90:"\u6CD3\u6E90\u5E7F\u8BDA",\u767E\u8FB0:"\u767E\u8FB0\u8363\u8FBE",\u666E\u6DA6:"\u666E\u6DA6\u5FC3\u5802&\u9526\u5174\u5F18\u660C"},it=[{label:"\u90E8\u95E8",prop:"depart",cellRenderer({row:t}){const m=rt[t.depart];return m||t.depart}},{label:"\u672C\u65E5\u9500\u552E\u989D",prop:"sale_total",cellRenderer({row:t}){return n(t.dayinfo.sale_total)}},{label:"\u672C\u6708\u91D1\u989D",prop:"total_tips",align:"center",children:[{label:"\u9500\u552E\u6307\u6807",prop:"total_tips",cellRenderer({row:t}){return n(t.total_tips)}},{label:"\u51C0\u9500\u552E",prop:"monthNetSales",cellRenderer({row:t}){return n(t.monthinfo.monthNetSales)}},{label:"\u51C0\u9500\u552E\u5B8C\u6210\u7387",prop:"pure_month_sale",cellRenderer({row:t}){return t.monthinfo.monthProportion+"%"}}]}],V={title:"",superUserNoAction:!1,handleData(t=[],m={}){return new Promise(C=>{I({daytime:m.daytime}).then(r=>{if(Number(r.code)===0){const o=r.data.reduce((l,u)=>({...l,[u.companyName]:T(u.monthinfo[2].msale_total,u.monthinfo[2].mth_total)}),{}),d=r.data.reduce((l,u)=>({...l,[u.companyName]:T(u.dayinfo[2].sale_total,u.dayinfo[2].th_total)}),{});let _=t.map(({depart:l,msale_total:u,mth_total:F,sale_total:p,th_total:i,total_tips:b})=>({depart:l,total_tips:b,dayinfo:{sale_total:p,th_total:i},monthinfo:{msale_total:u,mth_total:F}}));_=["\u767E\u8FB0","\u6CD3\u6E90","\u666E\u6DA6","\u5E73\u53F0"].map(l=>_.find(({depart:u})=>u===l)),this.total=_.reduce((l,u)=>{const{total_tips:F=0,day:p=0,month:i=0}=u;return{total_tips:f(F,l.total_tips),month:f(i,l.month),day:f(p,l.day)}},{total_tips:0,month:0,day:0}),_=_.map(({depart:l,total_tips:u,dayinfo:F,monthinfo:p})=>{let i=T(p.msale_total,p.mth_total),b=T(F.sale_total,F.th_total);const v=Object.keys(o).find(s=>s.includes(l)),z=Object.keys(d).find(s=>s.includes(l));v&&(i=f(i,o[v])),z&&(b=f(b,d[z])),v==="\u5317\u4EAC\u666E\u6DA6\u5FC3\u5802\u5546\u8D38\u6709\u9650\u516C\u53F8"&&(i=f(i,o.\u5317\u4EAC\u9526\u5174\u5F18\u660C\u79D1\u6280\u6709\u9650\u516C\u53F8)),z==="\u5317\u4EAC\u666E\u6DA6\u5FC3\u5802\u5546\u8D38\u6709\u9650\u516C\u53F8"&&(b=f(b,d.\u5317\u4EAC\u9526\u5174\u5F18\u660C\u79D1\u6280\u6709\u9650\u516C\u53F8));const e=k(w(i,u),100).toFixed(2);return{depart:l,total_tips:u,dayinfo:{...F,sale_total:b},monthinfo:{monthNetSales:i,monthProportion:e},proportion:k(w(p.msale_total,this.total.month)||0,100)||0}}),C(_)}})})},columns:it,apis:{httpList:t=>j({...t,companyNo:"GS2203161855277894"})}},mt={\u6CD3\u6E90:"\u6CD3\u6E90\u5E7F\u8BDA",\u767E\u8FB0:"\u767E\u8FB0\u8363\u8FBE",\u666E\u6DA6:"\u666E\u6DA6\u5FC3\u5802&\u9526\u5174\u5F18\u660C"},pt=[{label:"\u4E1A\u52A1\u516C\u53F8",prop:"depart",cellRenderer({row:t}){const m=mt[t.depart];return m||t.depart}},{label:"\u4E1A\u7EE9\u7C7B\u578B",prop:"type"},{label:"\u65E5\u51C0\u9500\u552E\u989D",prop:"day",cellRenderer({row:t}){return n(t.day)}},{label:"\u6708\u51C0\u9500\u552E\u989D",prop:"month",cellRenderer({row:t}){return n(t.month)}},{label:"\u672C\u6708\u6BDB\u5229\u7387",prop:"proportion",cellRenderer({row:t}){return Number(t.proportion||0).toFixed(2)+"%"}}],L={title:"",superUserNoAction:!1,handleData(t=[]){return t.reduce((m,C)=>{const{mzy_sale_total:r,zy_sale_total:o,mchannel_sale_total:d,channel_sale_total:_}=C,l=f(d,r)||0,u=k(w(r,l)||0,100).toFixed(2);let F;return Number(u)===0?F=k(w(d,l)||0,100)!==0?Number(100-Number(u)).toFixed(2):0:F=Number(100-Number(u)).toFixed(2),[...m,{depart:C.depart,type:"\u76F4\u8425",month:r,day:o,proportion:u},{depart:C.depart,type:"\u6E20\u9053",month:d,day:_,proportion:F}]},[])},columns:pt,apis:{httpList:t=>j({...t,companyNo:"GS2203161855277894"})}},J={1:"\u81EA\u8425",2:"\u6E20\u9053",3:"\u4F9B\u5E94\u5546\u7AEF"},U=[{label:"\u4E1A\u7EE9\u7C7B\u578B",prop:"type",cellRenderer({row:t}){return J[t.type]||"--"}},{label:"\u672C\u65E5\u9500\u552E\u989D",prop:"sale_total",cellRenderer({row:t}){return n(t.dayinfo.sale_total)}},{label:"\u672C\u6708\u9500\u552E\u989D",prop:"month",cellRenderer({row:t}){return n(t.monthinfo.msale_total)}},{label:"\u6708\u5360\u6BD4",prop:"proportion",cellRenderer({row:t}){return Number(t.proportion||0).toFixed(2)+"%"}}],ct=function(t){let m,C;const r=Date.parse(t),o=Date.parse("2023-04-17 00:00:00");return C=r-o,m=Math.floor(C/(1e3*3600*24)),m},dt=t=>({title:"",superUserNoAction:!1,handleData(m=[],C={}){const r=C.daytime?ct(C.daytime)<0&&C.companyNo==="GS2302231323386950":!1,{monthinfo:o=[],dayinfo:d=[],total_tips:_=0}=m[0]||[];o[1]={...r?{msale_total:f(o[1].msale_total,o[2].msale_total),mth_total:f(o[1].mth_total,o[2].mth_total),type:"2"}:o[1]},o[0]={...r?{msale_total:0,mth_total:0,type:"1"}:o[0]},o[2]={...r?{msale_total:0,mth_total:0,type:"3"}:o[2]};const l=Object.keys(J),u={total_tips:Number(_),day:d.reduce((p,{sale_total:i="0"})=>f(p,i),0),month:o.reduce((p,{msale_total:i="0"})=>f(p,i),0),monthReturn:o.reduce((p,{mth_total:i="0"})=>f(p,i),0)};return l.map(p=>{const i=o.find(e=>String(e.type)===p)||{},b=d.find(e=>String(e.type)===p)||{},v=T(i.msale_total,i.mth_total)||0,z=T(u.month,u.monthReturn);return{type:p,total_tips:u.total_tips,dayinfo:{...b,sale_total:T(b.sale_total,b.th_total)||0},monthinfo:{...i,msale_total:v},proportion:k(w(v,Number(z).toFixed(2))||0,100).toFixed(2)}})},columns:U,apis:{httpList:(m={})=>I({...m,companyNo:t})}}),_t={class:"bg-white"},ft={"w-full":"",flex:"","justify-end":"","p-2":"","items-center":""},yt={class:"ml-[15px]"},ht={style:{"font-size":"20px","font-weight":"700","margin-bottom":"10px"}},Et={class:"mx-[12px] mb-[-15px]"},Ct={class:"mx-[12px] mb-[-15px]"},Dt={class:"ml-15px",style:{"line-height":"32px"}},Ft={class:"mx-[12px] mb-[-15px]"},bt="grossMargin",Nt=Z({__name:"index",setup(t){const m=e=>o.value?n(e):E(e);V.columns[1].cellRenderer=({row:e})=>m(e.dayinfo.sale_total),V.columns[1].cellRenderer=({row:e})=>o.value?n(e.dayinfo.sale_total):E(e.dayinfo.sale_total),V.columns[2].children[0].cellRenderer=({row:e})=>o.value?n(e.total_tips):E(e.total_tips),V.columns[2].children[1].cellRenderer=({row:e})=>o.value?n(e.monthinfo.monthNetSales):E(e.monthinfo.monthNetSales),M.columns[1].cellRenderer=({row:e})=>o.value?n(e.dayinfo.sale_total):E(e.dayinfo.sale_total),M.columns[2].children[0].cellRenderer=({row:e})=>o.value?n(e.total_tips):E(e.total_tips),M.columns[2].children[1].cellRenderer=({row:e})=>o.value?n(e.monthinfo.monthNetSales):E(e.monthinfo.monthNetSales),L.columns[2].cellRenderer=({row:e})=>o.value?n(e.day):E(e.day),L.columns[3].cellRenderer=({row:e})=>o.value?n(e.month):E(e.month),U[1].cellRenderer=({row:e})=>o.value?n(e.dayinfo.sale_total):E(e.dayinfo.sale_total),U[2].cellRenderer=({row:e})=>o.value?n(e.monthinfo.msale_total):E(e.monthinfo.msale_total);const C=[{companyNo:"GS2302231125079621",companyName:"\u5317\u4EAC\u767E\u8FB0\u8363\u8FBE\u56FD\u9645\u79D1\u8D38\u6709\u9650\u516C\u53F8"},{companyNo:"GS2302231323386950",companyName:"\u5317\u4EAC\u6CD3\u6E90\u5E7F\u8BDA\u56FD\u9645\u5546\u8D38\u6709\u9650\u516C\u53F8"},{companyNo:"GS2304031312553746",companyName:"\u5317\u4EAC\u9526\u5174\u5F18\u660C\u79D1\u6280\u6709\u9650\u516C\u53F8"},{companyNo:"GS2302231124114965",companyName:"\u5317\u4EAC\u666E\u6DA6\u5FC3\u5802\u5546\u8D38\u6709\u9650\u516C\u53F8"},{companyNo:"GS2203161855277894",companyName:"\u5317\u4EAC\u4E07\u5B87\u6052\u901A\u56FD\u9645\u79D1\u8D38\u6709\u9650\u516C\u53F8"}],r=q(""),o=q(!0),d=Y(null),_=Y(null),l=Y(null),u=Y([]),F=function(){let e=new Date,s=e.getFullYear(),N=e.getMonth()+1,g=e.getDate();return s+"-"+(N<10?"0"+N:N)+"-"+(g<10?"0"+g:g)},p={total_tips:0,sale_total:0,completionRate:0},i=H({wanyu:{...p},wanyuCompletion:{...p}}),b=H(C.reduce((e,{companyNo:s})=>({...e,[s]:{...p}}),{})),v=function(e=[],s){i[s]=e.reduce((N,g)=>{const D=f(N.total_tips,g.total_tips),A=f(N.sale_total,g.monthinfo.monthNetSales),P=k(w(A,D),100);return{total_tips:D,sale_total:A,completionRate:P}},p)},z=function(e=[],s){b[s]=e.reduce((N,g)=>{const D=Number(g.total_tips),A=f(N.sale_total,g.monthinfo.msale_total),P=k(w(A,D)||0,100);return{total_tips:D,sale_total:A,completionRate:P}},p)};return tt(()=>r.value,e=>{[l.value,d.value,_.value,...u.value].forEach(s=>{if(!s)return;const N=s.getContent();!N||N.value.getPageData({daytime:e})})}),r.value=F(),(e,s)=>{const N=G("ElSwitch"),g=G("ElDatePicker"),D=G("ElTableColumn"),A=G("ElTable"),P=G("PageContainer"),$=G("ElCol"),O=G("ElRow"),K=G("PageAuth");return Q(),et(K,{pageName:bt},{default:y(()=>[R("div",_t,[R("div",ft,[ot(` \r \r \u663E\u793A{{ isTenThound ? '\u5143' : '\u4E07\u5143' }}\r \r `),s[2]||(s[2]=R("p",{class:"mr-[5px]",style:{"font-weight":"700"}},"\u663E\u793A\u5355\u4F4D:",-1)),c(N,{class:"mr-[15px]",modelValue:o.value,"onUpdate:modelValue":s[0]||(s[0]=a=>o.value=a),size:"large","active-text":"\u4E07\u5143","inactive-text":"\u5143"},null,8,["modelValue"]),c(g,{modelValue:r.value,"onUpdate:modelValue":s[1]||(s[1]=a=>r.value=a),"value-format":"YYYY-MM-DD",format:"YYYY-MM-DD",type:"date",placeholder:"\u9009\u62E9\u65E5\u671F",disabledDate:a=>a.getTime()>Date.now()},null,8,["modelValue","disabledDate"])]),R("div",yt,[R("h2",ht," \u6574\u4F53\u641E\u4E86 "+x(o.value?h(n)(i.wanyuCompletion.sale_total):h(E)(i.wanyuCompletion.sale_total))+" \u5143\uFF08\u4E07\u5B87\u5E73\u53F0+\u4E1A\u52A1\u516C\u53F8\u4F9B\u5E94\u5546\u7AEF\uFF09 ",1)]),R("div",Et,[c(A,{border:"",size:"small",data:[i.wanyuCompletion]},{default:y(()=>[c(D,{label:"\u6708\u6307\u6807"},{default:y(({row:a})=>[S(x(o.value?h(n)(a.total_tips):h(E)(a.total_tips)),1)]),_:1}),c(D,{label:"\u5B8C\u6210\u989D"},{default:y(({row:a})=>[S(x(o.value?h(n)(a.sale_total):h(E)(a.sale_total)),1)]),_:1}),c(D,{label:"\u5B8C\u6210\u7387"},{default:y(({row:a})=>[S(x(Number(a.completionRate).toFixed(2)+"%"),1)]),_:1})]),_:1},8,["data"])]),c(P,{ref_key:"wanyuCompletionReportRef",ref:d,contentConfig:h(V),events:{content:{handleResult:a=>v(a,"wanyuCompletion")}}},null,8,["contentConfig","events"]),s[4]||(s[4]=R("h2",{style:{"font-size":"20px","font-weight":"700","margin-bottom":"10px","margin-left":"15px"}}," \u5E73\u53F0\u7EF4\u5EA6 ",-1)),c(O,{style:{overflow:"hidden"}},{default:y(()=>[c($,{xs:24,sm:24,md:12,lg:12,xl:12},{default:y(()=>[s[3]||(s[3]=R("p",{class:"ml-[15px]",style:{"line-height":"42px"}}," \u5317\u4EAC\u4E07\u5B87\u6052\u901A\u56FD\u9645\u79D1\u8D38\u6709\u9650\u516C\u53F8 ",-1)),R("div",Ct,[c(A,{border:"",size:"small",data:[i.wanyu]},{default:y(()=>[c(D,{label:"\u6708\u6307\u6807"},{default:y(({row:a})=>[S(x(o.value?h(n)(a.total_tips):h(E)(a.total_tips)),1)]),_:1}),c(D,{label:"\u5B8C\u6210\u989D"},{default:y(({row:a})=>[S(x(o.value?h(n)(a.sale_total):h(E)(a.sale_total)),1)]),_:1}),c(D,{label:"\u5B8C\u6210\u7387"},{default:y(({row:a})=>[S(x(Number(a.completionRate).toFixed(2)+"%"),1)]),_:1})]),_:1},8,["data"])]),c(P,{ref_key:"wanyuReportRef",ref:l,contentConfig:h(M),events:{content:{handleResult:a=>v(a,"wanyu")}}},null,8,["contentConfig","events"])]),_:1}),c($,{xs:24,sm:24,md:12,lg:12,xl:12},{default:y(()=>[c(P,{ref_key:"wanyuTypeReportRef",ref:_,contentConfig:h(L)},null,8,["contentConfig"])]),_:1})]),_:1}),s[5]||(s[5]=R("h2",{style:{"font-size":"20px","font-weight":"700","margin-bottom":"10px","margin-left":"15px"}}," \u516C\u53F8\u7EF4\u5EA6 ",-1)),c(O,{style:{overflow:"hidden"}},{default:y(()=>[(Q(),ut(at,null,lt(C,(a,W)=>c($,{xs:24,sm:24,md:12,lg:12,xl:12,key:a.companyNo},{default:y(()=>[R("div",Dt,x(W+1)+"."+x(a.companyName||"--"),1),R("div",Ft,[c(A,{border:"",size:"small",data:[b[a.companyNo]]},{default:y(()=>[c(D,{label:"\u6708\u6307\u6807"},{default:y(({row:B})=>[S(x(o.value?h(n)(B.total_tips):h(E)(B.total_tips)),1)]),_:1}),c(D,{label:"\u5B8C\u6210\u989D"},{default:y(({row:B})=>[S(x(o.value?h(n)(B.sale_total):h(E)(B.sale_total)),1)]),_:1}),c(D,{label:"\u5B8C\u6210\u7387"},{default:y(({row:B})=>[S(x(Number(B.completionRate).toFixed(2)+"%"),1)]),_:1})]),_:2},1032,["data"])]),c(P,{ref_for:!0,ref_key:"dashboardRef",ref:u,contentConfig:h(dt)(a.companyNo),events:{content:{handleResult:B=>z(B,a.companyNo)}}},null,8,["contentConfig","events"])]),_:2},1024)),64))]),_:1})])]),_:1})}}});var vt=X(Nt,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/dashboard/performanceReport/index.vue"]]);export{vt as default};