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