PageSourceSearch

https://ku11tech.com/assets/StripePopupView-DR2-Fxvk.js

js ku11tech.com collected 2026-10-04 05:27:05 UTC 4,210 bytes, 1 lines download raw bytes

1import{y as D,z as A,o as M}from"./index-DGTjV__i.js";import{d as R,X as U,c as B,r as P,o as F,a as z,z as m,B as a,E as C,u as i,U as h,G as l,C as p}from"./vendor-vue-BVJWaRIf.js";import{b as V}from"./apiError-zX02PgX9.js";import{u as j}from"./vendor-i18n-pgwztqC8.js";import"./vendor-misc-WKm5Kdig.js";const q={class:"flex min-h-screen items-center justify-center bg-slate-50 p-4 dark:bg-slate-950"},H={class:"w-full max-w-md space-y-4 rounded-2xl border border-slate-200 bg-white p-6 shadow-lg dark:border-slate-700 dark:bg-slate-900"},N={key:0,class:"text-center"},W={key:0,class:"mt-1 text-sm text-gray-500 dark:text-slate-400"},G={key:1,class:"space-y-3"},Q={class:"rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-600 dark:border-red-700 dark:bg-red-900/30 dark:text-red-400"},X={key:2,class:"space-y-3 py-4 text-center"},Y={class:"text-sm text-gray-500 dark:text-slate-400"},$={key:3,class:"flex items-center justify-center py-8"},J={class:"ml-3 text-sm text-gray-500 dark:text-slate-400"},K="#635bff",oe=R({__name:"StripePopupView",setup(Z){const S={alipay:"#00AEEF",wechat_pay:"#07C160"},{t:e}=j(),b=U(),f=String(b.query.order_id||""),k=String(b.query.method||"alipay"),E=String(b.query.amount||""),_=B(()=>S[k]||K),s=P(""),v=P(!1),T=P(e("payment.stripePopup.redirecting"));let d=null,w=null,o=null;function g(){window.close()}function I(){w&&(clearTimeout(w),w=null)}F(()=>{o=t=>{var r;t.origin===window.location.origin&&((r=t.data)==null?void 0:r.type)==="STRIPE_POPUP_INIT"&&(I(),o&&(window.removeEventListener("message",o),o=null),L(t.data.clientSecret,t.data.publishableKey))},window.addEventListener("message",o),window.opener&&window.opener.postMessage({type:"STRIPE_POPUP_READY"},window.location.origin),w=setTimeout(()=>{!s.value&&!v.value&&(s.value=e("payment.stripePopup.timeout"))},15e3)}),z(()=>{d&&(clearInterval(d),d=null),I(),o&&(window.removeEventListener("message",o),o=null)});async function L(t,r){var y;if(!t||!r){s.value=e("payment.stripeMissingParams");return}try{const{loadStripe:u}=await D(async()=>{const{loadStripe:n}=await import("./vendor-stripe-DSy-tJeT.js");return{loadStripe:n}},[]),c=await u(r);if(!c){s.value=e("payment.stripeLoadFailed");return}const x=window.location.origin+"/payment/result?order_id="+f+"&status=success";if(k==="alipay"){const{error:n}=await c.confirmAlipayPayment(t,{return_url:x});n&&(s.value=n.message||e("payment.result.failed"))}else if(k==="wechat_pay"){T.value=e("payment.stripePopup.loadingQr");const n=await c.confirmWechatPayPayment(t,{payment_method_options:{wechat_pay:{client:A()?"mobile_web":"web"}}});n.error?s.value=n.error.message||e("payment.result.failed"):((y=n.paymentIntent)==null?void 0:y.status)==="succeeded"?(v.value=!0,setTimeout(g,2e3)):O()}}catch(u){s.value=V(u,e,"payment.errors",e("payment.stripeLoadFailed"))}}function O(){let t=!1;d=setInterval(async()=>{var r;if(!t){t=!0;try{const y=localStorage.getItem("auth_token")||"",u=await fetch(M(`/payment/orders/${f}`),{headers:y?{Authorization:"Bearer "+y}:{},credentials:"include"});if(!u.ok)return;const c=await u.json(),x=(r=c==null?void 0:c.data)==null?void 0:r.status;(x==="COMPLETED"||x==="PAID")&&(d&&(clearInterval(d),d=null),v.value=!0,setTimeout(g,2e3))}catch{}finally{t=!1}}},3e3)}return(t,r)=>(p(),m("div",q,[a("div",H,[i(E)?(p(),m("div",N,[a("p",{class:"text-3xl font-bold",style:h({color:_.value})},"¥"+l(i(E)),5),i(f)?(p(),m("p",W,l(i(e)("payment.orders.orderId"))+": "+l(i(f)),1)):C("",!0)])):C("",!0),s.value?(p(),m("div",G,[a("div",Q,l(s.value),1),a("button",{class:"w-full text-sm underline dark:text-blue-400 dark:hover:text-blue-300",style:h({color:_.value}),onClick:g},l(i(e)("common.close")),5)])):v.value?(p(),m("div",X,[r[0]||(r[0]=a("div",{class:"text-5xl text-green-600 dark:text-green-400"},"✓",-1)),a("p",Y,l(i(e)("payment.result.success")),1),a("button",{class:"text-sm underline dark:text-blue-400 dark:hover:text-blue-300",style:h({color:_.value}),onClick:g},l(i(e)("common.close")),5)])):(p(),m("div",$,[a("div",{class:"h-8 w-8 animate-spin rounded-full border-2 border-t-transparent",style:h({borderColor:_.value,borderTopColor:"transparent"})},null,4),a("span",J,l(T.value),1)]))])]))}});
1export{oe as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.