PageSourceSearch

https://papillondoux.com/assets/PaymentResult-Ca8tni4O.js

js papillondoux.com collected 2026-10-07 03:12:13 UTC 8,326 bytes, 1 lines download raw bytes

1import{j as e}from"./index-DKqUnLwK.js";import{u as R,h as k,r as m,L as j}from"./vendor-B-P4X9mJ.js";import{u as S}from"./i18n-CWLY-z3X.js";import"./helmet-g13O2BcH.js";const y=Symbol.for("constructDateFrom");function f(s,t){return typeof s=="function"?s(t):s&&typeof s=="object"&&y in s?s[y](t):s instanceof Date?new s.constructor(t):new Date(t)}function D(s,t){return f(s,s)}function L(s,t,n){const r=D(s);return isNaN(t)?f(s,NaN):(r.setDate(r.getDate()+t),r)}function _(s){try{return decodeURIComponent(atob(s).split("").map(function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)}).join(""))}catch(t){return console.error("Base64 decode error:",t),""}}function I(s,t){let n=new Date(s),r=0;const c=["2024-01-01","2024-02-08","2024-02-09","2024-02-10","2024-02-11","2024-02-12","2024-02-28","2024-04-04","2024-05-01","2025-01-01","2025-01-28","2025-01-29","2025-01-30","2025-01-31","2025-02-01","2025-02-28","2025-04-04","2025-05-01"];for(;r<t;){n=L(n,1);const a=n.toISOString().split("T")[0],l=n.getDay();l!==0&&l!==6&&!c.includes(a)&&r++}return n}function B(){const{t:s}=S(),{lang:t}=R(),[n]=k(),[r,c]=m.useState("loading"),[a,l]=m.useState(null),x=t||"zh";m.useEffect(()=>{var p;const o=n.get("data"),u=n.get("status"),h=n.get("order_id");if(o){try{const i=_(o),d=JSON.parse(i);sessionStorage.setItem("paymentResult",JSON.stringify(d)),l(d),c(((p=d.value)==null?void 0:p.status)==="success"?"success":"failed"),window.history.replaceState({},"",window.location.pathname)}catch(i){console.error("payment payload decode failed",i),c("error")}return}if(u){c(u==="success"?"success":"failed");return}if(h){c("processing"),l({value:{status:"processing",orderId:h,order_date:new Date().toLocaleString("zh-TW"),amount:"",currency:"",customer_name:"",customer_phone:"",customer_address:"",customer_email:""}});return}c("error")},[n]);const g=()=>e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-black mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600",children:s("paymentResult.processing","處理中...")})]}),N=()=>e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-green-100 flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 13l4 4L19 7"})})}),e.jsx("h1",{className:"text-2xl font-bold text-green-600 mb-2",children:s("paymentResult.success","付款成功")}),e.jsx("p",{className:"text-gray-600 mb-6",children:s("paymentResult.successMessage","感謝您的訂購,我們將盡快為您處理訂單")})]}),a&&e.jsxs("div",{className:"bg-gray-50 p-6 rounded-lg space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold mb-4",children:s("paymentResult.orderDetails","訂單詳情")}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-gray-600",children:[s("paymentResult.orderId","訂單編號"),":"]}),e.jsx("span",{className:"font-mono",children:a.value.orderId})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-gray-600",children:[s("paymentResult.orderDate","訂單日期"),":"]}),e.jsx("span",{children:a.value.order_date})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-gray-600",children:[s("paymentResult.amount","訂單金額"),":"]}),e.jsxs("span",{className:"font-semibold",children:[a.value.amount," ",a.value.currency]})]}),e.jsxs("div",{className:"border-t pt-3 mt-4",children:[e.jsx("h3",{className:"font-semibold mb-2",children:s("paymentResult.shippingInfo","收件資訊")}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-600",children:[s("paymentResult.recipient","收件人"),":"]})," ",a.value.customer_name]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-600",children:[s("paymentResult.phone","電話"),":"]})," ",a.value.customer_phone]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-600",children:[s("paymentResult.address","地址"),":"]})," ",a.value.customer_address]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-600",children:[s("paymentResult.email","電子郵件"),":"]})," ",a.value.customer_email]})]})]}),e.jsx("div",{className:"border-t pt-3 mt-4",children:e.jsxs("p",{className:"text-sm text-gray-600",children:[s("paymentResult.deliveryEstimate","預計送達日期"),":",e.jsx("span",{className:"font-semibold text-black ml-1",children:I(new Date,3).toLocaleDateString("zh-TW")})]})})]})]}),e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-sm text-gray-600 mb-4",children:s("paymentResult.emailConfirmation","我們已將訂單確認信發送至您的電子郵件")})})]}),b=()=>e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-red-100 flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("h1",{className:"text-2xl font-bold text-red-600 mb-2",children:s("paymentResult.failed","付款失敗")}),e.jsx("p",{className:"text-gray-600 mb-6",children:s("paymentResult.failedMessage","支付過程中發生錯誤,請稍後重試或聯繫客服")})]}),v=()=>e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-yellow-100 flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-yellow-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),e.jsx("h1",{className:"text-2xl font-bold text-yellow-600 mb-2",children:s("paymentResult.error","處理錯誤")}),e.jsx("p",{className:"text-gray-600 mb-6",children:s("paymentResult.errorMessage","處理支付結果時發生錯誤,請聯繫客服")})]}),w=()=>{var o;return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-blue-50 flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-blue-600 animate-pulse",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}
1),e.jsx("h1",{className:"text-2xl font-bold text-gray-800 mb-2",children:s("paymentResult.processing","訂單處理中")}),e.jsx("p",{className:"text-gray-600 mb-2",children:s("paymentResult.processingMessage","我們已收到您的訂單,正在等待綠界回傳付款結果。")}),((o=a==null?void 0:a.value)==null?void 0:o.orderId)&&e.jsxs("p",{className:"text-sm text-gray-500 font-mono mb-6",children:["#",a.value.orderId]}),e.jsx("p",{className:"text-sm text-gray-600",children:s("paymentResult.processingNote","付款結果通常在數分鐘內由綠界通知我們,付款成功後會寄送確認信至您的 Email。")})]})})};return e.jsx("div",{className:"container mx-auto px-4 pt-24 md:pt-20 pb-16",children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[r==="loading"&&e.jsx(g,{}),r==="success"&&e.jsx(N,{}),r==="processing"&&e.jsx(w,{}),r==="failed"&&e.jsx(b,{}),r==="error"&&e.jsx(v,{}),e.jsxs("div",{className:"text-center mt-8 space-y-4",children:[e.jsx(j,{to:`/${x}/home`,className:"inline-block bg-black text-white px-8 py-3 rounded hover:bg-gray-800 transition-colors",children:s("paymentResult.backHome","返回首頁")}),r!=="success"&&e.jsx("div",{children:e.jsx(j,{to:`/${x}/cart`,className:"inline-block border border-gray-300 text-gray-700 px-8 py-3 rounded hover:bg-gray-50 transition-colors ml-4",children:s("paymentResult.backToCart","返回購物車")})})]})]})})}export{B 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.