PageSourceSearch

https://ns.org.nz/assets/PaymentResultView-kew-AO_I.js

js ns.org.nz collected 2026-09-25 01:14:43 UTC 9,678 bytes, 1 lines download raw bytes

1import{d as de,r as h,c as _,o as ce,X as ye,O as fe,z as i,B as s,F as me,E as f,G as a,u as o,k as pe,Z as _e,C as l}from"./vendor-vue-Dzwqm9Y9.js";import{_ as ve}from"./OrderStatusBadge.vue_vue_type_script_setup_true_lang-BuSXfjAG.js";import{P as K,r as X,c as he}from"./paymentFlow-cys_N5rS.js";import{u as ge}from"./payment-CNKv9baM.js";import{u as ke}from"./index-D4B9XJED.js";import{p as E}from"./payment-Secchv5m.js";import{n as Q,f as we}from"./currency-DpW1WrYL.js";import{p as W,n as xe}from"./paymentUx-DGTR60TU.js";import{u as Se}from"./vendor-i18n-BuoWFzps.js";import"./vendor-misc-B-nM3tYW.js";import"./apiError-BcAuv_LF.js";const be={class:"flex min-h-screen items-center justify-center bg-gray-50 px-4 dark:bg-dark-900"},Te={class:"w-full max-w-md space-y-6"},Re={key:0,class:"flex items-center justify-center py-20"},Ne={class:"text-center"},Ae={key:0,class:"mx-auto flex h-20 w-20 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30"},Ee={key:1,class:"mx-auto flex h-20 w-20 items-center justify-center rounded-full bg-yellow-100 dark:bg-yellow-900/30"},Ie={key:2,class:"mx-auto flex h-20 w-20 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30"},Pe={class:"mt-4 text-2xl font-bold text-gray-900 dark:text-white"},Ce={key:3,class:"mt-2 text-sm text-gray-500 dark:text-gray-400"},je={key:0,class:"rounded-xl bg-white p-5 shadow-sm dark:bg-dark-800"},Me={class:"space-y-3 text-sm"},Oe={key:0,class:"flex justify-between"},Fe={class:"text-gray-500 dark:text-gray-400"},Be={class:"font-medium text-gray-900 dark:text-white"},Ue={key:1,class:"flex justify-between"},Ge={class:"text-gray-500 dark:text-gray-400"},De={class:"font-medium text-gray-900 dark:text-white"},Le={key:2,class:"flex justify-between"},Ve={class:"text-gray-500 dark:text-gray-400"},ze={class:"font-medium text-gray-900 dark:text-white"},qe={key:3,class:"flex justify-between"},He={class:"text-gray-500 dark:text-gray-400"},Ye={class:"font-medium text-gray-900 dark:text-white"},$e={key:4,class:"flex justify-between"},Ke={class:"text-gray-500 dark:text-gray-400"},Xe={class:"font-bold text-primary-600 dark:text-primary-400"},Qe={key:5,class:"flex justify-between"},We={class:"text-gray-500 dark:text-gray-400"},Ze={class:"font-medium text-gray-900 dark:text-white"},Je={key:6,class:"flex justify-between"},et={class:"text-gray-500 dark:text-gray-400"},tt={class:"font-medium text-gray-900 dark:text-white"},rt={class:"flex justify-between"},st={class:"text-gray-500 dark:text-gray-400"},at={key:1,class:"rounded-xl bg-white p-5 shadow-sm dark:bg-dark-800"},nt={class:"space-y-3 text-sm"},ot={key:0,class:"flex justify-between"},ut={class:"text-gray-500 dark:text-gray-400"},it={class:"font-medium text-gray-900 dark:text-white"},lt={key:1,class:"flex justify-between"},dt={class:"text-gray-500 dark:text-gray-400"},ct={class:"font-medium text-gray-900 dark:text-white"},yt={key:2,class:"flex justify-between"},ft={class:"text-gray-500 dark:text-gray-400"},mt={class:"font-medium text-gray-900 dark:text-white"},pt={class:"flex gap-3"},_t=2e3,vt=15,It=de({__name:"PaymentResultView",setup(ht){const I=Se(),{t:u}=I,g=ye(),P=_e(),C=ge(),Z=ke(),t=h(null),j=h(!0),R=h("CNY"),m=h(null),J=new Set(["COMPLETED","PAID","RECHARGING"]),ee=new Set(["PENDING","CREATED","WAITING","PROCESSING"]);let k=null,M=!1;const O=h(0),F=_(()=>{if(!p(t.value))return 0;const e=Number(t.value.fee_rate)||0;return e<=0?t.value.pay_amount??0:Math.round(t.value.pay_amount/(1+e/100)*100)/100}),te=_(()=>!p(t.value)||(Number(t.value.fee_rate)||0)<=0?0:Math.round((t.value.pay_amount-F.value)*100)/100),re=_(()=>{const e=I.locale;if(typeof e=="string")return e;if(e&&typeof e=="object"&&"value"in e)return String(e.value||"")}),B=_(()=>{var e;return ue((e=t.value)==null?void 0:e.status)}),w=_(()=>{var e;return b((e=t.value)==null?void 0:e.status)}),se=_(()=>B.value?u("payment.result.success"):w.value?u("payment.result.processing"):u("payment.result.failed"));function U(e){return xe(e||"")||e||""}function v(e){return we(e,R.value,re.value)}function x(e){t.value=e,e&&"currency"in e&&e.currency&&(R.value=Q(e.currency)),ae(e)}function ae(e){!e||M||S(e.status)!=="COMPLETED"||"order_type"in e&&e.order_type!=="balance"||(M=!0,Z.refreshUser().catch(()=>{}))}function N(e){return!!e&&"id"in e&&typeof e.id=="number"}function p(e){return!!e&&"pay_amount"in e&&typeof e.pay_amount=="number"&&"amount"in e&&typeof e.amount=="number"}function ne(e){return!!e&&"payment_type"in e&&typeof e.payment_type=="string"&&e.payment_type.trim()!==""}function S(e){return String(e||"").trim().toUpperCase()}function oe(e){return S(e)}function ue(e){return J.has(S(e))}function b(e){return ee.has(S(e))}function T(e){const r=g.query[e];return Array.isArray(r)?typeof r[0]=="string"?r[0]:"":typeof r=="string"?r:""}function ie(e){if(typeof window>"u")return null;const r=window.localStorage.getItem(K);if(!r)return null;if(e.resumeToken)return X(r,{resumeToken:e.resumeToken});if(!e.routeOrderId&&!e.routeOutTradeNo)return null;const n=X(r);return!n||e.routeOrderId>0&&n.orderId!==e.routeOrderId||e.routeOutTradeNo&&n.outTradeNo!==e.routeOutTradeNo?null:n}async function G(e){try{return(await E.resolveOrderPublicByResumeToken(e)).data}catch{return null}}async function D(e){try{return(await E.verifyOrder(e)).data}catch{try{return(await E.verifyOrderPublic(e)).data}catch{return null}}}function L(){k!==null&&(clearTimeout(k),k=null)}function V(){typeof window>"u"||he(window.localStorage,K)}function z(e){e&&(b(e)||V())}function q(e){L(),!(!e||!w.value||O.value>=vt)&&(k=setTimeout(async()=>{var n;O.value+=1;const r=await e();
1r&&(x(r),z(r.status)),b((n=t.value)==null?void 0:n.status)&&q(e)},_t))}return ce(async()=>{var $;const e=T("resume_token"),r=Number(T("order_id"))||0;let n=T("out_trade_no"),c=0,A=!1;const y=ie({resumeToken:e,routeOrderId:r,routeOutTradeNo:n});if(y!=null&&y.orderId&&(c=y.orderId),y!=null&&y.currency&&(R.value=Q(y.currency)),!n&&(y!=null&&y.outTradeNo)&&(n=y.outTradeNo),e){const d=await G(e);d?(x(d),c||(c=N(d)?d.id:0)):r>0?(A=!0,c=r):A=!0}else r>0&&(c=r);const H=T("trade_status").trim()!=="",Y=n!==""&&(H||r>0||c>0);if(!t.value&&c&&(!e||r>0))try{x(await C.pollOrderStatus(c))}catch{}if(!t.value&&Y&&(!e||A)){const d=await D(n);d&&(x(d),c||(c=N(d)?d.id:0))}!t.value&&!c&&n&&H&&(m.value={outTradeNo:n,money:String(g.query.money||""),type:String(g.query.type||""),tradeStatus:String(g.query.trade_status||"")});const le=async()=>{if(e){const d=await G(e);if(d)return d}if(c)try{return await C.pollOrderStatus(c)}catch{}return Y?await D(n):null};b(($=t.value)==null?void 0:$.status)?q(le):t.value?z(t.value.status):m.value&&V(),j.value=!1}),fe(()=>{L()}),(e,r)=>(l(),i("div",be,[s("div",Te,[j.value?(l(),i("div",Re,[...r[2]||(r[2]=[s("div",{class:"h-8 w-8 animate-spin rounded-full border-4 border-primary-500 border-t-transparent"},null,-1)])])):(l(),i(me,{key:1},[s("div",Ne,[B.value?(l(),i("div",Ae,[...r[3]||(r[3]=[s("svg",{class:"h-10 w-10 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 13l4 4L19 7"})],-1)])])):w.value?(l(),i("div",Ee,[...r[4]||(r[4]=[s("div",{class:"h-10 w-10 animate-spin rounded-full border-4 border-yellow-500 border-t-transparent"},null,-1)])])):(l(),i("div",Ie,[...r[5]||(r[5]=[s("svg",{class:"h-10 w-10 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})],-1)])])),s("h2",Pe,a(se.value),1),w.value?(l(),i("p",Ce,a(o(u)("payment.result.processingHint")),1)):f("",!0)]),t.value?(l(),i("div",je,[s("div",Me,[N(t.value)?(l(),i("div",Oe,[s("span",Fe,a(o(u)("payment.orders.orderId")),1),s("span",Be,"#"+a(t.value.id),1)])):f("",!0),t.value.out_trade_no?(l(),i("div",Ue,[s("span",Ge,a(o(u)("payment.orders.orderNo")),1),s("span",De,a(t.value.out_trade_no),1)])):f("",!0),p(t.value)?(l(),i("div",Le,[s("span",Ve,a(o(u)("payment.orders.baseAmount")),1),s("span",ze,a(v(F.value)),1)])):f("",!0),p(t.value)&&t.value.fee_rate>0?(l(),i("div",qe,[s("span",He,a(o(u)("payment.orders.fee"))+" ("+a(t.value.fee_rate)+"%)",1),s("span",Ye,a(v(te.value)),1)])):f("",!0),p(t.value)?(l(),i("div",$e,[s("span",Ke,a(o(u)("payment.orders.payAmount")),1),s("span",Xe,a(v(t.value.pay_amount)),1)])):f("",!0),p(t.value)&&t.value.amount!==t.value.pay_amount?(l(),i("div",Qe,[s("span",We,a(o(u)("payment.orders.creditedAmount")),1),s("span",Ze,a(t.value.order_type==="balance"?"$"+t.value.amount.toFixed(2):v(t.value.amount)),1)])):f("",!0),ne(t.value)?(l(),i("div",Je,[s("span",et,a(o(u)("payment.orders.paymentMethod")),1),s("span",tt,a(o(u)(o(W)(t.value.payment_type),U(t.value.payment_type))),1)])):f("",!0),s("div",rt,[s("span",st,a(o(u)("payment.orders.status")),1),pe(ve,{status:oe(t.value.status)},null,8,["status"])])])])):m.value?(l(),i("div",at,[s("div",nt,[m.value.outTradeNo?(l(),i("div",ot,[s("span",ut,a(o(u)("payment.orders.orderId")),1),s("span",it,a(m.value.outTradeNo),1)])):f("",!0),m.value.money?(l(),i("div",lt,[s("span",dt,a(o(u)("payment.orders.payAmount")),1),s("span",ct,a(v(Number(m.value.money)||0)),1)])):f("",!0),m.value.type?(l(),i("div",yt,[s("span",ft,a(o(u)("payment.orders.paymentMethod")),1),s("span",mt,a(o(u)(o(W)(m.value.type),U(m.value.type))),1)])):f("",!0)])])):f("",!0),s("div",pt,[s("button",{class:"btn btn-secondary flex-1",onClick:r[0]||(r[0]=n=>o(P).push("/purchase"))},a(o(u)("payment.result.backToRecharge")),1),s("button",{class:"btn btn-primary flex-1",onClick:r[1]||(r[1]=n=>o(P).push("/orders"))},a(o(u)("payment.result.viewOrders")),1)])],64))])]))}});export{It 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.