import{bq as e,br as t,dH as o,dI as n,e as a}from"./page_layout.js?v=1753954525509";import{d as s}from"./public.js?v=1753954525509";import{k as l,r as p,U as i,a1 as c,X as u,P as r,Q as d,j as x,u as m,ad as v,c as f,V as b,W as C,a3 as _,F as y,O as g,al as h}from"./vue.js?v=1753954525509";import{c0 as j,cG as w}from"./naive.js?v=1753954525509";import"./common.js?v=1753954525509";import"./__commonjsHelpers__.js?v=1753954525509";function k(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!m(e)}const D=l({__name:"time",props:{endtime:{default:0}},setup(t){const o=t,n=p(0),a=e=>e.toString().padStart(2,"0"),s=({hours:e,minutes:t,seconds:o})=>{let n,s,l;const{t:p}=r();return d("div",{class:"flex justify-center items-center text-default text-16px"},[d("span",null,[p("Component.Coupon.index_10")]),d(j,{type:"error",size:"small",class:"h-30px mx-10px px-4px text-18px font-bold",bordered:!1},k(n=a(e))?n:{default:()=>[n]}),d("span",null,[x(":")]),d(j,{type:"error",size:"small",class:"h-30px mx-10px px-4px text-18px font-bold",bordered:!1},k(s=a(t))?s:{default:()=>[s]}),d("span",null,[x(":")]),d(j,{type:"error",size:"small",class:"h-30px mx-10px px-4px text-18px font-bold",bordered:!1},k(l=a(o))?l:{default:()=>[l]})])};return n.value=1e3*o.endtime-Math.floor(Date.now()),(t,o)=>{const a=e;return i(),c(a,{duration:u(n),render:s},null,8,["duration"])}}}),$={class:"coupon-box"},L={class:"pt-24px bg-#fff rounded-4px"},S={class:"px-36px"},T={class:"text-20px text-[#FFB04C]"},q={class:"coupon-list"},I={class:"decoration"},z={class:"coupon-amount"},F={class:"coupon-price"},M={class:"text-34px"},O={class:"coupon-info"},P={class:"coupon-name"},Q={class:"coupon-time"},R={class:"text-error text-20px"},U={class:"pt-14px"},H={class:"mt-24px text-center"},B={key:0,class:"coupon-number"},G={class:"px-36px pb-16px bg-#fff rounded-8px"},V={class:"w-200px mt-10px mx-auto"},W=a(l({__name:"index",props:{obtainId:{default:0},endTime:{default:0},couponList:{default:()=>[]},couponQuota:{default:()=>({quota:0,total:0,received:0})}},emits:["close","receive"],setup(e,{emit:a}){const{t:l}=r(),c=e,{couponList:x,couponQuota:m}=v(c),j=f((()=>m.value.total-m.value.quota)),k=a,W=t(),X=e=>Math.floor(e/86400),A=p(null),E=[{label:l("Component.Coupon.index_6"),value:"today"},{label:l("Component.Coupon.index_7"),value:"week"},{label:l("Component.Coupon.index_8"),value:"forver"}],J=async()=>{await o({obtain_id:"".concat(c.obtainId)}),W.getReceiveCoupon(),k("close"),k("receive")},K=(e,t)=>{s({title:l("Public.Confirm.Title"),content:"".concat(l("Component.Coupon.index_9",[t.label])),onConfirm:async()=>{let t=0;switch(e){case"today":t=new Date((new Date).toLocaleDateString()).getTime()+864e5-1;break;case"week":t=new Date((new Date).toLocaleDateString()).getTime()+6048e5-1;break;case"forver":t=-100}t=Math.floor(t>0?t/1e3:t),await n({limit_time:t}),W.getReceiveCoupon(),k("close")}})};return(e,t)=>{const o=w;return i(),b("div",$,[C("div",L,[C("div",S,[C("div",T,_(e.$t("Component.Coupon.index_1")),1),C("div",q,[(i(!0),b(y,null,g(u(x),((o,n)=>(i(),b("div",{key:"".concat(n),class:"coupon-item"},[C("div",I,_(e.$t("Component.Coupon.index_2")),1),C("div",z,[C("div",F,[t[0]||(t[0]=C("span",{class:"text-20px mr-4px"},"$",-1)),C("span",M,_(o.deduct_amount),1)])]),C("div",O,[C("div",P,_(o.title),1),C("div",Q,[C("span",null,_(e.$t("Component.Coupon.index_3")),1),C("span",R,_(X(o.expires)),1),C("span",null,_(e.$t("Public.Unit.Day",X(o.expires))),1)])])])))),128))])])]),C("div",U,[C("div",H,[d(D,{endtime:e.endTime},null,8,["endtime"])]),u(m).total>0?(i(),b("div",B," ⏳Remaining: "+_(u(j))+" / "+_(u(m).total)+" (🎁 "+_(u(j))+" peoples have get it) ",1)):h("",!0),C("div",G,[C("div",{class:"coupon-btn",onClick:J},_(e.$t("Component.Coupon.index_5"))+" (Last "+_(u(m).quota)+" coupons) ",1),C("div",V,[d(o,{value:u(A),options:E,"consistent-menu-width":!1,placeholder:e.$t("Component.Coupon.index_13"),"onUpdate:value":K},null,8,["value","placeholder"])])])])])}}}),[["__scopeId","data-v-5e719f0f"]]);export{W as default};
