Browse Source

商品详情空sku的情况

main
Mac 2 weeks ago
parent
commit
3a2a3acc8d
  1. 1
      app/locales/en/translation.json
  2. 1
      app/locales/fr/translation.json
  3. 1
      app/locales/zh/translation.json
  4. 102
      app/navigation/AppNavigator.tsx
  5. 11
      app/screens/ProductDetailScreen.tsx
  6. 1
      app/screens/setting/CountrySetting.tsx

1
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...",

1
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...",

1
app/locales/zh/translation.json

@ -90,6 +90,7 @@
"viewAll": "查看全部",
"loadingProductInfo": "正在加载商品信息...",
"productNotAvailable": "商品不可用或已被移除",
"productDiscontinued": "该商品已下架",
"customerService": "客服",
"productDetails": "商品详情",
"loadingMoreProducts": "正在加载更多商品...",

102
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<RootStackParamList>();
// 获取屏幕尺寸
const { height: screenHeight } = Dimensions.get('window');
// 获取当前路由信息的工具函数
// [DEBUG-ROUTER-LOGGER] 路由跟踪函数 - 生产环境可删除
const getActiveRouteName = (state: NavigationState | PartialState<NavigationState> | undefined): string => {
@ -425,7 +429,103 @@ export const AppNavigator = () => {
}}
/>
</Stack.Navigator>
<Toast />
<Toast
config={{
success: (props) => (
<View style={{
backgroundColor: '#000000',
paddingHorizontal: 20,
paddingVertical: 12,
borderRadius: 8,
marginHorizontal: 20,
alignItems: 'center',
justifyContent: 'center',
}}>
<Text style={{
color: '#FFFFFF',
fontSize: 16,
textAlign: 'center',
}}>
{props.text1}
</Text>
{props.text2 && (
<Text style={{
color: '#FFFFFF',
fontSize: 14,
textAlign: 'center',
marginTop: 4,
opacity: 0.8,
}}>
{props.text2}
</Text>
)}
</View>
),
error: (props) => (
<View style={{
backgroundColor: '#000000',
paddingHorizontal: 20,
paddingVertical: 12,
borderRadius: 8,
marginHorizontal: 20,
alignItems: 'center',
justifyContent: 'center',
}}>
<Text style={{
color: '#FFFFFF',
fontSize: 16,
textAlign: 'center',
}}>
{props.text1}
</Text>
{props.text2 && (
<Text style={{
color: '#FFFFFF',
fontSize: 14,
textAlign: 'center',
marginTop: 4,
opacity: 0.8,
}}>
{props.text2}
</Text>
)}
</View>
),
info: (props) => (
<View style={{
backgroundColor: '#000000',
paddingHorizontal: 20,
paddingVertical: 12,
borderRadius: 8,
marginHorizontal: 20,
alignItems: 'center',
justifyContent: 'center',
}}>
<Text style={{
color: '#FFFFFF',
fontSize: 16,
textAlign: 'center',
}}>
{props.text1}
</Text>
{props.text2 && (
<Text style={{
color: '#FFFFFF',
fontSize: 14,
textAlign: 'center',
marginTop: 4,
opacity: 0.8,
}}>
{props.text2}
</Text>
)}
</View>
),
}}
position="top"
topOffset={screenHeight / 2 - 50}
visibilityTime={3000}
/>
</NavigationContainer>
);
};

11
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

1
app/screens/setting/CountrySetting.tsx

@ -94,7 +94,6 @@ export const CountrySetting = () => {
Toast.show({
text1: t('settings.success'),
type: "success",
visibilityTime: 1000,
});

Loading…
Cancel
Save