import{d as w,r as g,a as S,v as B,o as D,g as r,J as R,K as E,z as M,k as p,w as i,e as o,b as l,c as V,H as j,x as v,S as O,l as _,ad as T,s as z,t as H,E as J,_ as K}from"./index-CUnFTKV2.js";import{d as q}from"./statistics-B7ukxmWr.js";import{b as t}from"./format-C0IiqLeQ.js";const A={class:"card-header"},F={class:"formula-section"},G={class:"formula-content"},L={key:0,class:"error-message"},P=w({__name:"IncomeSummaryCard",setup(Q,{expose:y}){const c=g(!1),s=g(null),m={todayIncome:0,rmbIncome:0,diamondIncome:0,otherIncome:0,shippedToday:0,expenses:0,todayShipped:0,remainingCoupon:0,boxRemaining:0,profit:0,formula:"收入 - 发货金额 - 用户剩余达达券 - 盒柜剩余"},e=S({...m}),b=B(()=>[{category:"收入",item:"订单收入（RMB+钻石）",value:t(e.todayIncome),isNegative:!1},{category:"收入",item:"RMB收入",value:t(e.rmbIncome),isNegative:!1},{category:"收入",item:"钻石商城收入",value:t(e.diamondIncome),isNegative:!1},{category:"收入",item:"其他收入",value:t(e.otherIncome),isNegative:!1},{category:"出货",item:"订单出货",value:t(e.shippedToday),isNegative:!1},{category:"支出",item:"支出",value:t(e.expenses),isNegative:!1},{category:"支出",item:"当天发货金额",value:t(e.todayShipped),isNegative:!1},{category:"支出",item:"当天用户剩余达达券",value:t(e.remainingCoupon),isNegative:!1},{category:"支出",item:"盒柜剩余价值",value:t(e.boxRemaining),isNegative:!1},{category:"利润",item:"利润",value:t(e.profit),isNegative:e.profit<0}]);async function d(){c.value=!0,s.value=null;try{const a=await q();a.code===0&&a.data?Object.assign(e,a.data):(s.value=a.message||"获取数据失败",Object.assign(e,m))}catch(a){console.error("加载收入汇总数据失败:",a),a instanceof Error?a.message.includes("403")||a.message.includes("权限")?s.value="无权限访问此页面":a.message.includes("network")||a.message.includes("Network")?s.value="网络连接失败，请检查网络":s.value="服务器繁忙，请稍后重试":s.value="获取数据失败",Object.assign(e,m)}finally{c.value=!1}}function h(){d(),J.info("正在刷新数据...")}return D(()=>{d()}),y({refresh:d}),(a,n)=>{const N=r("el-button"),u=r("el-table-column"),I=r("el-table"),x=r("el-icon"),C=r("el-card"),k=R("loading");return E((p(),M(C,{class:"income-summary-card"},{header:i(()=>[l("div",A,[n[1]||(n[1]=l("span",{class:"card-title"},"今日收入汇总",-1)),o(N,{type:"primary",link:"",icon:_(z),onClick:h,loading:c.value},{default:i(()=>[...n[0]||(n[0]=[H(" 刷新 ",-1)])]),_:1},8,["icon","loading"])])]),default:i(()=>[o(I,{data:b.value,border:"",stripe:"",class:"income-table"},{default:i(()=>[o(u,{prop:"category",label:"类别",width:"120"}),o(u,{prop:"item",label:"项目","min-width":"150"}),o(u,{prop:"value",label:"金额","min-width":"120",align:"right"},{default:i(({row:f})=>[l("span",{class:O({"negative-value":f.isNegative})},v(f.value),3)]),_:1})]),_:1},8,["data"]),l("div",F,[n[2]||(n[2]=l("div",{class:"formula-label"},"利润计算公式：",-1)),l("div",G,v(e.formula||"收入 - 发货金额 - 用户剩余达达券 - 盒柜剩余"),1)]),s.value?(p(),V("div",L,[o(x,null,{default:i(()=>[o(_(T))]),_:1}),l("span",null,v(s.value),1)])):j("",!0)]),_:1})),[[k,c.value]])}}}),Y=K(P,[["__scopeId","data-v-4296cb29"]]);export{Y as default};
