diff --git a/app/locales/en/translation.json b/app/locales/en/translation.json index 378dcc0..3c609c6 100644 --- a/app/locales/en/translation.json +++ b/app/locales/en/translation.json @@ -88,6 +88,7 @@ "viewAll": "View All", "loadingProductInfo": "Loading product information...", "productNotAvailable": "Product is not available or has been removed", + "productDiscontinued": "This product has been discontinued", "customerService": "Customer Service", "productDetails": "Product Details", "loadingMoreProducts": "Loading more products...", diff --git a/app/locales/fr/translation.json b/app/locales/fr/translation.json index f10ffe2..672d147 100644 --- a/app/locales/fr/translation.json +++ b/app/locales/fr/translation.json @@ -88,6 +88,7 @@ "viewAll": "Voir tout", "loadingProductInfo": "Chargement des informations du produit...", "productNotAvailable": "Le produit n'est pas disponible ou a été supprimé", + "productDiscontinued": "Ce produit a été retiré de la vente", "customerService": "Service client", "productDetails": "Détails du produit", "loadingMoreProducts": "Chargement de plus de produits...", diff --git a/app/locales/zh/translation.json b/app/locales/zh/translation.json index 2a5fa38..6047952 100644 --- a/app/locales/zh/translation.json +++ b/app/locales/zh/translation.json @@ -90,6 +90,7 @@ "viewAll": "查看全部", "loadingProductInfo": "正在加载商品信息...", "productNotAvailable": "商品不可用或已被移除", + "productDiscontinued": "该商品已下架", "customerService": "客服", "productDetails": "商品详情", "loadingMoreProducts": "正在加载更多商品...", diff --git a/app/navigation/AppNavigator.tsx b/app/navigation/AppNavigator.tsx index 444cec1..7ce886d 100644 --- a/app/navigation/AppNavigator.tsx +++ b/app/navigation/AppNavigator.tsx @@ -4,9 +4,13 @@ import { createNativeStackNavigator } from "@react-navigation/native-stack"; import { RootStackParamList } from './types'; import * as Screens from './screens'; import Toast from "react-native-toast-message"; +import { View, Text, Dimensions } from 'react-native'; const Stack = createNativeStackNavigator(); +// 获取屏幕尺寸 +const { height: screenHeight } = Dimensions.get('window'); + // 获取当前路由信息的工具函数 // [DEBUG-ROUTER-LOGGER] 路由跟踪函数 - 生产环境可删除 const getActiveRouteName = (state: NavigationState | PartialState | undefined): string => { @@ -425,7 +429,103 @@ export const AppNavigator = () => { }} /> - + ( + + + {props.text1} + + {props.text2 && ( + + {props.text2} + + )} + + ), + error: (props) => ( + + + {props.text1} + + {props.text2 && ( + + {props.text2} + + )} + + ), + info: (props) => ( + + + {props.text1} + + {props.text2 && ( + + {props.text2} + + )} + + ), + }} + position="top" + topOffset={screenHeight / 2 - 50} + visibilityTime={3000} + /> ); }; \ No newline at end of file diff --git a/app/screens/ProductDetailScreen.tsx b/app/screens/ProductDetailScreen.tsx index b8053de..284cff6 100644 --- a/app/screens/ProductDetailScreen.tsx +++ b/app/screens/ProductDetailScreen.tsx @@ -35,6 +35,7 @@ import { getBurialPointData } from "../store/burialPoint"; import useBurialPointStore from "../store/burialPoint"; import * as ImagePicker from "expo-image-picker"; import * as FileSystem from "expo-file-system"; +import Toast from "react-native-toast-message"; import { productApi, ProductDetailParams, @@ -278,6 +279,16 @@ export const ProductDetailScreen = () => { route.params.offer_id, userStore.user?.user_id ); + + if (res.original_min_price === 0 || res.original_min_price === null) { + navigation.goBack(); + Toast.show({ + type: "error", + text1: t("productDiscontinued"), + }); + setIsLoading(false); + return; + } if (res.skus != null) { const priceSelectedSku = res.skus.find( (item) => item.offer_price === route.params.price diff --git a/app/screens/setting/CountrySetting.tsx b/app/screens/setting/CountrySetting.tsx index 4ed789d..19c60fc 100644 --- a/app/screens/setting/CountrySetting.tsx +++ b/app/screens/setting/CountrySetting.tsx @@ -94,7 +94,6 @@ export const CountrySetting = () => { Toast.show({ text1: t('settings.success'), - type: "success", visibilityTime: 1000, });