import { RefreshCw as ActionRefreshCw } from '@/components/common/icons/ActionIcons'; import TableEmpty from '../../components/common/table/TableEmpty'; import TableToolbar from '../../components/common/table/TableToolbar'; import React, { useCallback, useEffect, useState } from 'react'; import { Banner, Button, Card, Descriptions, Modal, Table, Tag, Typography, } from '@/components/ui'; import { useTranslation } from 'react-i18next'; import { API, showError, showSuccess } from '../../helpers'; const { Text } = Typography; const uToYuan = (u) => u === undefined || u === null ? '-' : (u / 1e6).toFixed(2); /** 我的提成(内部销售自助对账,v2.0 六章:次月对账、3 工作日申诉期) */ export default function MyCommission() { const { t } = useTranslation(); const [bills, setBills] = useState([]); const [detail, setDetail] = useState(null); const [loading, setLoading] = useState(false); const load = useCallback(async () => { setLoading(true); try { const res = await API.get('/api/sales/commission/bills'); if (res.data.success) setBills(res.data.data || []); else showError(res.data.message); } catch (error) { showError(error.message); } finally { setLoading(false); } }, []); useEffect(() => { load(); }, [load]); const openDetail = async (bill) => { const res = await API.get(`/api/sales/commission/bills/${bill.id}/items`); if (res.data.success) setDetail(res.data.data); else showError(res.data.message); }; const confirm = async (billId) => { const res = await API.post(`/api/sales/commission/bills/${billId}/confirm`); if (res.data.success) { showSuccess(t('对账单已确认')); setDetail(null); load(); } else showError(res.data.message); }; return ( // mt-[60px]:顶栏 fixed 定位需自行让位(跑马灯由 PageLayout 占位补偿)