diff --git a/src/api/shop/shopDealerOrder/model/index.ts b/src/api/shop/shopDealerOrder/model/index.ts index 68b4928..6cbac61 100644 --- a/src/api/shop/shopDealerOrder/model/index.ts +++ b/src/api/shop/shopDealerOrder/model/index.ts @@ -30,6 +30,8 @@ export interface ShopDealerOrder { isSettled?: number; // 结算时间 settleTime?: number; + // 订单备注 + comments?: string; // 商城ID tenantId?: number; // 创建时间 @@ -47,5 +49,7 @@ export interface ShopDealerOrderParam extends PageParam { secondUserId?: number; thirdUserId?: number; userId?: number; + isInvalid?: number; + isSettled?: number; keywords?: string; } diff --git a/src/dealer/customer/index.tsx b/src/dealer/customer/index.tsx index bc316ec..14ec7dd 100644 --- a/src/dealer/customer/index.tsx +++ b/src/dealer/customer/index.tsx @@ -1,7 +1,7 @@ import {useState, useEffect, useCallback} from 'react' import {View, Text} from '@tarojs/components' import Taro, {useDidShow} from '@tarojs/taro' -import {Loading, InfiniteLoading, Empty, Space, Tabs, TabPane, Tag, Button} from '@nutui/nutui-react-taro' +import {Loading, InfiniteLoading, Empty, Space, Tabs, TabPane, Tag, Button, SearchBar} from '@nutui/nutui-react-taro' import {Phone, AngleDoubleLeft} from '@nutui/icons-react-taro' import type {ShopDealerApply, ShopDealerApply as UserType} from "@/api/shop/shopDealerApply/model"; import { @@ -26,7 +26,8 @@ const CustomerIndex = () => { const [list, setList] = useState([]) const [loading, setLoading] = useState(false) const [activeTab, setActiveTab] = useState('all') - const [searchValue, _] = useState('') + const [searchValue, setSearchValue] = useState('') + const [displaySearchValue, setDisplaySearchValue] = useState('') const [page, setPage] = useState(1) const [hasMore, setHasMore] = useState(true) @@ -227,13 +228,22 @@ const CustomerIndex = () => { } + // 防抖搜索功能 + useEffect(() => { + const timer = setTimeout(() => { + setDisplaySearchValue(searchValue); + }, 300); // 300ms 防抖 + + return () => clearTimeout(timer); + }, [searchValue]); + // 根据搜索条件筛选数据(状态筛选已在API层面处理) const getFilteredList = () => { let filteredList = list; // 按搜索关键词筛选 - if (searchValue.trim()) { - const keyword = searchValue.trim().toLowerCase(); + if (displaySearchValue.trim()) { + const keyword = displaySearchValue.trim().toLowerCase(); filteredList = filteredList.filter(customer => (customer.realName && customer.realName.toLowerCase().includes(keyword)) || (customer.dealerName && customer.dealerName.toLowerCase().includes(keyword)) || @@ -466,56 +476,81 @@ const CustomerIndex = () => { // 渲染客户列表 const renderCustomerList = () => { const filteredList = getFilteredList(); + const isSearching = displaySearchValue.trim().length > 0; return ( - - { - // 滚动事件处理 - }} - onScrollToUpper={() => { - // 滚动到顶部事件处理 - }} - loadingText={ - <> - 加载中... - - } - loadMoreText={ - filteredList.length === 0 ? ( - - ) : ( - - 没有更多了 + + {/* 搜索结果统计 */} + {isSearching && ( + + + 搜索 "{displaySearchValue}" 的结果,共找到 {filteredList.length} 条记录 + + + )} + + + { + // 滚动事件处理 + }} + onScrollToUpper={() => { + // 滚动到顶部事件处理 + }} + loadingText={ + <> + 加载中... + + } + loadMoreText={ + filteredList.length === 0 ? ( + + ) : ( + + 没有更多了 + + ) + } + > + {loading && filteredList.length === 0 ? ( + + + 加载中... - ) - } - > - {loading && filteredList.length === 0 ? ( - - - 加载中... - - ) : ( - filteredList.map(renderCustomerItem) - )} - + ) : ( + filteredList.map(renderCustomerItem) + )} + + ); }; return ( + {/* 搜索栏 */} + + setSearchValue(value)} + onClear={() => { + setSearchValue(''); + setDisplaySearchValue(''); + }} + clearable + /> + {/* 顶部Tabs */} diff --git a/src/dealer/index.tsx b/src/dealer/index.tsx index 2c9d6a0..498c7ce 100644 --- a/src/dealer/index.tsx +++ b/src/dealer/index.tsx @@ -129,7 +129,7 @@ const DealerIndex: React.FC = () => { {dealerUser && ( - 佣金统计 + 收益统计 { } const result = await pageShopDealerOrder({ + isInvalid: 0, page, limit: 10 }) @@ -91,7 +92,7 @@ const DealerOrders: React.FC = () => { }, [fetchOrders]) const getStatusText = (isSettled?: number, isInvalid?: number) => { - if (isInvalid === 1) return '已失效' + if (isInvalid === 1) return '未签约' if (isSettled === 1) return '已结算' return '待结算' } @@ -106,7 +107,7 @@ const DealerOrders: React.FC = () => { - 订单号:{order.orderNo} + 电费收益 {getStatusText(order.isSettled, order.isInvalid)} @@ -115,19 +116,19 @@ const DealerOrders: React.FC = () => { - 订单金额:¥{order.orderPrice || '0.00'} + 结算金额:¥{order.orderPrice || '0.00'} - - 我的佣金:¥{order.userCommission} + + ¥{(Number(order.orderPrice) * 10).toFixed(2)} - 客户:{order.customerName} + 客户:{order.comments} - {order.createTime} + {order.settleTime}