12 lines
6.1 KiB
JavaScript
12 lines
6.1 KiB
JavaScript
import{c as k,A as D,a as j,L as E,C as z,b as I,t as y}from"./loader-circle-BggOf0yp.js";import{d as L,u as S,o as V,c as r,a as e,b as a,e as i,F as N,r as R,f as T,g as b,h as B,i as l,j as p,t as n,n as M,k as w,l as F}from"./index-2C3lthXe.js";/**
|
|
* @license lucide-vue-next v0.378.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const P=k("ClockIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
* @license lucide-vue-next v0.378.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const v=k("GiftIcon",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]),$={class:"min-h-screen bg-slate-950 text-slate-100 flex flex-col"},G={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"},O={class:"text-sm font-bold text-white flex items-center gap-1.5"},H={class:"flex-1 w-full max-w-md mx-auto p-4"},U={key:0,class:"flex flex-col items-center justify-center py-24 text-slate-400"},W={key:1,class:"flex flex-col items-center justify-center py-20 text-center"},X={class:"w-16 h-16 rounded-2xl bg-slate-900 border border-slate-800 flex items-center justify-center text-slate-600 mb-4"},q={key:2,class:"space-y-3"},J={class:"flex items-start justify-between gap-3 mb-2"},K={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"},Y=["src","alt"],Z={class:"text-sm font-bold text-white"},ee={class:"text-[11px] text-slate-400 block mt-0.5"},te={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"},se={class:"font-mono text-xs font-bold text-amber-300 tracking-wider"},ae=["onClick"],le={class:"mt-3 flex items-center justify-between text-[10px] text-slate-500"},re={class:"flex items-center gap-1"},oe={key:0,class:"text-rose-400/80"},xe=L({__name:"MyPrizesView",setup(ne){const c=T(),_=S(),x=b(!0),u=b([]),d=b(null);async function C(){if(!_.isAuthenticated){c.push("/");return}x.value=!0;try{const o=await B.get("/me/prizes");u.value=o.data||[]}finally{x.value=!1}}async function A(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 V(()=>{C()}),(o,t)=>(l(),r("div",$,[e("header",G,[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(D),{class:"w-4 h-4"}),t[2]||(t[2]=e("span",null,"بازگشت به گردونه",-1))]),e("h1",O,[i(a(j),{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",H,[x.value?(l(),r("div",U,[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",W,[e("div",X,[i(a(v),{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",q,[(l(!0),r(N,null,R(u.value,s=>{var g,m,h;return 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",J,[e("div",K,[e("div",Q,[(g=s.prize)!=null&&g.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,Y)):(l(),p(a(v),{key:1,class:"w-6 h-6 text-amber-400"}))]),e("div",null,[e("h4",Z,n((m=s.prize)==null?void 0:m.title),1),e("span",ee," کمپین: "+n((h=s.campaign)==null?void 0:h.title),1)])]),e("span",{class:M(["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",te,[e("div",null,[t[8]||(t[8]=e("span",{class:"text-[10px] text-slate-400 block"},"کد دیجیتال:",-1)),e("code",se,n(s.code),1)]),e("button",{onClick:ie=>A(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(z),{key:0,class:"w-3.5 h-3.5 text-emerald-400"})):(l(),p(a(I),{key:1,class:"w-3.5 h-3.5"})),e("span",null,n(d.value===s.id?"کپی شد":"کپی"),1)],8,ae)])):w("",!0),e("div",le,[e("span",re,[i(a(P),{class:"w-3 h-3"}),F(" "+n(a(y)(new Date(s.wonAt||s.createdAt).toLocaleDateString("fa-IR"))),1)]),s.expiresAt?(l(),r("span",oe," انقضا: "+n(a(y)(new Date(s.expiresAt).toLocaleDateString("fa-IR"))),1)):w("",!0)])])}),128))]))])]))}});export{xe as default};
|