import React, { useState } from 'react'; import { Tag, Modal, Alert, Divider, Button } from 'antd'; import Styles from './web.pc.module.less'; import ListPro from 'oak-frontend-base/es/components/listPro'; import { RenderOffline } from '../detail/web.pc'; import { generateNewId, generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; export default function Render(props) { const { pays, offlines } = props.data; const { t, execute, updateItem, setMessage, clean } = props.methods; const [spId, setSpId] = useState(''); if (pays) { const spRow = (spId && pays.find(ele => ele.id === spId)); return (<> {orderId ? t('source.order') : t('source.deposit')} ); } }, { path: 'creatorName', label: t('label.cn'), span: 1, render: (row) => { const { creatorName, creatorMobile } = row; return (
{creatorName}
{creatorMobile}
); } }, { path: 'phantom3', span: 1, label: t('label.code'), }, { path: 'channel', span: 1, label: t('pay:attr.entity'), render: (row) => { const { entity } = row; const colorDict = { 'account': 'blue', 'offlineAccount': 'red', 'wpProduct': 'green', }; return (
{t(`payChannel::${row.entity}`)} {entity === 'offlineAccount' && (
{t(`offlineAccount:v.type.${row.offlineAccount.type}`)}
)} {entity === 'wpProduct' &&
{t(`wpProduct:v.type.${row.wpProduct.type}`)}
}
); } } ]} onAction={(row, action) => { if (action === 'close') { Modal.confirm({ title: t('cc.title'), content: t('cc.content'), onOk() { return execute(undefined, undefined, undefined, [ { entity: 'pay', operation: { id: generateNewId(), action: 'close', data: {}, filter: { id: row.id, }, }, } ]); }, okText: t('common::confirm'), cancelText: t('common::action.cancel') }); } else if (action === 'succeedPaying') { const { entity } = row; if (entity !== 'offlineAccount') { // 以后可能也有手动成功offline以外的pay的情况,先封掉 setMessage({ title: t('spFail.title'), content: t('spFail.content'), type: 'error', }); } else { setSpId(row.id); } } }}/> { clean(); setSpId(''); }}>
ele.id === spRow.entityId)} updateOfflineId={(entityId) => updateItem({ entity: 'offlineAccount', entityId }, spId)}/>
); } return null; }