fogwind 4 дней назад
Родитель
Сommit
bbb8c6ff44

+ 2 - 2
src/app/(public)/paymentresult/_components/CancelOrFailure.tsx

@@ -68,7 +68,7 @@ export default function CancelOrFailure({
                         {isGuest ?
                         {isGuest ?
                             "payment cancelled! Your order has been cancelled."
                             "payment cancelled! Your order has been cancelled."
                         :
                         :
-                            "Payment cancelled! You can continue to pay."
+                            orderStatus !=='canceled' ? "Payment cancelled! You can continue to pay." : "Order has been cancelled!"
                         }
                         }
                         
                         
                     </p>
                     </p>
@@ -84,7 +84,7 @@ export default function CancelOrFailure({
                 We’ll get started on your order very soon!<br/>
                 We’ll get started on your order very soon!<br/>
                 You’ll receive an order confirmation email with details of your order in an hour, please be sure to check your email and confirm your order, that is very important for us to process your order.
                 You’ll receive an order confirmation email with details of your order in an hour, please be sure to check your email and confirm your order, that is very important for us to process your order.
             </p> */}
             </p> */}
-            {isGuest ?
+            {isGuest || orderStatus ==='canceled' ?
                 <Link href="/" className="mt-6 flex justify-center items-center h-12 border-1 rounded-3xl text-ly-14">
                 <Link href="/" className="mt-6 flex justify-center items-center h-12 border-1 rounded-3xl text-ly-14">
                     Continue Shopping
                     Continue Shopping
                 </Link>
                 </Link>

Разница между файлами не показана из-за своего большого размера
+ 6 - 2
src/app/(public)/paymentresult/_components/Faqs.tsx


+ 2 - 21
src/app/(public)/paymentresult/_components/OrderDetailWrapper.tsx

@@ -5,35 +5,16 @@ import { redirect, RedirectType } from 'next/navigation';
 import Link from "next/link";
 import Link from "next/link";
 import Image from "next/image";
 import Image from "next/image";
 import type {FetchGraphqlResult} from "@/types/graphqlFetch/type";
 import type {FetchGraphqlResult} from "@/types/graphqlFetch/type";
-import type { OrderDetailsData,ProductItemAdditional } from "@/types/customer/type";
+import type { OrderDetailsData } from "@/types/customer/type";
 import {deleteGuestCookieAction} from "@/actions";
 import {deleteGuestCookieAction} from "@/actions";
 import { useConfig } from "@utils/hooks/useConfig";
 import { useConfig } from "@utils/hooks/useConfig";
-import {getAddressFromOrderDetailAddressList} from "@/utils/orderDetailTools";
+import {getAddressFromOrderDetailAddressList,getProductAdditionalInfo} from "@/utils/orderDetailTools";
 import Faqs from "./Faqs";
 import Faqs from "./Faqs";
 
 
 /**
 /**
  * 订单详情里的金额的货币符号不会根据用户选择的货币改变 ,而是固定为下单时使用的货币
  * 订单详情里的金额的货币符号不会根据用户选择的货币改变 ,而是固定为下单时使用的货币
  */
  */
 
 
-function getProductAdditionalInfo(productItem: ProductItemAdditional) { 
-    const attributeKeys = Object.keys(productItem.attributes);
-    let res = '';
-    attributeKeys.forEach(key => {
-      const attribute = productItem.attributes[key];
-      if (attribute) {
-        // option_label value_label
-
-        if(res) {
-            res = res + ', ' + attribute.option_label + ': ' + attribute.value_label;
-        } else {
-            res = attribute.option_label + ': ' + attribute.value_label;
-        }
-      }
-    });
-    return res;
-}
-
-
 export default function OrderDetailWrapper({
 export default function OrderDetailWrapper({
     orderDetailPromise,
     orderDetailPromise,
     isGuest
     isGuest

+ 20 - 1
src/utils/orderDetailTools.ts

@@ -1,4 +1,4 @@
-import type { AddressListInOrderDetails,OrderAddressType } from "@/types/customer/type";
+import type { AddressListInOrderDetails,OrderAddressType,ProductItemAdditional } from "@/types/customer/type";
 import type { CartAddress } from "@/types/cart/type";
 import type { CartAddress } from "@/types/cart/type";
 
 
 export function getAddressFromOrderDetailAddressList(addressList: AddressListInOrderDetails, addressType: OrderAddressType) {
 export function getAddressFromOrderDetailAddressList(addressList: AddressListInOrderDetails, addressType: OrderAddressType) {
@@ -25,6 +25,25 @@ export function getAddressFromOrderDetailAddressList(addressList: AddressListInO
     return res;
     return res;
 
 
 }
 }
+
+export function getProductAdditionalInfo(productItem: ProductItemAdditional) { 
+    const attributeKeys = Object.keys(productItem.attributes);
+    let res = '';
+    attributeKeys.forEach(key => {
+      const attribute = productItem.attributes[key];
+      if (attribute) {
+        // option_label value_label
+
+        if(res) {
+            res = res + ', ' + attribute.option_label + ': ' + attribute.value_label;
+        } else {
+            res = attribute.option_label + ': ' + attribute.value_label;
+        }
+      }
+    });
+    return res;
+}
+
 export function getProductFinalPriceInOrder() {}
 export function getProductFinalPriceInOrder() {}
 // export function getProductAdditinalInOrder(itemAdditional: string) {
 // export function getProductAdditinalInOrder(itemAdditional: string) {
 //     const additinal = JSON.parse(itemAdditional);
 //     const additinal = JSON.parse(itemAdditional);