Files
template-10579/src/credit/customer/index.tsx
赵忠林 338edaac13 feat(credit): 重构客户管理页面为订单管理功能
- 在app.config.ts中添加creditMpCustomer相关页面配置
- 将src/credit/customer/index.config.ts中的标题从'客户联系人管理'改为'企业经办人订单管理'
- 重写src/credit/customer/index.tsx文件,将原有客户列表功能替换为企业经办人订单列表
- 实现订单搜索、筛选和详情查看功能
- 添加mock数据用于展示企业经办人、企业名称和跟进人信息
- 创建新的API模型和接口文件用于小程序端客户管理功能
2026-03-16 21:52:46 +08:00

116 lines
4.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { useMemo, useState } from 'react'
import { View, Text } from '@tarojs/components'
import { ConfigProvider, Empty, Popup, SearchBar } from '@nutui/nutui-react-taro'
type AgentOrderRow = {
id: string
agentName: string
companyName: string
follower: string
// 预留:若经办人为老板,可用于后续扩展“老板名下多企业订单”
isBoss?: boolean
}
const MOCK_LIST: AgentOrderRow[] = [
{ id: '1', agentName: '邓莉莉', companyName: '网宿公司', follower: '章鱼' },
{ id: '2', agentName: '邓莉莉', companyName: '飞数公司', follower: '章鱼' }
]
export default function CreditCustomerPage() {
const [searchValue, setSearchValue] = useState('')
const [detailVisible, setDetailVisible] = useState(false)
const [activeRow, setActiveRow] = useState<AgentOrderRow | null>(null)
const filteredList = useMemo(() => {
const q = searchValue.trim()
if (!q) return MOCK_LIST
return MOCK_LIST.filter(r => String(r.agentName || '').includes(q))
}, [searchValue])
const totalText = useMemo(() => `${filteredList.length}个订单`, [filteredList.length])
return (
<View className="bg-gray-50 min-h-screen">
<ConfigProvider>
<View className="py-2 px-3">
<SearchBar placeholder="请输入经办人姓名" value={searchValue} onChange={setSearchValue} />
</View>
<View className="px-3">
<View className="bg-yellow-50 border border-yellow-200 rounded-lg p-3 text-sm text-yellow-900">
<View className="font-medium mb-1"></View>
<View></View>
<View></View>
<View></View>
<View></View>
<View className="mt-2 text-xs text-yellow-700">zzl</View>
</View>
</View>
<View className="px-3 mt-3 flex items-center justify-between">
<Text className="text-sm text-gray-700"></Text>
<Text className="text-sm text-gray-600">{totalText}</Text>
</View>
<View className="px-3 mt-2">
<View className="bg-white rounded-lg overflow-hidden border border-gray-100">
<View className="flex bg-gray-50 text-xs text-gray-600 px-3 py-2">
<View className="flex-1"></View>
<View className="flex-1"></View>
<View className="flex-1"></View>
</View>
{filteredList.length === 0 ? (
<View className="py-10">
<Empty description="暂无数据" />
</View>
) : (
filteredList.map(r => (
<View
key={r.id}
className="flex px-3 py-3 text-sm text-gray-900 border-t border-gray-100"
onClick={() => {
setActiveRow(r)
setDetailVisible(true)
}}
>
<View className="flex-1 truncate">{r.agentName}</View>
<View className="flex-1 truncate">{r.companyName}</View>
<View className="flex-1 truncate">{r.follower}</View>
</View>
))
)}
</View>
</View>
<Popup
visible={detailVisible}
position="bottom"
style={{ height: '45vh' }}
onClose={() => setDetailVisible(false)}
>
<View className="p-4">
<View className="flex items-center justify-between mb-3">
<Text className="text-base font-medium"></Text>
<Text className="text-sm text-gray-500" onClick={() => setDetailVisible(false)}>
</Text>
</View>
{activeRow ? (
<View className="text-sm text-gray-700 leading-6">
<View>{activeRow.agentName}</View>
<View>{activeRow.companyName}</View>
<View>{activeRow.follower}</View>
<View className="mt-2 text-xs text-gray-500"></View>
</View>
) : (
<View className="text-sm text-gray-500"></View>
)}
</View>
</Popup>
</ConfigProvider>
</View>
)
}