import{b6 as e,b7 as t,eL as o,eM as n,p as a}from"./page_layout.js?v=1764830988434";import{a as s}from"./public.js?v=1764830988434";import{k as p,r as l,a2 as i,V as c,U as u,P as r,W as d,j as m,u as x,af as v,c as f,R as b,S as C,a4 as _,F as y,O as g,an as h}from"./vue.js?v=1764830988434";import{dd as j,dV as w}from"./naive.js?v=1764830988434";import"./common.js?v=1764830988434";import"./__commonjsHelpers__.js?v=1764830988434";function k(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!x(e)}const D=p({__name:"time",props:{endtime:{default:0}},setup(t){const o=t,n=l(0),a=e=>e.toString().padStart(2,"0"),s=({hours:e,minutes:t,seconds:o})=>{let n,s,p;const{t:l}=r();return d("div",{class:"flex justify-center items-center text-font2 text-16px"},[d("span",null,[l("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,[m(":")]),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,[m(":")]),d(j,{type:"error",size:"small",class:"h-30px mx-10px px-4px text-18px font-bold",bordered:!1},k(p=a(o))?p:{default:()=>[p]})])};return n.value=1e3*o.endtime-Math.floor(Date.now()),(t,o)=>{const a=e;return c(),i(a,{duration:u(n),render:s},null,8,["duration"])}}}),$={class:"coupon-box"},L={class:"pt-24px bg-modal rounded-10px"},S={class:"px-36px"},T={class:"text-20px text-pro"},M={class:"coupon-list"},R={class:"decoration"},q={class:"coupon-amount"},z={class:"coupon-price"},I={class:"text-34px"},O={class:"coupon-info"},P={class:"coupon-name"},U={class:"coupon-time"},Q={class:"mr-0.25em text-error text-20px"},V={class:"pt-14px"},F={class:"mt-24px text-center"},H={key:0,class:"coupon-number"},W={class:"px-36px pb-16px bg-modal rounded-10px"},A={class:"w-200px mt-10px mx-auto"},B=a(p({__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:p}=r(),i=e,{couponList:m,couponQuota:x}=v(i),j=f(()=>x.value.total-x.value.quota),k=a,B=t(),E=e=>Math.floor(e/86400),G=l(null),J=[{label:p("Component.Coupon.index_6"),value:"today"},{label:p("Component.Coupon.index_7"),value:"week"},{label:p("Component.Coupon.index_8"),value:"forver"}],K=async()=>{await o({obtain_id:"".concat(i.obtainId)}),B.getReceiveCoupon(),k("close"),k("receive")},N=(e,t)=>{s({title:p("Public.Confirm.Title"),content:"".concat(p("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}),B.getReceiveCoupon(),k("close")}})};return(e,t)=>{const o=w;return c(),b("div",$,[C("div",L,[C("div",S,[C("div",T,_(e.$t("Component.Coupon.index_1")),1),C("div",M,[(c(!0),b(y,null,g(u(m),(o,n)=>(c(),b("div",{key:"".concat(n),class:"coupon-item"},[C("div",R,_(e.$t("Component.Coupon.index_2")),1),C("div",q,[C("div",z,[t[0]||(t[0]=C("span",{class:"text-20px mr-4px"},"$",-1)),C("span",I,_(o.deduct_amount),1)])]),C("div",O,[C("div",P,_(o.title),1),C("div",U,[C("span",null,_(e.$t("Component.Coupon.index_3")),1),C("span",Q,_(E(o.expires)),1),C("span",null,_(e.$t("Public.Unit.Day",E(o.expires))),1)])])]))),128))])])]),C("div",V,[C("div",F,[d(D,{endtime:e.endTime},null,8,["endtime"])]),u(x).total>0?(c(),b("div",H," ⏳Remaining: "+_(u(j))+" / "+_(u(x).total)+" (🎁 "+_(u(j))+" peoples have get it) ",1)):h("",!0),C("div",W,[C("div",{class:"coupon-btn",onClick:K},_(e.$t("Component.Coupon.index_5"))+" (Last "+_(u(x).quota)+" coupons) ",1),C("div",A,[d(o,{value:u(G),options:J,"consistent-menu-width":!1,placeholder:e.$t("Component.Coupon.index_13"),"onUpdate:value":N},null,8,["value","placeholder"])])])])])}}}),[["__scopeId","data-v-5b993027"]]);export{B as default};
