import{d as D,r as p,a as M,v as N,o as V,g as r,J as R,K as T,z as U,k as _,w as n,e as o,c as A,H as B,b as g,l as v,ad as E,x as S,s as j,t as H,E as I,_ as O}from"./index-CUnFTKV2.js";import{f as G}from"./statistics-B7ukxmWr.js";import{a as s,b as i}from"./format-C0IiqLeQ.js";const P={class:"card-header"},z={key:0,class:"error-message"},J=D({__name:"UserStatsCard",setup(K,{expose:f}){const l=p(!1),t=p(null),u={userRegisterCount:0,consumingUserCount:0,userMoney:0,userIntegral:0,userMoney2:0,orderPriceTotal:0,orderTotalCount:0,totalGoodsAmount:0,boxRemainingValue:0,exchangedCoupon:0,shippedAmount:0},e=M({...u}),y=N(()=>[{category:"用户基础",item:"绑定手机号人数",value:s(e.userRegisterCount)},{category:"用户基础",item:"抽奖人数",value:s(e.consumingUserCount)},{category:"剩余货币",item:"用户剩余钻石",value:s(e.userMoney)},{category:"剩余货币",item:"用户剩余HH币",value:s(e.userIntegral)},{category:"剩余货币",item:"用户剩余哈尼券",value:s(e.userMoney2)},{category:"支付数据",item:"微信支付金额",value:i(e.orderPriceTotal)},{category:"支付数据",item:"订单支付数量",value:s(e.orderTotalCount)},{category:"出货数据",item:"用户出货总金额",value:i(e.totalGoodsAmount)},{category:"出货数据",item:"用户盒柜剩余价值",value:i(e.boxRemainingValue)},{category:"兑换发货",item:"用户已兑换的达达券",value:s(e.exchangedCoupon)},{category:"兑换发货",item:"用户已发货金额",value:i(e.shippedAmount)}]);async function d(){l.value=!0,t.value=null;try{const a=await G();a.code===0&&a.data?Object.assign(e,a.data):(t.value=a.message||"获取数据失败",Object.assign(e,u))}catch(a){console.error("加载用户统计数据失败:",a),a instanceof Error?a.message.includes("403")||a.message.includes("权限")?t.value="无权限访问此页面":a.message.includes("network")||a.message.includes("Network")?t.value="网络连接失败，请检查网络":t.value="服务器繁忙，请稍后重试":t.value="获取数据失败",Object.assign(e,u)}finally{l.value=!1}}function b(){d(),I.info("正在刷新数据...")}return V(()=>{d()}),f({refresh:d}),(a,c)=>{const h=r("el-button"),m=r("el-table-column"),C=r("el-table"),x=r("el-icon"),w=r("el-card"),k=R("loading");return T((_(),U(w,{class:"user-stats-card"},{header:n(()=>[g("div",P,[c[1]||(c[1]=g("span",{class:"card-title"},"用户数据统计",-1)),o(h,{type:"primary",link:"",icon:v(j),onClick:b,loading:l.value},{default:n(()=>[...c[0]||(c[0]=[H(" 刷新 ",-1)])]),_:1},8,["icon","loading"])])]),default:n(()=>[o(C,{data:y.value,border:"",stripe:"",class:"user-stats-table"},{default:n(()=>[o(m,{prop:"category",label:"类别",width:"120"}),o(m,{prop:"item",label:"项目","min-width":"150"}),o(m,{prop:"value",label:"数值","min-width":"120",align:"right"})]),_:1},8,["data"]),t.value?(_(),A("div",z,[o(x,null,{default:n(()=>[o(v(E))]),_:1}),g("span",null,S(t.value),1)])):B("",!0)]),_:1})),[[k,l.value]])}}}),Q=O(J,[["__scopeId","data-v-ae24397d"]]);export{Q as default};
