diff --git a/zlt-web/react-web/src/main/frontend/src/pages/orders/ProfitSharing/index.tsx b/zlt-web/react-web/src/main/frontend/src/pages/orders/ProfitSharing/index.tsx new file mode 100644 index 00000000..fae7a15f --- /dev/null +++ b/zlt-web/react-web/src/main/frontend/src/pages/orders/ProfitSharing/index.tsx @@ -0,0 +1,158 @@ +import { PageContainer, ProTable } from '@ant-design/pro-components'; +import type { ActionType, ProColumns } from '@ant-design/pro-components'; +import { Button, message, Space, Tag, Typography, Modal } from 'antd'; +import React, { useRef } from 'react'; +import { profitSharingList, executeProfitSharing } from '@/services/orders/api'; +import { history } from 'umi'; + +const { Link } = Typography; + +const STATUS_MAP = { + 0: { text: '待分账', color: 'default' }, + 1: { text: '分账中', color: 'processing' }, + 2: { text: '分账成功', color: 'success' }, + 3: { text: '分账失败', color: 'error' }, +}; + +const ProfitSharingList: React.FC = () => { + const actionRef = useRef(); + + const handleExecute = async (orderNo: string) => { + Modal.confirm({ + title: '确认执行分账', + content: '是否确认为该订单执行分账操作?', + onOk: async () => { + try { + const result = await executeProfitSharing(orderNo); + if (result.resp_code === 0) { + message.success('分账执行成功'); + actionRef.current?.reload(); + } else { + message.error(result.resp_msg || '分账执行失败'); + } + } catch (error) { + message.error('分账执行失败'); + } + }, + }); + }; + + const handleRequest = async (params: any) => { + const { current, pageSize, ...rest } = params; + const result = await profitSharingList({ + page: current, + limit: pageSize, + ...rest, + }); + + return { + data: result.data, + success: result.resp_code === 0, + total: result.total, + }; + }; + + const columns: ProColumns[] = [ + { + title: '订单编号', + dataIndex: 'orderNo', + width: 200, + fixed: 'left', + }, + { + title: '微信支付订单号', + dataIndex: 'transactionId', + width: 200, + }, + { + title: '订单总额', + dataIndex: 'totalAmount', + width: 120, + render: (val) => `¥${(Number(val) / 100).toFixed(2)}`, + }, + { + title: '平台分账', + dataIndex: 'platformAmount', + width: 120, + render: (val) => `¥${(Number(val) / 100).toFixed(2)}`, + }, + { + title: '二维码分账', + dataIndex: 'qrCodeAmount', + width: 120, + render: (val) => `¥${(Number(val) / 100).toFixed(2)}`, + }, + { + title: '实际分账金额', + dataIndex: 'receiverAmount', + width: 120, + render: (val) => (val ? `¥${(Number(val) / 100).toFixed(2)}` : '-'), + }, + { + title: '分账状态', + dataIndex: 'status', + width: 100, + valueEnum: STATUS_MAP, + }, + { + title: '分账账号', + dataIndex: 'payeeAccount', + width: 180, + }, + { + title: '账号类型', + dataIndex: 'payeeType', + width: 120, + valueEnum: { + 'MERCHANT_ID': { text: '商户ID' }, + 'PERSONAL_OPENID': { text: '个人openid' }, + }, + }, + { + title: '创建时间', + dataIndex: 'createTime', + width: 180, + valueType: 'dateTime', + }, + { + title: '操作', + width: 180, + fixed: 'right', + render: (_, record) => ( + + history.push(`/orders/profit-sharing/detail/${record.orderNo}`)}> + 详情 + + {record.status === 3 && record.retryTimes < 3 && ( + handleExecute(record.orderNo)}> + 重试分账 + + )} + + ), + }, + ]; + + return ( + + + actionRef={actionRef} + columns={columns} + scroll={{ x: 1800 }} + request={handleRequest} + rowKey="id" + search={{ + labelWidth: 120, + }} + pagination={{ + pageSize: 10, + showQuickJumper: true, + showSizeChanger: true, + }} + dateFormatter="string" + /> + + ); +}; + +export default ProfitSharingList; \ No newline at end of file