import{d as N,r as u,w as O,j as z,ai as d,aq as R,P as U,u as c,o as _,M as g,O as D,a as l,U as w,D as h,c as Y,a8 as A,T as x,S as B,a2 as S,R as $,F as E}from"./vue.1RczIYhx.js";import{c as I,d as L}from"./api.BXfd5NyU.js";import{D as p,z as T,h as M}from"./elementPlus.CSBdF9Zt.js";/* empty css                   */import{_ as j}from"./_plugin-vue_export-helper.DlAUqK2U.js";import"./index.K_MFulpu.js";const F={class:"header-container"},P={class:"stat-overview"},G={class:"stat-label"},H={class:"stat-value"},J=N({__name:"Overview",setup(K){const r=u(!1),i=u(""),t=u([p().startOf("month").format("YYYY-MM-DD"),p().format("YYYY-MM-DD")]),y=u([]),k=[{label:"监控商品数",field:"monitor_goods_count"},{label:"监控竞品数",field:"monitor_competitors_count"},{label:"总评论数",field:"total_review_count"},{label:"新增好评数",field:"good_review_count"},{label:"新增中评数",field:"mid_review_count"},{label:"新增差评数",field:"bad_review_count"},{label:"在售商品数",field:"sale_goods_count"},{label:"停售商品数",field:"discontinued_goods_count"}];async function v(){r.value=!0;const o={query_start_date:t.value[0],query_end_date:t.value[1],asin:i.value};try{const{data:e}=await I(o);y.value=k.map(n=>({label:n.label,value:e[n.field]||0})),r.value=!1}catch(e){console.error("获取数据时出错:",e)}}async function C(o){r.value=!0;const e={总评论数:0,新增好评数:1,新增中评数:2,新增差评数:3}[o];try{const n={download_type:e,query_start_date:t.value[0],query_end_date:t.value[1],asin:i.value},f=`${t.value[0]}至${t.value[1]}${o}.xlsx`,m=await L(n),b=window.URL.createObjectURL(m.data),s=document.createElement("a");s.href=b,s.setAttribute("download",f),document.body.appendChild(s),s.click(),M.success("下载成功"),r.value=!1}catch{M.error("error")}}return O(t,(o,e)=>{o!==e&&(t.value[0]=p(o[0]).format("YYYY-MM-DD"),t.value[1]=p(o[1]).format("YYYY-MM-DD"),v())}),z(()=>{v()}),(o,e)=>{const n=d("el-input"),f=d("el-date-picker"),m=d("el-button"),b=d("el-tooltip"),s=d("el-card"),V=R("loading");return U((_(),g(s,{shadow:"hover",class:"border-none",style:{"margin-bottom":"10px",height:"155px"}},{default:D(()=>[l("div",F,[e[4]||(e[4]=l("span",{style:{"font-size":"16px","font-weight":"500"}},"统计概览",-1)),l("div",null,[e[2]||(e[2]=l("span",{style:{"font-size":"14px",color:"#95969a"}},"ASIN ",-1)),w(n,{modelValue:c(i),"onUpdate:modelValue":e[0]||(e[0]=a=>h(i)?i.value=a:null),clearable:"",style:{width:"220px"},placeholder:"请输入ASIN",onChange:v},null,8,["modelValue"])]),l("div",null,[e[3]||(e[3]=l("span",{style:{"font-size":"14px",color:"#95969a"}},"时间选择 ",-1)),w(f,{modelValue:c(t),"onUpdate:modelValue":e[1]||(e[1]=a=>h(t)?t.value=a:null),clearable:!1,type:"daterange"},null,8,["modelValue"])])]),l("div",P,[(_(!0),Y(E,null,A(c(y),(a,q)=>(_(),Y("div",{key:q,class:"stat-item"},[l("div",G,x(a.label),1),l("div",H,[B(x(a.value)+" ",1),w(b,{content:"下载",placement:"top"},{default:D(()=>[a.label==="总评论数"||a.label==="新增好评数"||a.label==="新增中评数"||a.label==="新增差评数"?(_(),g(m,{key:0,icon:c(T),size:o.mini,class:"stat-button",type:"text",onClick:S(Q=>C(a.label),["stop"])},null,8,["icon","size","onClick"])):$("",!0)]),_:2},1024)])]))),128))])]),_:1})),[[V,c(r)]])}}}),oe=j(J,[["__scopeId","data-v-8788a5fd"]]);export{oe as default};
