diff --git a/src/constants/theme.ts b/src/constants/theme.ts index ab19f60..2257519 100644 --- a/src/constants/theme.ts +++ b/src/constants/theme.ts @@ -1,42 +1,28 @@ -// 将Flutter的颜色值转换为React Native可用的格式 -// Flutter: 0xff05dcef -> React Native: #05dcef - export const theme = { colors: { // 基础颜色 - primary: '#4158D0', // 主色调 - secondary: '#C850C0', // 次要色调 - tertiary: '#FFCC70', // 第三色调 + aqua: '#05DCEF', // 青色主色调 (0xff05dcef) background: '#ffffff', // 背景色 + backgroundGray: '#F5F5F5', // 灰色背景 text: '#333333', // 文本颜色 textLight: '#666666', // 次要文本颜色 border: '#dddddd', // 边框颜色 error: '#ff3b30', // 错误颜色 - success: '#4cd964', // 成功颜色 - warning: '#ff9500', // 警告颜色 cyan: '#00FFFF', // 青色背景 + lightGreen: '#7FFFAA', // 浅绿色 // 渐变色配置 gradients: { - primary: ['#4158D0', '#C850C0', '#FFCC70'], // 主要渐变(蓝紫金) + primary: ['#05DCEF', '#7DE2F5', '#B8F2FF'], // 主要渐变(青蓝白,小清新) contrast: ['#00F5A0', '#00D9F5'], // 对比渐变(绿青) - card: ['#9795F0', '#E3C3F1'], // 卡片渐变(柔和紫色) - login: ['#4158D0', '#C850C0', '#FFCC70'], // 登录页面专用渐变 - loginWave: ['rgba(255, 255, 255, 0.3)', 'rgba(255, 255, 255, 0.2)'], // 登录页面波浪渐变 - header: ['#4158D0', '#C850C0'], // 头部渐变 - button: ['#4158D0', '#C850C0'], // 按钮渐变 - // 波浪背景渐变 - wave: { - start: 'rgba(255, 255, 255, 0.3)', - middle: 'rgba(255, 255, 255, 0.2)', - end: 'rgba(255, 255, 255, 0.1)' - } + header: ['#05DCEF', '#7DE2F5'], // 头部渐变 + button: ['#05DCEF', '#7DE2F5'], // 按钮渐变 }, // 图表颜色 chart: { - blue: '#0077B6', // 深蓝色 - orange: '#FB8500', // 明亮的橙色 + cyan: '#00FFFF', // 青色 + lightGreen: '#7FFFAA', // 浅绿色 }, }, @@ -103,11 +89,7 @@ export const theme = { }, }, - // 波浪效果配置 - wave: { - height: 60, - opacity: 1, - }, + }; // 类型定义 diff --git a/src/screens/home/HomeScreen.tsx b/src/screens/home/HomeScreen.tsx index f200dd8..2065ffe 100644 --- a/src/screens/home/HomeScreen.tsx +++ b/src/screens/home/HomeScreen.tsx @@ -56,14 +56,14 @@ export const HomeScreen: React.FC = () => { { name: '空闲', population: 40, - color: theme.colors.chart.blue, + color: theme.colors.chart.cyan, legendFontColor: theme.colors.textLight, legendFontSize: theme.fontSize.regular, }, { name: '占用', population: 60, - color: theme.colors.chart.orange, + color: theme.colors.chart.lightGreen, legendFontColor: theme.colors.textLight, legendFontSize: theme.fontSize.regular, }, @@ -77,14 +77,14 @@ export const HomeScreen: React.FC = () => { if (!fontLoaded) { return ( - + 加载图标中... ); } return ( - + {/* 头部区域 */} {/* 渐变背景 */} @@ -141,7 +141,7 @@ export const HomeScreen: React.FC = () => { {/* 主体内容 */} - + {/* 快捷操作区 */} @@ -210,7 +210,7 @@ export const HomeScreen: React.FC = () => { navigation.navigate(item.route); }}> - + {item.title} diff --git a/src/screens/stockIn/StockInEmpty.tsx b/src/screens/stockIn/StockInEmpty.tsx index 69c17af..8782546 100644 --- a/src/screens/stockIn/StockInEmpty.tsx +++ b/src/screens/stockIn/StockInEmpty.tsx @@ -9,7 +9,6 @@ import { SafeAreaView, ActivityIndicator, } from 'react-native'; -import {httpService} from '../../services/http'; import {NativeStackNavigationProp} from '@react-navigation/native-stack'; import {useNavigation} from '@react-navigation/native'; import {RootStackParamList} from '../../navigation/types'; @@ -17,11 +16,15 @@ import {useTheme} from '../../contexts/ThemeContext'; import Icon from 'react-native-vector-icons/MaterialIcons'; import LinearGradient from 'react-native-linear-gradient'; import Svg, {Path} from 'react-native-svg'; +import axios from 'axios'; interface StockInEmptyResponse { code: number; message: string; - data: string; + data: { + code: number; + message: string; + }; } type StockInEmptyScreenNavigationProp = NativeStackNavigationProp< @@ -46,22 +49,19 @@ export const StockInEmpty: React.FC = () => { try { setLoading(true); - const response = await httpService.post( + const response = await axios.post( '/api/vehicle/empty-in', {vehicleNo: vehicleNo.trim()} ); - if (response.code !== 200) { + if (response.status !== 200) { Alert.alert('警告', '服务器请求失败', [ {text: '我知道了', style: 'cancel'}, ]); return; } - // 确保response.data是字符串类型 - const responseData = typeof response.data === 'string' - ? JSON.parse(response.data) - : response.data; + const responseData = response.data; if (responseData.code === 200) { Alert.alert('成功', '', [ @@ -74,7 +74,7 @@ export const StockInEmpty: React.FC = () => { ]); } } catch (error) { - Alert.alert('请求发生错误', `请求服务器发生错误:${error}`, [ + Alert.alert('请求发生错误', `请求服务器发生错误:${error instanceof Error ? error.message : String(error)}`, [ {text: '我知道了', style: 'cancel'}, ]); } finally { @@ -86,7 +86,7 @@ export const StockInEmpty: React.FC = () => { {/* 头部导航栏 */} @@ -108,23 +108,17 @@ export const StockInEmpty: React.FC = () => { style={styles.waveSvg} preserveAspectRatio="none"> {/* 主体内容 */} - - + {/* 说明文字 */} - - + + 请扫描或输入载具号进行空载具入库操作 @@ -139,7 +133,7 @@ export const StockInEmpty: React.FC = () => { borderColor: theme.colors.border, backgroundColor: `${theme.colors.background}CC`, }]}> - + { {/* 提交按钮 */} diff --git a/src/screens/stockIn/StockInWheelManual.tsx b/src/screens/stockIn/StockInWheelManual.tsx index 44e9958..381a2bd 100644 --- a/src/screens/stockIn/StockInWheelManual.tsx +++ b/src/screens/stockIn/StockInWheelManual.tsx @@ -42,9 +42,6 @@ const StockInWheelManual: React.FC = () => { const [packageData, setPackageData] = useState([]); const [packageDataId, setPackageDataId] = useState(0); const [lastProcessedVehicleCode, setLastProcessedVehicleCode] = useState(''); - const [areaID, setAreaID] = useState('有卤'); - const [status, setStatus] = useState('合格'); - const [factory, setFactory] = useState('二厂'); const [loading, setLoading] = useState(false); const vehicleInputRef = useRef(null); @@ -176,15 +173,9 @@ const StockInWheelManual: React.FC = () => { return; } - const areaIDIndex = areaID === '有卤' ? 1 : 2; - const factoryIndex = factory === '二厂' ? 2 : 3; - const statusIndex = { - 合格: 1, - 不合格: 2, - 封存: 3, - 待检: 4, - 进口物料: 5, - }[status] || 1; + const areaIDIndex = 1; // 默认有卤 + const factoryIndex = 2; // 默认二厂 + const statusIndex = 1; // 默认合格 const confirm = await new Promise(resolve => Alert.alert( @@ -239,11 +230,11 @@ const StockInWheelManual: React.FC = () => { {/* 头部导航栏 */} - navigation.goBack()}> @@ -263,23 +254,17 @@ const StockInWheelManual: React.FC = () => { style={styles.waveSvg} preserveAspectRatio="none"> - - + {/* 信息提示区 */} - - + + 请先扫描载具号,然后添加物料信息进行码盘入库 @@ -292,7 +277,7 @@ const StockInWheelManual: React.FC = () => { borderColor: theme.colors.border, backgroundColor: `${theme.colors.background}CC`, }]}> - + { borderColor: theme.colors.border, backgroundColor: `${theme.colors.background}CC`, }]}> - + { - {/* 选项区域 */} - - {/* 区域选择 */} - - 区域 - - setAreaID('有卤')}> - - 有卤 - - - setAreaID('无卤')}> - - 无卤 - - - - - - {/* 工厂选择 */} - - 工厂 - - setFactory('二厂')}> - - 二厂 - - - setFactory('三厂')}> - - 三厂 - - - - - - {/* 状态选择 - 改为与区域、工厂相同的样式 */} - - 状态 - - - - {['合格', '不合格', '封存', '待检', '进口物料'].map((item) => ( - setStatus(item)}> - - {item} - - - ))} - - - - - - {/* 操作按钮区 */} @@ -471,7 +340,7 @@ const StockInWheelManual: React.FC = () => { @@ -489,37 +358,32 @@ const StockInWheelManual: React.FC = () => { {/* 物料列表 */} - + 已添加物料 ({packageData.length}) - {packageData.map((item, index) => ( + {packageData.map((item) => ( - + {/* 卡片头部 */} - + 序号:{item.id} - + 采购单号:{item.segment1} showDetails(item)}> - + { - 物料号 - {item.itemId} + 物料号 + {item.itemId} - 批次号 - {item.batch} + 批次号 + {item.batch} - 数量 + 数量 modifyNumber(item.id)}> - + {item.quantity} - + - 重量 - {item.weight} + 重量 + {item.weight} - 生产日期 - {item.productData} + 生产日期 + {item.productData} @@ -576,7 +440,7 @@ const StockInWheelManual: React.FC = () => { {loading && ( - + 正在请求入库... @@ -675,36 +539,7 @@ const styles = StyleSheet.create({ clearButton: { padding: 4, }, - optionsContainer: { - marginBottom: 20, - }, - optionGroup: { - marginBottom: 16, - }, - optionLabel: { - fontSize: 16, - marginBottom: 8, - fontWeight: '500', - }, - radioGroup: { - flexDirection: 'row', - gap: 12, - }, - radioButton: { - borderWidth: 1, - borderRadius: 8, - paddingVertical: 8, - paddingHorizontal: 16, - minWidth: 80, - alignItems: 'center', - }, - radioButtonActive: { - borderColor: 'transparent', - }, - radioText: { - fontSize: 14, - fontWeight: '500', - }, + buttonGroup: { flexDirection: 'row', gap: 12,