import{bG as e,bH as t,fc as o,fd as n,p as a}from"./page_layout.js?v=1763625242172";import{a as s}from"./public.js?v=1763625242172";import{k as p,r as l,R as i,a2 as c,V as u,P as r,X as d,j as m,u as x,af as v,c as f,S as b,U as C,a4 as _,F as y,O as g,an as h}from"./vue.js?v=1763625242172";import{dd as j,dV as w}from"./naive.js?v=1763625242172";import"./common.js?v=1763625242172";import"./__commonjsHelpers__.js?v=1763625242172";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 i(),c(a,{duration:u(n),render:s},null,8,["duration"])}}}),$={class:"coupon-box"},S={class:"pt-24px bg-modal rounded-10px"},L={class:"px-36px"},T={class:"text-20px text-pro"},R={class:"coupon-list"},q={class:"decoration"},z={class:"coupon-amount"},I={class:"coupon-price"},M={class:"text-34px"},O={class:"coupon-info"},P={class:"coupon-name"},U={class:"coupon-time"},H={class:"mr-0.25em text-error text-20px"},Q={class:"pt-14px"},V={class:"mt-24px text-center"},F={key:0,class:"coupon-number"},G={class:"px-36px pb-16px bg-modal rounded-10px"},X={class:"w-200px mt-10px mx-auto"},A=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(),c=e,{couponList:m,couponQuota:x}=v(c),j=f((()=>x.value.total-x.value.quota)),k=a,A=t(),B=e=>Math.floor(e/86400),E=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(c.obtainId)}),A.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}),A.getReceiveCoupon(),k("close")}})};return(e,t)=>{const o=w;return i(),b("div",$,[C("div",S,[C("div",L,[C("div",T,_(e.$t("Component.Coupon.index_1")),1),C("div",R,[(i(!0),b(y,null,g(u(m),((o,n)=>(i(),b("div",{key:"".concat(n),class:"coupon-item"},[C("div",q,_(e.$t("Component.Coupon.index_2")),1),C("div",z,[C("div",I,[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",U,[C("span",null,_(e.$t("Component.Coupon.index_3")),1),C("span",H,_(B(o.expires)),1),C("span",null,_(e.$t("Public.Unit.Day",B(o.expires))),1)])])])))),128))])])]),C("div",Q,[C("div",V,[d(D,{endtime:e.endTime},null,8,["endtime"])]),u(x).total>0?(i(),b("div",F," ⏳Remaining: "+_(u(j))+" / "+_(u(x).total)+" (🎁 "+_(u(j))+" peoples have get it) ",1)):h("",!0),C("div",G,[C("div",{class:"coupon-btn",onClick:K},_(e.$t("Component.Coupon.index_5"))+" (Last "+_(u(x).quota)+" coupons) ",1),C("div",X,[d(o,{value:u(E),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{A as default};
