2 lines
5.3 KiB
JavaScript
2 lines
5.3 KiB
JavaScript
import{t as g}from"./wheel-classiccasinowheel-D335SDnp.js";import{d as _,j as k,b as r,e,u as a,v as i,A as C,x as D,L as E,G as m,F as z,f as A,y as j,r as b,a as l,k as p,t as n,z as S,C as V,B,g as h,D as I,E as L}from"./vendor-vue-DYkhP7t5.js";import{u as N,a as R}from"./index-BAVpCd0B.js";const T={class:"min-h-screen bg-slate-950 text-slate-100 flex flex-col"},F={class:"w-full max-w-md mx-auto px-4 py-3 flex items-center justify-between border-b border-slate-800/80 bg-slate-900/50 backdrop-blur sticky top-0 z-40"},P={class:"text-sm font-bold text-white flex items-center gap-1.5"},$={class:"flex-1 w-full max-w-md mx-auto p-4"},G={key:0,class:"flex flex-col items-center justify-center py-24 text-slate-400"},M={key:1,class:"flex flex-col items-center justify-center py-20 text-center"},O={class:"w-16 h-16 rounded-2xl bg-slate-900 border border-slate-800 flex items-center justify-center text-slate-600 mb-4"},U={key:2,class:"space-y-3"},W={class:"flex items-start justify-between gap-3 mb-2"},X={class:"flex items-center gap-3"},q={class:"w-12 h-12 rounded-xl bg-slate-800 border border-slate-700/60 flex items-center justify-center overflow-hidden flex-shrink-0"},H=["src","alt"],J={class:"text-sm font-bold text-white"},K={class:"text-[11px] text-slate-400 block mt-0.5"},Q={key:0,class:"mt-3 pt-3 border-t border-slate-800/80 flex items-center justify-between bg-slate-950/70 p-2.5 rounded-xl border border-slate-800"},Y={class:"font-mono text-xs font-bold text-amber-300 tracking-wider"},Z=["onClick"],ee={class:"mt-3 flex items-center justify-between text-[10px] text-slate-500"},te={class:"flex items-center gap-1"},se={key:0,class:"text-rose-400/80"},ie=_({__name:"MyPrizesView",setup(ae){const c=j(),w=N(),x=b(!0),u=b([]),d=b(null);async function y(){if(!w.isAuthenticated){c.push("/");return}x.value=!0;try{const o=await R.get("/me/prizes");u.value=o.data||[]}finally{x.value=!1}}async function v(o,t){try{await navigator.clipboard.writeText(o),d.value=t,setTimeout(()=>{d.value=null},2e3)}catch{}}function f(o){switch(o){case"ACTIVE_CODE":return{text:"کد فعال",bg:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20"};case"USED":return{text:"مصرف شده",bg:"bg-slate-800 text-slate-400 border-slate-700"};case"EXPIRED":return{text:"منقضی شده",bg:"bg-rose-500/10 text-rose-400 border-rose-500/20"};case"DELIVERED":return{text:"تحویل داده شده",bg:"bg-blue-500/10 text-blue-400 border-blue-500/20"};case"CONTACTED":return{text:"در حال هماهنگی",bg:"bg-amber-500/10 text-amber-400 border-amber-500/20"};case"NEW":return{text:"ثبت جدید",bg:"bg-purple-500/10 text-purple-400 border-purple-500/20"};default:return{text:o,bg:"bg-slate-800 text-slate-300 border-slate-700"}}}return k(()=>{y()}),(o,t)=>(l(),r("div",T,[e("header",F,[e("button",{onClick:t[0]||(t[0]=s=>a(c).back()),class:"flex items-center gap-1.5 text-xs text-slate-400 hover:text-white transition"},[i(a(C),{class:"w-4 h-4"}),t[2]||(t[2]=e("span",null,"بازگشت به گردونه",-1))]),e("h1",P,[i(a(D),{class:"w-4 h-4 text-amber-400"}),t[3]||(t[3]=e("span",null,"صندوق جوایز من",-1))]),t[4]||(t[4]=e("div",{class:"w-8"},null,-1))]),e("main",$,[x.value?(l(),r("div",G,[i(a(E),{class:"w-8 h-8 animate-spin text-blue-500 mb-2"}),t[5]||(t[5]=e("span",{class:"text-xs"},"در حال بارگذاری جوایز...",-1))])):u.value.length===0?(l(),r("div",M,[e("div",O,[i(a(m),{class:"w-8 h-8"})]),t[6]||(t[6]=e("h3",{class:"text-base font-bold text-white mb-1"},"هنوز جایزهای دریافت نکردهاید",-1)),t[7]||(t[7]=e("p",{class:"text-xs text-slate-400 max-w-xs mb-6 leading-relaxed"}," گردونه شانس را بچرخانید و برنده جوایز نقدی، تخفیفها و کالاهای فیزیکی شوید! ",-1)),e("button",{onClick:t[1]||(t[1]=s=>a(c).back()),class:"px-5 py-2.5 rounded-xl bg-blue-600 hover:bg-blue-500 text-white font-semibold text-xs shadow-lg shadow-blue-500/20 transition"}," ورود به گردونه ")])):(l(),r("div",U,[(l(!0),r(z,null,A(u.value,s=>(l(),r("div",{key:s.id,class:"p-4 rounded-2xl bg-slate-900/80 border border-slate-800 shadow-sm relative overflow-hidden"},[e("div",W,[e("div",X,[e("div",q,[s.prize?.image?(l(),r("img",{key:0,src:s.prize.image,alt:s.prize.title,class:"w-full h-full object-contain p-1"},null,8,H)):(l(),p(a(m),{key:1,class:"w-6 h-6 text-amber-400"}))]),e("div",null,[e("h4",J,n(s.prize?.title),1),e("span",K," گردونه: "+n(s.campaign?.title),1)])]),e("span",{class:S(["text-[10px] font-semibold px-2 py-0.5 rounded-md border",f(s.status).bg])},n(f(s.status).text),3)]),s.code?(l(),r("div",Q,[e("div",null,[t[8]||(t[8]=e("span",{class:"text-[10px] text-slate-400 block"},"کد پیگیری / جایزه:",-1)),e("code",Y,n(s.code),1)]),e("button",{onClick:le=>v(s.code,s.id),class:"text-xs px-2.5 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 flex items-center gap-1 transition"},[d.value===s.id?(l(),p(a(V),{key:0,class:"w-3.5 h-3.5 text-emerald-400"})):(l(),p(a(B),{key:1,class:"w-3.5 h-3.5"})),e("span",null,n(d.value===s.id?"کپی شد":"کپی"),1)],8,Z)])):h("",!0),e("div",ee,[e("span",te,[i(a(I),{class:"w-3 h-3"}),L(" "+n(a(g)(new Date(s.wonAt||s.createdAt).toLocaleDateString("fa-IR"))),1)]),s.expiresAt?(l(),r("span",se," انقضا: "+n(a(g)(new Date(s.expiresAt).toLocaleDateString("fa-IR"))),1)):h("",!0)])]))),128))]))])]))}});export{ie as default};
|