var e=(e,a,l)=>new Promise((t,s)=>{var u=e=>{try{r(l.next(e))}catch(a){s(a)}},n=e=>{try{r(l.throw(e))}catch(a){s(a)}},r=e=>e.done?t(e.value):Promise.resolve(e.value).then(u,n);r((l=l.apply(e,a)).next())});import{e as a,E as l,i as t,C as s,D as u,m as n}from"./vendor-element-C6D3GHVC.js";import{t as r,r as v,S as i,bB as o,V as d,v as c,B as x,H as m,E as p,F as f,L as y,I as b,O as g,u as h,K as w,bA as _,x as k}from"./vendor-core-B-NFAs71.js";import{c as j}from"./wallet-BcP8oCxP.js";import"./index-BhVZTysP.js";const q={class:"min-h-screen bg-slate-50 flex items-center justify-center px-4 py-8"},C={class:"w-full max-w-md rounded-3xl bg-white shadow-lg border border-slate-100 p-6"},I={class:"flex items-center justify-center mb-5"},z={class:"text-center mb-6"},A={class:"text-xl font-semibold text-slate-900 mb-2"},B={class:"text-sm leading-6 text-slate-500"},E={class:"rounded-2xl bg-slate-50 px-4 py-3 text-sm text-slate-600 space-y-2 mb-6"},L={class:"flex justify-between gap-3"},P={class:"font-mono text-slate-700 break-all text-right"},D={key:0,class:"flex justify-between gap-3"},F={class:"text-slate-700 text-right"},H={key:1,class:"flex justify-between gap-3"},K={class:"text-slate-700"},O={class:"space-y-3"},R=r({__name:"mobile-launch",setup(r){const R=_(),S=o(),T=v(""),U=v(""),V=v(""),G=v(""),J=v("正在准备支付"),M=v("页面将拉起支付窗口，并在此页面持续检测支付结果。"),N=v(!1),Q=v(!1),W=v(!1),X=v(!1);let Y=null,Z=0;const $=e=>Array.isArray(e)?e[0]||"":"string"==typeof e?e:"",ee=()=>{Y&&(clearInterval(Y),Y=null)},ae=()=>{T.value&&R.replace({path:"/order/search",query:{keyword:T.value}})},le=()=>e(null,null,function*(){var e,a;if(T.value&&!W.value)try{Z+=1;const l=yield j(T.value),t=(null==l?void 0:l.status)||(null==(e=null==l?void 0:l.data)?void 0:e.status);if(!0===l||1===(null==l?void 0:l.status)||"paid"===t||"pending_shipment"===t||1===(null==(a=null==l?void 0:l.data)?void 0:a.status))return ee(),W.value=!0,X.value=!1,J.value="支付成功",M.value="订单已支付成功，正在跳转到订单查询页。",void setTimeout(()=>{ae()},1200);Z>=150&&(X.value=!0,J.value="支付结果确认中",M.value="暂未检测到支付完成，如已支付可稍后点“查看订单”确认。",ee())}catch(l){}}),te=()=>{if(U.value){N.value=!0;try{if(!window.open(U.value,"_blank"))return void(window.location.href=U.value);Q.value=!0,J.value="请在新窗口完成支付",M.value="支付完成后无需返回首页，本页会自动检测并跳转订单页。"}finally{N.value=!1}}else l.error("缺少支付链接")};return i(()=>{if(T.value=$(S.query.order_no),U.value=decodeURIComponent($(S.query.pay_url)),V.value=$(S.query.product_name),G.value=$(S.query.amount),!T.value||!U.value)return J.value="参数错误",void(M.value="缺少订单号或支付链接，无法继续支付。");te(),e(null,null,function*(){ee(),Z=0,yield le(),W.value||(Y=setInterval(le,2e3))})}),d(()=>{ee()}),(e,l)=>{const r=t,v=a;return k(),c("div",q,[x("div",C,[x("div",I,[x("div",{class:m(["h-14 w-14 rounded-full flex items-center justify-center",W.value?"bg-emerald-50 text-emerald-500":X.value?"bg-amber-50 text-amber-500":"bg-blue-50 text-blue-500"])},[W.value?(k(),p(r,{key:0,size:"28"},{default:f(()=>[g(h(s))]),_:1})):X.value?(k(),p(r,{key:1,size:"28"},{default:f(()=>[g(h(u))]),_:1})):(k(),p(r,{key:2,class:"is-loading",size:"28"},{default:f(()=>[g(h(n))]),_:1}))],2)]),x("div",z,[x("h1",A,y(J.value),1),x("p",B,y(M.value),1)]),x("div",E,[x("div",L,[l[0]||(l[0]=x("span",{class:"text-slate-400"},"订单号",-1)),x("span",P,y(T.value),1)]),V.value?(k(),c("div",D,[l[1]||(l[1]=x("span",{class:"text-slate-400"},"商品",-1)),x("span",F,y(V.value),1)])):b("",!0),G.value?(k(),c("div",H,[l[2]||(l[2]=x("span",{class:"text-slate-400"},"金额",-1)),x("span",K,"¥"+y(G.value),1)])):b("",!0)]),x("div",O,[g(v,{type:"primary",class:"!w-full !h-11",onClick:te,loading:N.value},{default:f(()=>[w(y(Q.value?"重新拉起支付":"立即支付"),1)]),_:1},8,["loading"]),X.value||W.value?(k(),p(v,{key:0,class:"!w-full !h-11",onClick:ae},{default:f(()=>[...l[3]||(l[3]=[w(" 查看订单 ",-1)])]),_:1})):b("",!0)]),l[4]||(l[4]=x("p",{class:"text-xs text-slate-400 text-center mt-5 leading-5"}," 支付页会在新窗口或新标签打开，当前页面会持续检测支付状态。 ",-1))])])}}});export{R as default};
