import{p as e,P as a,M as o}from"./utils-lib.js?v=1761009159";import{g as t,r as s}from"./base-lib.js?v=1761009159";import{applyCertOrderRenw as r,getPayStatus as u}from"./site.js?v=1761009159";import{u as l}from"./useStore4.js?v=1761009159";import{ah as i,ai as n}from"./useController13.js?v=1761009159";import{u as c,S as v}from"./useStore12.js?v=1761009159";l();const{isRefreshSSL:m,productInfo:d,orderInfo:I,pollingPopup:S}=c();v();const f=t(()=>d.value.totalPrice>5e3),p=s(f.value?"alicode":"wxcode"),w=s(0),g=s(!1),T=(e,a=!1)=>{f.value&&"wxcode"===e&&(e="alicode",o.error("微信支付单笔限额5000元，请使用支付宝支付")),p.value=e,sessionStorage.setItem(a?"PAY-SSL-VIEW-TIME":"PAY-VIEW-SSL-TIME","".concat((new Date).getTime()/1e3))},E=async()=>{(await S.value).unmount()},P=async o=>{j.value=!1,o&&sessionStorage.setItem("PAY-VIEW-SSL-TIME","".concat(o));const t=sessionStorage.getItem("PAY-VIEW-SSL-TIME");if(t){if(parseInt("".concat((new Date).getTime()/1e3-Number(t)),10)>600&&S.value)return sessionStorage.removeItem("PAY-VIEW-SSL-TIME"),e({title:"支付超时",icon:"warning",content:"由于您长时间未操作，支付超时，请刷新网页重新购买！",onConfirm:()=>{E(),window.location.reload()},onCancel:()=>{E(),window.location.reload()}});S.value||sessionStorage.removeItem("PAY-VIEW-SSL-TIME")}await b(),g.value?(w.value&&clearTimeout(w.value),w.value=setTimeout(()=>{P()},3e3)):d.value.isRenew?(await a({request:r({oid:d.value.oid}),message:!0}),m.value=!0):y()},j=s(!1),b=async()=>{const e=await a({request:u({oid:I.value.oid,pid:I.value.pid})});if("object"==typeof e.data&&0===Object.keys(e.data).length)return o.error("请求失败，请稍后再试。如有支付问题，请联系客服。"),j.value=!0,Promise.reject({status:!1,msg:"请求失败，请稍后再试。如有支付问题，请联系客服。"});g.value=!e.data},y=async()=>{i({productInfo:d.value,orderInfo:I.value}),m.value=!0;(await S.value).unmount(),clearTimeout(w.value)},L=()=>{n({productInfo:d.value,orderInfo:I.value})},M=async()=>{await b(),g.value&&(w.value&&clearTimeout(w.value),w.value=setTimeout(()=>{P()},3e3))},A=()=>{g.value=!1,j.value=!1,w.value&&clearTimeout(w.value)};export{P as a,g as b,w as c,T as d,M as e,A as f,b as m,L as p,j as s,p as t};
