Ver Fonte

✨ feat(order): 优化车辆类型显示逻辑

- 引入getVehicleTypeText函数统一处理车辆类型文本转换
- 更新班次信息区域的车辆类型显示,使用统一函数格式化文本
- 修改车辆型号显示,直接使用getVehicleTypeText获取格式化文本
yourname há 3 meses atrás
pai
commit
8843175b56
1 ficheiros alterados com 3 adições e 2 exclusões
  1. 3 2
      mini/src/pages/order/index.tsx

+ 3 - 2
mini/src/pages/order/index.tsx

@@ -10,6 +10,7 @@ import { Button } from '@/components/ui/button'
 import { Card, CardContent } from '@/components/ui/card'
 import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog'
 import { showToast } from '@/utils/toast'
+import { getVehicleTypeText } from '@/types/route.types'
 import type { InferResponseType , InferRequestType} from 'hono/client'
 import {
   requestWechatPayment,
@@ -540,7 +541,7 @@ export default function OrderPage() {
                   {isCharter ? '包车服务' : '班次信息'}
                 </Text>
                 <View className="bg-primary text-white px-4 py-2 rounded-full text-xs font-semibold tracking-wide">
-                  {schedule.travelMode === 'charter' ? '专车包车' : (schedule.vehicleType === 'business' ? '商务拼车' : '大巴拼车')}
+                  {schedule.travelMode === 'charter' ? '专车包车' : (getVehicleTypeText(schedule.vehicleType) + '拼车')}
                 </View>
               </View>
 
@@ -551,7 +552,7 @@ export default function OrderPage() {
                 </View>
                 <View className="flex justify-between items-center">
                   <Text className={`text-sm font-medium ${isCharter ? 'text-gray-300' : 'text-gray-600'}`}>车辆型号</Text>
-                  <Text className={`text-sm font-semibold ${isCharter ? 'text-white' : 'text-gray-900'}`}>{schedule.vehicleType}</Text>
+                  <Text className={`text-sm font-semibold ${isCharter ? 'text-white' : 'text-gray-900'}`}>{getVehicleTypeText(schedule.vehicleType)}</Text>
                 </View>
                 <View className="flex justify-between items-center">
                   <Text className={`text-sm font-medium ${isCharter ? 'text-gray-300' : 'text-gray-600'}`}>上车地点</Text>