feat: update api
This commit is contained in:
parent
347c7d7cc9
commit
2585f88774
@ -8,9 +8,8 @@ import { PageUrl } from '@/constants/app';
|
||||
import { PartnerProfitsState } from '@/types/partner';
|
||||
import { formatMoney, getPartnerProfitStat } from '@/utils/partner';
|
||||
import { navigateTo } from '@/utils/route';
|
||||
|
||||
import './index.less';
|
||||
import Toast from '@/utils/toast';
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'partner-kanban';
|
||||
|
||||
@ -62,11 +61,19 @@ export default function PartnerKanban({ simple }: PartnerKanbanProps) {
|
||||
const [tipOpen, setTipOpen] = useState(false);
|
||||
const [withdrawOpen, setWithdrawOpen] = useState(false);
|
||||
const [stats, setStats] = useState<PartnerProfitsState>({
|
||||
withdraw: 0,
|
||||
available: 0,
|
||||
withdrawing: 0,
|
||||
availableBalance: 0,
|
||||
withdrawingBalance: 0,
|
||||
withdrawnBalance: 0,
|
||||
availableProfit: 0,
|
||||
withdrawnProfit: 0,
|
||||
failedProfit: 0,
|
||||
});
|
||||
const total = stats.withdrawing + stats.available + stats.withdraw;
|
||||
const total =
|
||||
stats.availableBalance +
|
||||
stats.withdrawingBalance +
|
||||
stats.withdrawnBalance +
|
||||
stats.availableProfit +
|
||||
stats.withdrawnProfit;
|
||||
const handleNavigate = useCallback(() => {
|
||||
navigateTo(PageUrl.Partner);
|
||||
}, []);
|
||||
@ -80,7 +87,7 @@ export default function PartnerKanban({ simple }: PartnerKanbanProps) {
|
||||
setTipOpen(false);
|
||||
}, []);
|
||||
const handleViewWithdraw = useCallback(() => {
|
||||
if (stats.available < 10 * 1000) {
|
||||
if (stats.availableBalance < 10 * 1000) {
|
||||
Toast.info('提现金额需大于等于10元');
|
||||
return;
|
||||
}
|
||||
@ -121,18 +128,18 @@ export default function PartnerKanban({ simple }: PartnerKanbanProps) {
|
||||
<div className={`${PREFIX}__details`}>
|
||||
<div className={`${PREFIX}__details-part`}>
|
||||
<div className={`${PREFIX}__title`}>可提现(元)</div>
|
||||
<div className={`${PREFIX}__money`}>{formatMoney(stats.available)}</div>
|
||||
<div className={`${PREFIX}__money`}>{formatMoney(stats.availableBalance)}</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__details-part`}>
|
||||
<div className={`${PREFIX}__title`}>提现中(元)</div>
|
||||
<div className={`${PREFIX}__money`}>{formatMoney(stats.withdrawing)}</div>
|
||||
<div className={`${PREFIX}__money`}>{formatMoney(stats.withdrawingBalance)}</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__details-part`}>
|
||||
<div className={`${PREFIX}__title`}>
|
||||
已提现(元)
|
||||
待分账(元)
|
||||
{!simple && <Question onClick={handleViewTip} />}
|
||||
</div>
|
||||
<div className={`${PREFIX}__money`}>{formatMoney(stats.withdraw)}</div>
|
||||
<div className={`${PREFIX}__money`}>{formatMoney(stats.availableProfit)}</div>
|
||||
</div>
|
||||
</div>
|
||||
{!simple && (
|
||||
|
@ -81,5 +81,5 @@ export enum API {
|
||||
GET_INVITE_LIST = '/user/inviteUsers',
|
||||
BECOME_PARTNER = '/user/becomePartner',
|
||||
GET_PROFIT_LIST = '/profit/profits',
|
||||
GET_PROFIT_STAT = '/profit/partnerProfitsStat',
|
||||
GET_PROFIT_STAT = '/user/profits',
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
export interface PartnerProfitsState {
|
||||
withdraw: number;
|
||||
available: number;
|
||||
withdrawing: number;
|
||||
availableBalance: number;
|
||||
withdrawingBalance: number;
|
||||
withdrawnBalance: number;
|
||||
availableProfit: number;
|
||||
withdrawnProfit: number;
|
||||
failedProfit: number;
|
||||
}
|
||||
export interface PartnerInviteCode {
|
||||
inviteCode: string;
|
||||
|
Loading…
Reference in New Issue
Block a user