2 lines
8.3 KiB
JavaScript
2 lines
8.3 KiB
JavaScript
var t=(t,e,s)=>new Promise((a,l)=>{var i=t=>{try{n(s.next(t))}catch(e){l(e)}},r=t=>{try{n(s.throw(t))}catch(e){l(e)}},n=t=>t.done?a(t.value):Promise.resolve(t.value).then(i,r);n((s=s.apply(t,e)).next())});import{d as e,r as s,k as a,c as l,o as i,b as r,e as n,f as o,i as d,g as c,w as u,I as p,J as x,h as m,v as y,j as b,q as f,p as g}from"./index-BoIUJTA2.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{d as v,f as h}from"./operations-Cr4YfoRu.js";import{c as w,b as j,g as k}from"./activityEnums-zI8yOqFS.js";import{a as P,E as z}from"./index-D2gD5Tn5.js";import{E as Q}from"./index-ZsMdSUVI.js";import{E as C}from"./index-ClDjAOOe.js";import"./index-BMeOzN3u.js";import"./index-COyGylbk.js";import"./index-Bq8lawOo.js";import"./index-Cp4NEpJ7.js";import"./token-DWNpOE8r.js";import"./castArray-nM8ho4U3.js";import"./debounce-DQl5eUwG.js";import"./_baseIteratee-CtIat01j.js";import"./index-CXORCV4U.js";const _={class:"art-card h-auto min-h-[500px] p-5 mb-5 max-sm:mb-4 relative z-0"},D={class:"flex flex-col h-[calc(100%-40px)] space-y-4"},E={class:"flex-shrink-0"},L={class:"flex justify-between items-center"},M={key:0,class:"flex-shrink-0 p-3 bg-g-50 rounded-lg"},T={class:"grid grid-cols-4 gap-4 text-sm"},V={class:"font-medium"},$={class:"font-medium"},F={class:"font-medium"},I={class:"font-medium"},U={key:1,class:"overflow-auto max-h-[350px] border border-g-200 rounded-lg"},q={class:"w-full text-sm"},A={class:"py-3 px-2"},J={class:"flex items-center"},N={class:"font-medium text-g-900"},S={class:"text-xs text-g-500"},B={class:"py-3 px-2"},G={class:"font-medium text-g-900 mb-1"},H={class:"text-xs text-g-500"},K={class:"py-3 px-2"},O={class:"space-y-2"},R={class:"flex justify-between items-center"},W={class:"font-medium text-blue-600"},X={class:"flex justify-between items-center"},Y={class:"w-full bg-g-200 rounded-full h-1.5"},Z={class:"py-3 px-2"},tt={class:"space-y-1"},et={class:"flex justify-between"},st={class:"font-medium text-green-600"},at={class:"flex justify-between"},lt={class:"font-medium"},it={class:"flex justify-between"},rt={class:"font-medium text-blue-600"},nt={class:"py-3 px-2"},ot={class:"space-y-2"},dt={class:"flex justify-between items-center"},ct={class:"flex justify-between items-center"},ut={class:"font-medium text-g-600"},pt={class:"w-full bg-g-200 rounded-full h-1.5"},xt={class:"py-3 px-2"},mt={class:"space-y-2"},yt={key:0,class:"text-xs text-red-600 bg-red-50 px-2 py-1 rounded"},bt={key:1,class:"text-xs text-blue-600 bg-blue-50 px-2 py-1 rounded"},ft={key:2,class:"text-xs text-orange-600 bg-orange-50 px-2 py-1 rounded"},gt={key:2,class:"text-center py-12 text-g-500"},vt=e({__name:"activity-prize-analysis",setup(e){const vt=s(),ht=a([]),wt=a([]),jt=s(null),kt=s(!1),Pt=l(()=>ht.find(t=>t.id===vt.value)),zt=t=>k(t),Qt=(t,e)=>{const s=Math.abs(t-e);return s<=.1?"text-green-600 font-medium":s<=.5?"text-yellow-600 font-medium":"text-red-600 font-medium"},Ct=t=>t.actualProbability>1.1*t.probability?"warning":t.actualProbability<.9*t.probability?"info":"success",_t=t=>t.actualProbability>1.1*t.probability?"中奖率偏高":t.actualProbability<.9*t.probability?"中奖率偏低":"中奖率正常",Dt=t=>t>=1e4?(t/1e4).toFixed(1)+"w":t>=1e3?(t/1e3).toFixed(1)+"k":t.toString(),Et=(t,e)=>{const s=new Date(t),a=new Date(e);return`${s.getMonth()+1}/${s.getDate()}-${a.getMonth()+1}/${a.getDate()}`},Lt=()=>t(this,null,function*(){try{const t=yield v();ht.splice(0,ht.length,...t),t.length>0&&!vt.value&&(vt.value=t[0].id,yield Mt())}catch(t){}}),Mt=()=>t(this,null,function*(){if(vt.value){kt.value=!0;try{const t=yield h(vt.value);jt.value=t,wt.splice(0,wt.length,...t.prizes)}catch(t){}finally{kt.value=!1}}});return i(()=>{Lt()}),(t,e)=>{const s=Q,a=P,l=z,i=C;return n(),r("div",_,[e[14]||(e[14]=o("div",{class:"art-card-header"},[o("div",{class:"title"},[o("h4",null,"活动中奖率分析"),o("p",null,"选择活动查看各奖品中奖概率分布")])],-1)),o("div",D,[o("div",E,[c(l,{modelValue:vt.value,"onUpdate:modelValue":e[0]||(e[0]=t=>vt.value=t),placeholder:"请选择活动",class:"w-full",onChange:Mt},{default:u(()=>[(n(!0),r(p,null,x(ht,t=>(n(),m(a,{key:t.id,label:t.name,value:t.id},{default:u(()=>{return[o("div",L,[o("span",null,y(t.name),1),c(s,{type:(e=t.status,{active:"success",ended:"info",upcoming:"warning"}[e]||"info"),size:"small"},{default:u(()=>[b(y(zt(t.status)),1)]),_:2},1032,["type"])])];var e}),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue"])]),Pt.value?(n(),r("div",M,[o("div",T,[o("div",null,[e[1]||(e[1]=o("div",{class:"text-g-500"},"活动类型",-1)),o("div",V,y(Pt.value.type),1)]),o("div",null,[e[2]||(e[2]=o("div",{class:"text-g-500"},"参与人数",-1)),o("div",$,y(Dt(Pt.value.totalParticipants)),1)]),o("div",null,[e[3]||(e[3]=o("div",{class:"text-g-500"},"总抽奖次数",-1)),o("div",F,y(Dt(Pt.value.totalDraws)),1)]),o("div",null,[e[4]||(e[4]=o("div",{class:"text-g-500"},"活动时间",-1)),o("div",I,y(Et(Pt.value.startTime,Pt.value.endTime)),1)])])])):d("",!0),wt.length>0?(n(),r("div",U,[o("table",q,[e[12]||(e[12]=o("thead",null,[o("tr",{class:"border-b border-g-200 bg-g-50"},[o("th",{class:"text-left py-3 px-2 font-medium"},"奖品等级"),o("th",{class:"text-left py-3 px-2 font-medium"},"奖品名称"),o("th",{class:"text-left py-3 px-2 font-medium"},"概率对比"),o("th",{class:"text-left py-3 px-2 font-medium"},"中奖统计"),o("th",{class:"text-left py-3 px-2 font-medium"},"库存状态"),o("th",{class:"text-left py-3 px-2 font-medium"},"状态")])],-1)),o("tbody",null,[(n(!0),r(p,null,x(wt,t=>{return n(),r("tr",{key:t.prizeId,class:"border-b border-g-100 hover:bg-g-50 transition-colors"},[o("td",A,[o("div",J,[o("span",{class:f(["w-8 h-8 rounded-full flex items-center justify-center text-white text-sm font-bold mr-3 shadow-sm",(a=t.prizeLevel,{1:"bg-gradient-to-r from-yellow-500 to-yellow-400",2:"bg-gradient-to-r from-gray-500 to-gray-400",3:"bg-gradient-to-r from-orange-500 to-orange-400",4:"bg-gradient-to-r from-blue-500 to-blue-400",5:"bg-gradient-to-r from-green-500 to-green-400"}[a]||"bg-gradient-to-r from-gray-500 to-gray-400")])},y(t.prizeLevel),3),o("div",null,[o("div",N,y(g(w)(t.prizeLevel)),1),o("div",S,y(g(j)(t.prizeType)),1)])])]),o("td",B,[o("div",G,y(t.prizeName),1),o("div",H,"价值: ¥"+y(Dt(t.prizeValue)),1)]),o("td",K,[o("div",O,[o("div",R,[e[5]||(e[5]=o("span",{class:"text-xs text-g-500"},"设置:",-1)),o("span",W,y(t.probability)+"%",1)]),o("div",X,[e[6]||(e[6]=o("span",{class:"text-xs text-g-500"},"实际:",-1)),o("span",{class:f(Qt(t.actualProbability,t.probability))},y(t.actualProbability)+"% ",3)]),o("div",Y,[c(i,{percentage:Math.min(t.actualProbability/t.probability*50,100),color:t.actualProbability>t.probability?"#ef4444":"#10b981","show-text":!1,"stroke-width":6},null,8,["percentage","color"])])])]),o("td",Z,[o("div",tt,[o("div",et,[e[7]||(e[7]=o("span",{class:"text-xs text-g-500"},"中奖:",-1)),o("span",st,y(t.winCount),1)]),o("div",at,[e[8]||(e[8]=o("span",{class:"text-xs text-g-500"},"参与:",-1)),o("span",lt,y(t.drawCount),1)]),o("div",it,[e[9]||(e[9]=o("span",{class:"text-xs text-g-500"},"转化率:",-1)),o("span",rt,y(t.drawCount>0?(t.winCount/t.drawCount*100).toFixed(1):0)+"% ",1)])])]),o("td",nt,[o("div",ot,[o("div",dt,[e[10]||(e[10]=o("span",{class:"text-xs text-g-500"},"剩余:",-1)),o("span",{class:f(["font-medium",t.totalQuantity-t.issuedQuantity<10?"text-red-600":"text-g-900"])},y(t.totalQuantity-t.issuedQuantity),3)]),o("div",ct,[e[11]||(e[11]=o("span",{class:"text-xs text-g-500"},"总量:",-1)),o("span",ut,y(t.totalQuantity),1)]),o("div",pt,[c(i,{percentage:t.issuedQuantity/t.totalQuantity*100,color:"#3b82f6","show-text":!1,"stroke-width":6},null,8,["percentage"])])])]),o("td",xt,[o("div",mt,[c(s,{type:Ct(t),size:"small",class:"w-full justify-center"},{default:u(()=>[b(y(_t(t)),1)]),_:2},1032,["type"]),t.actualProbability>1.2*t.probability?(n(),r("div",yt," 中奖率异常偏高 ")):t.actualProbability<.8*t.probability?(n(),r("div",bt," 中奖率异常偏低 ")):d("",!0),t.totalQuantity-t.issuedQuantity<10?(n(),r("div",ft," 库存不足 ")):d("",!0)])])]);var a}),128))])])])):d("",!0),vt.value?d("",!0):(n(),r("div",gt,[...e[13]||(e[13]=[o("div",{class:"text-lg mb-2"},"请选择活动",-1),o("div",{class:"text-sm"},"选择要分析的活动查看奖品中奖率分布",-1)])]))])])}}});export{vt as default};
|