|
@@ -1,11 +1,10 @@
|
|
|
import React, { useState, useEffect } from 'react'
|
|
import React, { useState, useEffect } from 'react'
|
|
|
-import { View, Text, ScrollView, Input, Textarea } from '@tarojs/components'
|
|
|
|
|
|
|
+import { View, Text, ScrollView, Input } from '@tarojs/components'
|
|
|
import Taro from '@tarojs/taro'
|
|
import Taro from '@tarojs/taro'
|
|
|
import { useQuery } from '@tanstack/react-query'
|
|
import { useQuery } from '@tanstack/react-query'
|
|
|
import { Navbar } from '@d8d/mini-shared-ui-components/components/navbar'
|
|
import { Navbar } from '@d8d/mini-shared-ui-components/components/navbar'
|
|
|
import { enterpriseOrderClient } from '../../api'
|
|
import { enterpriseOrderClient } from '../../api'
|
|
|
|
|
|
|
|
-type OrderStatus = 'draft' | 'confirmed' | 'in_progress' | 'completed' | 'cancelled'
|
|
|
|
|
|
|
|
|
|
interface OrderDetailData {
|
|
interface OrderDetailData {
|
|
|
id: any
|
|
id: any
|
|
@@ -32,20 +31,11 @@ const OrderDetail: React.FC = () => {
|
|
|
const orderIdParam = router.params.id ? parseInt(router.params.id) : null
|
|
const orderIdParam = router.params.id ? parseInt(router.params.id) : null
|
|
|
const orderId = orderIdParam && !Number.isNaN(orderIdParam) ? orderIdParam : null
|
|
const orderId = orderIdParam && !Number.isNaN(orderIdParam) ? orderIdParam : null
|
|
|
|
|
|
|
|
- const [orderStatus, setOrderStatus] = useState<OrderStatus>('in_progress')
|
|
|
|
|
- const [note, setNote] = useState('')
|
|
|
|
|
const [persons, setPersons] = useState<any[]>([])
|
|
const [persons, setPersons] = useState<any[]>([])
|
|
|
const [videos, setVideos] = useState<any[]>([])
|
|
const [videos, setVideos] = useState<any[]>([])
|
|
|
const [checkinStats, setCheckinStats] = useState({ current: 0, total: 0, percentage: 0 })
|
|
const [checkinStats, setCheckinStats] = useState({ current: 0, total: 0, percentage: 0 })
|
|
|
const [salaryVideoStats, setSalaryVideoStats] = useState({ current: 0, total: 0, percentage: 0 })
|
|
const [salaryVideoStats, setSalaryVideoStats] = useState({ current: 0, total: 0, percentage: 0 })
|
|
|
const [taxVideoStats, setTaxVideoStats] = useState({ current: 0, total: 0, percentage: 0 })
|
|
const [taxVideoStats, setTaxVideoStats] = useState({ current: 0, total: 0, percentage: 0 })
|
|
|
- const statusOptions = [
|
|
|
|
|
- { value: 'draft', label: '草稿', class: 'bg-gray-100 text-gray-800' },
|
|
|
|
|
- { value: 'confirmed', label: '已确认', class: 'bg-blue-100 text-blue-800' },
|
|
|
|
|
- { value: 'in_progress', label: '进行中', class: 'bg-green-100 text-green-800' },
|
|
|
|
|
- { value: 'completed', label: '已完成', class: 'bg-purple-100 text-purple-800' },
|
|
|
|
|
- { value: 'cancelled', label: '已取消', class: 'bg-red-100 text-red-800' },
|
|
|
|
|
- ]
|
|
|
|
|
|
|
|
|
|
// 获取订单详情查询函数
|
|
// 获取订单详情查询函数
|
|
|
const fetchOrderDetailQuery = async (id: number) => {
|
|
const fetchOrderDetailQuery = async (id: number) => {
|
|
@@ -108,7 +98,6 @@ const OrderDetail: React.FC = () => {
|
|
|
// 处理查询成功
|
|
// 处理查询成功
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (order) {
|
|
if (order) {
|
|
|
- setOrderStatus(order.status || 'draft')
|
|
|
|
|
// TODO: 获取关联人才、视频、统计数据
|
|
// TODO: 获取关联人才、视频、统计数据
|
|
|
// 暂时使用空数组
|
|
// 暂时使用空数组
|
|
|
setPersons([])
|
|
setPersons([])
|
|
@@ -142,21 +131,8 @@ const OrderDetail: React.FC = () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- const handleStatusChange = (newStatus: OrderStatus) => {
|
|
|
|
|
- setOrderStatus(newStatus)
|
|
|
|
|
- console.log('更新订单状态:', newStatus)
|
|
|
|
|
- // TODO: 调用API更新订单状态
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- const handleSaveNote = () => {
|
|
|
|
|
- console.log('保存备注:', note)
|
|
|
|
|
- // TODO: 调用API保存备注
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- const handleEditOrder = () => {
|
|
|
|
|
- console.log('编辑订单')
|
|
|
|
|
- // TODO: 跳转到编辑页面
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
const handleDownloadReport = () => {
|
|
const handleDownloadReport = () => {
|
|
|
console.log('下载报告')
|
|
console.log('下载报告')
|
|
@@ -295,11 +271,8 @@ const OrderDetail: React.FC = () => {
|
|
|
|
|
|
|
|
{/* 关联人才卡片 */}
|
|
{/* 关联人才卡片 */}
|
|
|
<View className="card bg-white p-4 mb-4">
|
|
<View className="card bg-white p-4 mb-4">
|
|
|
- <View className="flex justify-between items-center mb-3">
|
|
|
|
|
|
|
+ <View className="flex items-center mb-3">
|
|
|
<Text className="font-semibold text-gray-700">关联人才</Text>
|
|
<Text className="font-semibold text-gray-700">关联人才</Text>
|
|
|
- <View className="flex items-center text-blue-500 text-xs" onClick={() => console.log('添加人才')}>
|
|
|
|
|
- <Text>添加人才</Text>
|
|
|
|
|
- </View>
|
|
|
|
|
</View>
|
|
</View>
|
|
|
<View className="space-y-3">
|
|
<View className="space-y-3">
|
|
|
{persons.map((person) => (
|
|
{persons.map((person) => (
|
|
@@ -354,40 +327,10 @@ const OrderDetail: React.FC = () => {
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
|
|
|
|
|
- {/* 状态管理卡片 */}
|
|
|
|
|
- <View className="card bg-white p-4 mb-4">
|
|
|
|
|
- <Text className="font-semibold text-gray-700 mb-3">状态管理</Text>
|
|
|
|
|
- <View className="flex space-x-2 mb-3">
|
|
|
|
|
- {statusOptions.map((option) => (
|
|
|
|
|
- <View
|
|
|
|
|
- key={option.value}
|
|
|
|
|
- className={`flex items-center justify-center text-xs px-3 py-1 rounded-full ${option.value === orderStatus ? option.class : 'bg-gray-100 text-gray-800'}`}
|
|
|
|
|
- onClick={() => handleStatusChange(option.value as OrderStatus)}
|
|
|
|
|
- >
|
|
|
|
|
- <Text>{option.label}</Text>
|
|
|
|
|
- </View>
|
|
|
|
|
- ))}
|
|
|
|
|
- </View>
|
|
|
|
|
- <Text className="text-xs text-gray-500 mb-3">当前状态: {statusOptions.find(opt => opt.value === orderStatus)?.label}</Text>
|
|
|
|
|
- </View>
|
|
|
|
|
|
|
|
|
|
- {/* 备注和操作日志卡片 */}
|
|
|
|
|
|
|
+ {/* 操作日志卡片 */}
|
|
|
<View className="card bg-white p-4 mb-4">
|
|
<View className="card bg-white p-4 mb-4">
|
|
|
- <Text className="font-semibold text-gray-700 mb-3">添加备注</Text>
|
|
|
|
|
- <Textarea
|
|
|
|
|
- className="border border-gray-300 rounded-lg px-3 py-2 text-sm mb-3"
|
|
|
|
|
- placeholder="请输入备注内容..."
|
|
|
|
|
- value={note}
|
|
|
|
|
- onInput={(e) => setNote(e.detail.value)}
|
|
|
|
|
- />
|
|
|
|
|
- <View
|
|
|
|
|
- className="flex items-center justify-center bg-blue-500 text-white text-xs px-3 py-2 rounded-lg"
|
|
|
|
|
- onClick={handleSaveNote}
|
|
|
|
|
- >
|
|
|
|
|
- <Text>保存备注</Text>
|
|
|
|
|
- </View>
|
|
|
|
|
-
|
|
|
|
|
- <Text className="font-semibold text-gray-700 mt-4 mb-3">操作日志</Text>
|
|
|
|
|
|
|
+ <Text className="font-semibold text-gray-700 mb-3">操作日志</Text>
|
|
|
<View className="space-y-2 text-sm">
|
|
<View className="space-y-2 text-sm">
|
|
|
<View className="flex justify-between">
|
|
<View className="flex justify-between">
|
|
|
<Text className="text-gray-600">状态变更为进行中</Text>
|
|
<Text className="text-gray-600">状态变更为进行中</Text>
|
|
@@ -407,12 +350,6 @@ const OrderDetail: React.FC = () => {
|
|
|
{/* 操作按钮区域 */}
|
|
{/* 操作按钮区域 */}
|
|
|
<View className="card bg-white p-4 mb-4">
|
|
<View className="card bg-white p-4 mb-4">
|
|
|
<View className="flex flex-col space-y-2">
|
|
<View className="flex flex-col space-y-2">
|
|
|
- <View
|
|
|
|
|
- className="flex items-center justify-center bg-blue-500 text-white text-sm px-4 py-2 rounded-lg"
|
|
|
|
|
- onClick={handleEditOrder}
|
|
|
|
|
- >
|
|
|
|
|
- <Text>编辑订单</Text>
|
|
|
|
|
- </View>
|
|
|
|
|
<View
|
|
<View
|
|
|
className="flex items-center justify-center bg-green-500 text-white text-sm px-4 py-2 rounded-lg"
|
|
className="flex items-center justify-center bg-green-500 text-white text-sm px-4 py-2 rounded-lg"
|
|
|
onClick={handleDownloadReport}
|
|
onClick={handleDownloadReport}
|