import{_ as O,d as q,b1 as Z,w as z,Z as L,z as H,r as P,o as $,G as I,C as y,b as R,l as p,u as b,aq as J,L as N,M as A,c as K,F as Q,D as W}from"./index.0bc83371.js";import{b as M,h as G}from"./index.3acce32e.js";import{a as _,s as B,m as w,d as v,u as D}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 D(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 D(t.total_tips)}},{label:"\u51C0\u9500\u552E",prop:"monthNetSales",cellRenderer({row:t}){return D(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:a,msale_total:e,mth_total:i,sale_total:m,th_total:u,total_tips:o})=>({depart:a,total_tips:o,dayinfo:{sale_total:m,th_total:u},monthinfo:{msale_total:e,mth_total:i}})),E=l.reduce((a,e)=>{const{total_tips:i=0,day:m=0,month:u=0}=e;return{total_tips:_(i,a.total_tips),month:_(u,a.month),day:_(m,a.day)}},{total_tips:0,month:0,day:0});return l.map(({depart:a,total_tips:e,dayinfo:i,monthinfo:m})=>{const u=B(m.msale_total,m.mth_total),o=w(v(u,e),100).toFixed(2);return{depart:a,total_tips:e,dayinfo:{...i,sale_total:B(i.sale_total,i.th_total)},monthinfo:{monthNetSales:u,monthProportion:o},proportion:w(v(m.msale_total,E.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"},ut=[{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 D(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 D(t.total_tips)}},{label:"\u51C0\u9500\u552E",prop:"monthNetSales",cellRenderer({row:t}){return D(t.monthinfo.monthNetSales)}},{label:"\u51C0\u9500\u552E\u5B8C\u6210\u7387",prop:"pure_month_sale",cellRenderer({row:t}){return t.monthinfo.monthProportion+"%"}}]}],at={title:"",superUserNoAction:!1,handleData(t=[],l={}){return new Promise(E=>{G({daytime:l.daytime}).then(a=>{if(Number(a.code)===0){const e=a.data.reduce((u,o)=>({...u,[o.companyName]:B(o.monthinfo[2].msale_total,o.monthinfo[2].mth_total)}),{}),i=a.data.reduce((u,o)=>({...u,[o.companyName]:B(o.dayinfo[2].sale_total,o.dayinfo[2].th_total)}),{});let m=t.map(({depart:u,msale_total:o,mth_total:f,sale_total:s,th_total:r,total_tips:F})=>({depart:u,total_tips:F,dayinfo:{sale_total:s,th_total:r},monthinfo:{msale_total:o,mth_total:f}}));m=["\u767E\u8FB0","\u6CD3\u6E90","\u666E\u6DA6","\u5E73\u53F0"].map(u=>m.find(({depart:o})=>o===u)),this.total=m.reduce((u,o)=>{const{total_tips:f=0,day:s=0,month:r=0}=o;return{total_tips:_(f,u.total_tips),month:_(r,u.month),day:_(s,u.day)}},{total_tips:0,month:0,day:0}),m=m.map(({depart:u,total_tips:o,dayinfo:f,monthinfo:s})=>{let r=B(s.msale_total,s.mth_total),F=B(f.sale_total,f.th_total);const S=Object.keys(e).find(C=>C.includes(u)),h=Object.keys(i).find(C=>C.includes(u));S&&(r=_(r,e[S])),h&&(F=_(F,i[h])),S==="\u5317\u4EAC\u666E\u6DA6\u5FC3\u5802\u5546\u8D38\u6709\u9650\u516C\u53F8"&&(r=_(r,e.\u5317\u4EAC\u9526\u5174\u5F18\u660C\u79D1\u6280\u6709\u9650\u516C\u53F8)),h==="\u5317\u4EAC\u666E\u6DA6\u5FC3\u5802\u5546\u8D38\u6709\u9650\u516C\u53F8"&&(F=_(F,i.\u5317\u4EAC\u9526\u5174\u5F18\u660C\u79D1\u6280\u6709\u9650\u516C\u53F8));const c=w(v(r,o),100).toFixed(2);return{depart:u,total_tips:o,dayinfo:{...f,sale_total:F},monthinfo:{monthNetSales:r,monthProportion:c},proportion:w(v(s.msale_total,this.total.month)||0,100)||0}}),E(m)}})})},columns:ut,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 D(t.day)}},{label:"\u6708\u51C0\u9500\u552E\u989D",prop:"month",cellRenderer({row:t}){return D(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,E)=>{const{mzy_sale_total:a,zy_sale_total:e,mchannel_sale_total:i,channel_sale_total:m}=E,u=_(i,a)||0,o=w(v(a,u)||0,100).toFixed(2);let f;return Number(o)===0?f=w(v(i,u)||0,100)!==0?Number(100-Number(o)).toFixed(2):0:f=Number(100-Number(o)).toFixed(2),[...l,{depart:E.depart,type:"\u76F4\u8425",month:a,day:e,proportion:o},{depart:E.depart,type:"\u6E20\u9053",month:i,day:m,proportion:f}]},[])},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 D(t.dayinfo.sale_total)}},{label:"\u672C\u6708\u9500\u552E\u989D",prop:"month",cellRenderer({row:t}){return D(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,E;const a=Date.parse(t),e=Date.parse("2023-04-17 00:00:00");return E=a-e,l=Math.floor(E/(1e3*3600*24)),l},it=t=>({title:"",superUserNoAction:!1,handleData(l=[],E={}){const a=E.daytime?pt(E.daytime)<0&&E.companyNo==="GS2302231323386950":!1,{monthinfo:e=[],dayinfo:i=[],total_tips:m=0}=l[0]||[];e[1]={...a?{msale_total:_(e[1].msale_total,e[2].msale_total),mth_total:_(e[1].mth_total,e[2].mth_total),type:"2"}:e[1]},e[0]={...a?{msale_total:0,mth_total:0,type:"1"}:e[0]},e[2]={...a?{msale_total:0,mth_total:0,type:"3"}:e[2]};const u=Object.keys(U),o={total_tips:Number(m),day:i.reduce((s,{sale_total:r="0"})=>_(s,r),0),month:e.reduce((s,{msale_total:r="0"})=>_(s,r),0),monthReturn:e.reduce((s,{mth_total:r="0"})=>_(s,r),0)};return u.map(s=>{const r=e.find(c=>String(c.type)===s)||{},F=i.find(c=>String(c.type)===s)||{},S=B(r.msale_total,r.mth_total)||0,h=B(o.month,o.monthReturn);return{type:s,total_tips:o.total_tips,dayinfo:{...F,sale_total:B(F.sale_total,F.th_total)||0},monthinfo:{...r,msale_total:S},proportion:w(v(S,Number(h).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"}},Ft={class:"mx-[12px] mb-[-15px]"},bt=q({__name:"index",setup(t){const l="grossMargin",E=[{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"}],a=Z(""),e=z(null),i=z(null),m=z(null),u=z([]),o=function(){let h=new Date,c=h.getFullYear(),C=h.getMonth()+1,d=h.getDate();return c+"-"+(C<10?"0"+C:C)+"-"+(d<10?"0"+d:d)},f={total_tips:0,sale_total:0,completionRate:0},s=L({wanyu:{...f},wanyuCompletion:{...f}}),r=L(E.reduce((h,{companyNo:c})=>({...h,[c]:{...f}}),{})),F=function(h=[],c){s[c]=h.reduce((C,d)=>{const x=_(C.total_tips,d.total_tips),g=_(C.sale_total,d.monthinfo.monthNetSales),k=w(v(g,x),100);return{total_tips:x,sale_total:g,completionRate:k}},f)},S=function(h=[],c){r[c]=h.reduce((C,d)=>{const x=Number(d.total_tips),g=_(C.sale_total,d.monthinfo.msale_total),k=w(v(g,x)||0,100);return{total_tips:x,sale_total:g,completionRate:k}},f)};return H(()=>a.value,h=>{[m.value,e.value,i.value,...u.value].forEach(c=>{if(!c)return;const C=c.getContent();!C||C.value.getPageData({daytime:h})})}),a.value=o(),(h,c)=>{const C=P("ElDatePicker"),d=P("ElTableColumn"),x=P("ElTable"),g=P("PageContainer"),k=P("ElCol"),Y=P("ElRow"),V=P("PageAuth");return $(),I(V,{pageName:l},{default:y(()=>[R("div",mt,[R("div",ct,[p(C,{modelValue:b(a),"onUpdate:modelValue":c[0]||(c[0]=n=>J(a)?a.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," \u6574\u4F53\u641E\u4E86 "+N(b(D)(s.wanyuCompletion.sale_total))+" \u5143\uFF08\u4E07\u5B87\u5E73\u53F0+\u4E1A\u52A1\u516C\u53F8\u4F9B\u5E94\u5546\u7AEF\uFF09 ",1)]),R("div",ft,[p(x,{border:"",size:"small",data:[s.wanyuCompletion]},{default:y(()=>[p(d,{label:"\u6708\u6307\u6807"},{default:y(({row:n})=>[A(N(b(D)(n.total_tips)),1)]),_:1}),p(d,{label:"\u5B8C\u6210\u989D"},{default:y(({row:n})=>[A(N(b(D)(n.sale_total)),1)]),_:1}),p(d,{label:"\u5B8C\u6210\u7387"},{default:y(({row:n})=>[A(N(Number(n.completionRate).toFixed(2)+"%"),1)]),_:1})]),_:1},8,["data"])]),p(g,{ref_key:"wanyuCompletionReportRef",ref:e,contentConfig:b(at),events:{content:{handleResult:n=>F(n,"wanyuCompletion")}}},null,8,["contentConfig","events"]),ht,p(Y,{style:{overflow:"hidden"}},{default:y(()=>[p(k,{xs:24,sm:24,md:12,lg:12,xl:12},{default:y(()=>[yt,R("div",Et,[p(x,{border:"",size:"small",data:[s.wanyu]},{default:y(()=>[p(d,{label:"\u6708\u6307\u6807"},{default:y(({row:n})=>[A(N(b(D)(n.total_tips)),1)]),_:1}),p(d,{label:"\u5B8C\u6210\u989D"},{default:y(({row:n})=>[A(N(b(D)(n.sale_total)),1)]),_:1}),p(d,{label:"\u5B8C\u6210\u7387"},{default:y(({row:n})=>[A(N(Number(n.completionRate).toFixed(2)+"%"),1)]),_:1})]),_:1},8,["data"])]),p(g,{ref_key:"wanyuReportRef",ref:m,contentConfig:b(et),events:{content:{handleResult:n=>F(n,"wanyu")}}},null,8,["contentConfig","events"])]),_:1}),p(k,{xs:24,sm:24,md:12,lg:12,xl:12},{default:y(()=>[p(g,{ref_key:"wanyuTypeReportRef",ref:i,contentConfig:b(st)},null,8,["contentConfig"])]),_:1})]),_:1}),Ct,p(Y,{style:{overflow:"hidden"}},{default:y(()=>[($(),K(Q,null,W(E,(n,j)=>p(k,{xs:24,sm:24,md:12,lg:12,xl:12,key:n.companyNo},{default:y(()=>[R("div",Dt,N(j+1)+"."+N(n.companyName||"--"),1),R("div",Ft,[p(x,{border:"",size:"small",data:[r[n.companyNo]]},{default:y(()=>[p(d,{label:"\u6708\u6307\u6807"},{default:y(({row:T})=>[A(N(b(D)(T.total_tips)),1)]),_:1}),p(d,{label:"\u5B8C\u6210\u989D"},{default:y(({row:T})=>[A(N(b(D)(T.sale_total)),1)]),_:1}),p(d,{label:"\u5B8C\u6210\u7387"},{default:y(({row:T})=>[A(N(Number(T.completionRate).toFixed(2)+"%"),1)]),_:1})]),_:2},1032,["data"])]),p(g,{ref_for:!0,ref_key:"dashboardRef",ref:u,contentConfig:b(it)(n.companyNo),events:{content:{handleResult:T=>S(T,n.companyNo)}}},null,8,["contentConfig","events"])]),_:2},1024)),64))]),_:1})])]),_:1})}}});var xt=O(bt,[["__file","C:/Users/63107/Desktop/projects/accout-vue3-ui/src/views/dashboard/performanceReport/index.vue"]]);export{xt as default};