import{fE as j,h as N,fF as V,c as z}from"./index-BTglIPU2.js?v=1773287522785";import{u as B}from"./pay-R5yitMsU.js?v=1773287522785";import{k as D,r as S,$ as f,a8 as I,S as i,R as T,a0 as s,j as $,u as O,O as P,c as q,Z as b,_ as e,aa as o,F,P as M,ak as U}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{az as E,o as w,a6 as Q}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";function k(c){return typeof c=="function"||Object.prototype.toString.call(c)==="[object Object]"&&!O(c)}const G=D({__name:"time",props:{endtime:{default:0}},setup(c){const g=c,a=S(0),v=()=>{a.value=g.endtime*1e3-Math.floor(Date.now())},_=l=>l.toString().padStart(2,"0"),p=({hours:l,minutes:r,seconds:d})=>{let u,m,x;const{t:y}=T();return s("div",{class:"flex justify-center items-center text-font2 text-16px"},[s("span",null,[y("Component.Coupon.index_10")]),s(w,{type:"error",size:"small",class:"h-30px mx-10px px-4px text-18px font-bold",bordered:!1},k(u=_(l))?u:{default:()=>[u]}),s("span",null,[$(":")]),s(w,{type:"error",size:"small",class:"h-30px mx-10px px-4px text-18px font-bold",bordered:!1},k(m=_(r))?m:{default:()=>[m]}),s("span",null,[$(":")]),s(w,{type:"error",size:"small",class:"h-30px mx-10px px-4px text-18px font-bold",bordered:!1},k(x=_(d))?x:{default:()=>[x]})])};return v(),(l,r)=>{const d=E;return f(),I(d,{duration:i(a),render:p},null,8,["duration"])}}}),Z={class:"coupon-box"},A={class:"pt-24px bg-modal rounded-10px"},H={class:"px-36px"},J={class:"text-20px text-pro"},K={class:"coupon-list"},W={class:"decoration"},X={class:"coupon-amount"},Y={class:"coupon-price"},ee={class:"text-34px"},oe={class:"coupon-info"},te={class:"coupon-name"},ne={class:"coupon-time"},se={class:"mr-0.25em text-error text-20px"},ae={class:"pt-14px"},ie={class:"mt-24px text-center"},ce={key:0,class:"coupon-number"},pe={class:"px-36px pb-16px bg-modal rounded-10px"},le={class:"w-200px mt-10px mx-auto"},re=D({__name:"index",props:{obtainId:{default:0},endTime:{default:0},couponList:{default:()=>[]},couponQuota:{default:()=>({quota:0,total:0,received:0})}},emits:["close","receive"],setup(c,{emit:g}){const{t:a}=T(),v=c,{couponList:_,couponQuota:p}=P(v),l=q(()=>p.value.total-p.value.quota),r=g,d=B(),u=t=>Math.floor(t/86400),m=S(null),x=[{label:a("Component.Coupon.index_6"),value:"today"},{label:a("Component.Coupon.index_7"),value:"week"},{label:a("Component.Coupon.index_8"),value:"forver"}],y=async()=>{await j({obtain_id:"".concat(v.obtainId)}),d.getReceiveCoupon(),r("close"),r("receive")},L=(t,C)=>{N({title:a("Public.Confirm.Title"),content:"".concat(a("Component.Coupon.index_9",[C.label])),onConfirm:async()=>{let n=0;switch(t){case"today":n=new Date(new Date().toLocaleDateString()).getTime()+1440*60*1e3-1;break;case"week":n=new Date(new Date().toLocaleDateString()).getTime()+10080*60*1e3-1;break;case"forver":n=-100;break}n=Math.floor(n>0?n/1e3:n),await V({limit_time:n}),d.getReceiveCoupon(),r("close")}})};return(t,C)=>{const n=Q;return f(),b("div",Z,[e("div",A,[e("div",H,[e("div",J,o(t.$t("Component.Coupon.index_1")),1),e("div",K,[(f(!0),b(F,null,M(i(_),(h,R)=>(f(),b("div",{key:"".concat(R),class:"coupon-item"},[e("div",W,o(t.$t("Component.Coupon.index_2")),1),e("div",X,[e("div",Y,[C[0]||(C[0]=e("span",{class:"text-20px mr-4px"},"$",-1)),e("span",ee,o(h.deduct_amount),1)])]),e("div",oe,[e("div",te,o(h.title),1),e("div",ne,[e("span",null,o(t.$t("Component.Coupon.index_3")),1),e("span",se,o(u(h.expires)),1),e("span",null,o(t.$t("Public.Unit.Day",u(h.expires))),1)])])]))),128))])])]),e("div",ae,[e("div",ie,[s(G,{endtime:t.endTime},null,8,["endtime"])]),i(p).total>0?(f(),b("div",ce," ⏳Remaining: "+o(i(l))+" / "+o(i(p).total)+" (🎁 "+o(i(l))+" peoples have get it) ",1)):U("",!0),e("div",pe,[e("div",{class:"coupon-btn",onClick:y},o(t.$t("Component.Coupon.index_5"))+" (Last "+o(i(p).quota)+" coupons) ",1),e("div",le,[s(n,{value:i(m),options:x,"consistent-menu-width":!1,placeholder:t.$t("Component.Coupon.index_13"),"onUpdate:value":L},null,8,["value","placeholder"])])])])])}}}),fe=z(re,[["__scopeId","data-v-5b993027"]]);export{fe as default};
