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