fix[支付模块]:订单支付回调逻辑新增,退款逻辑回调逻辑新增完成,测试通过
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
ProTable,
|
||||
QueryFilter,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Typography, message, Popconfirm, Tag } from 'antd';
|
||||
import { Typography, Popconfirm, Tag } from 'antd';
|
||||
import React, { useRef, useState } from 'react';
|
||||
|
||||
const { Link } = Typography;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
@import (reference) '~antd/es/style/themes/index';
|
||||
@@ -0,0 +1,120 @@
|
||||
import { order } from '@/services/orders/api';
|
||||
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
||||
import {
|
||||
PageContainer,
|
||||
ProFormText,
|
||||
ProTable,
|
||||
QueryFilter,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Typography, Popconfirm, Tag } from 'antd';
|
||||
import React, { useRef, useState } from 'react';
|
||||
|
||||
const { Link } = Typography;
|
||||
|
||||
// const handleDelete = async (deletefile: FILES.File) => {
|
||||
// const hide = message.loading('正在删除');
|
||||
// try {
|
||||
// const result = await deleteFile(deletefile.id);
|
||||
// hide();
|
||||
// if (result.resp_code === 0) {
|
||||
// message.success('删除File成功');
|
||||
// return true;
|
||||
// } else {
|
||||
// message.error(result.resp_msg);
|
||||
// return false;
|
||||
// }
|
||||
// } catch (error) {
|
||||
// hide();
|
||||
// message.error('删除File失败');
|
||||
// return false;
|
||||
// }
|
||||
// };
|
||||
|
||||
// 状态颜色映射
|
||||
const statusColorMap = {
|
||||
0: { color: 'yellow', text: '待处理' },
|
||||
1: { color: 'orange', text: '待处理' },
|
||||
3: { color: 'green', text: '已完成' },
|
||||
2: { color: 'red', text: '已取消' },
|
||||
};
|
||||
|
||||
// 渲染状态标签
|
||||
const renderStatus = (status: {} | null | undefined) => {
|
||||
const statusInfo = statusColorMap[status] || { color: 'gray', text: '未知状态' };
|
||||
return <Tag color={statusInfo.color}>{statusInfo.text}</Tag>;
|
||||
};
|
||||
|
||||
const TableList: React.FC = () => {
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [params, setParams] = useState<Record<string, string | number>>({ });
|
||||
const columns: ProColumns<ORDERS.Order>[] = [
|
||||
{
|
||||
dataIndex: 'index',
|
||||
valueType: 'indexBorder',
|
||||
},
|
||||
{
|
||||
title: '订单ID',
|
||||
dataIndex: 'id',
|
||||
},
|
||||
{
|
||||
title: '退款订单编号',
|
||||
dataIndex: 'refundNo',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
render: (status) => renderStatus(status),
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
valueType: 'dateTime',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
render: (_, entity) => <Popconfirm
|
||||
title={`确认删除文件[${entity.id}]?`}
|
||||
onConfirm={async () => {
|
||||
// const success = await handleDelete(entity);
|
||||
// if (success) {
|
||||
// if (actionRef.current) {
|
||||
// actionRef.current.reload();
|
||||
// }
|
||||
// }
|
||||
}}
|
||||
>
|
||||
<Link>删除</Link>
|
||||
</Popconfirm>,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer header={{ subTitle: '管理任务' }}>
|
||||
<QueryFilter
|
||||
defaultCollapsed
|
||||
split
|
||||
span={6}
|
||||
className="query-filter"
|
||||
onFinish={async (values) => setParams(values)}
|
||||
>
|
||||
<ProFormText name="name" label="搜索" placeholder="输入关键字" />
|
||||
</QueryFilter>
|
||||
<ProTable<ORDERS.Order>
|
||||
rowKey="id"
|
||||
headerTitle="任务列表"
|
||||
request={order}
|
||||
actionRef={actionRef}
|
||||
columns={columns}
|
||||
search={false}
|
||||
params={params}
|
||||
pagination={{
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
}}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableList;
|
||||
+91
-37
@@ -1,9 +1,15 @@
|
||||
import { importImage } from '@/services/system/api';
|
||||
import { UploadOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
ModalForm,
|
||||
ProForm,
|
||||
ProFormSelect,
|
||||
ProFormText,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Form } from 'antd';
|
||||
import { Button, Form, message, Upload } from 'antd';
|
||||
import { RcFile } from 'antd/lib/upload';
|
||||
import { useState } from 'react';
|
||||
import styles from '../index.less';
|
||||
|
||||
export type FormValueType = Partial<ORDERS.TourismFile>;
|
||||
|
||||
@@ -14,8 +20,24 @@ export type UpdateFormProps = {
|
||||
values?: ORDERS.Tourism;
|
||||
};
|
||||
|
||||
const handleImport = async (file: RcFile) => {
|
||||
const hide = message.loading('正在导入');
|
||||
try {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const result = await importImage(formData);
|
||||
hide();
|
||||
message.success('上传素材成功');
|
||||
return result;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('上传素材失败');
|
||||
return null;
|
||||
}
|
||||
};
|
||||
const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||
const [form] = Form.useForm();
|
||||
const [file, setFile] = useState();
|
||||
return (
|
||||
<ModalForm
|
||||
title="更新素材"
|
||||
@@ -25,42 +47,74 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||
onVisibleChange={props.onVisibleChange}
|
||||
>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '名称不为空',
|
||||
},
|
||||
]}
|
||||
width="md"
|
||||
name="tourismId"
|
||||
label="景区名称"
|
||||
placeholder="输入名称"
|
||||
/>
|
||||
<ProFormText
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '地址不为空',
|
||||
},
|
||||
]}
|
||||
width="md"
|
||||
name="imageUrl"
|
||||
label="素材地址"
|
||||
placeholder="输入地址"
|
||||
/>
|
||||
<ProFormText
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '链接页面不为空',
|
||||
},
|
||||
]}
|
||||
width="md"
|
||||
name="linkUrl"
|
||||
label="链接地址"
|
||||
placeholder="输入链接"
|
||||
/>
|
||||
<ProFormSelect
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '景区不为空',
|
||||
},
|
||||
]}
|
||||
width="md"
|
||||
name="tourismId"
|
||||
label="景区"
|
||||
placeholder="请选择景区"
|
||||
options={[
|
||||
{ label: '北塘古镇', value: 33 },
|
||||
{ label: '海丝首港', value: 32 },
|
||||
{ label: '景区C', value: 2 },
|
||||
// 添加更多选项...
|
||||
]}
|
||||
/>
|
||||
<ProFormSelect
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '素材类型不为空',
|
||||
},
|
||||
]}
|
||||
width="md"
|
||||
name="type"
|
||||
label="景区"
|
||||
placeholder="请选择景区"
|
||||
options={[
|
||||
{ label: '展示大图', value: 4 },
|
||||
{ label: '拍照引导图', value: 3 },
|
||||
{ label: '拍照角度展示图', value: 2 },
|
||||
{ label: '活动', value: 1 },
|
||||
// 添加更多选项...
|
||||
]}
|
||||
/>
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="linkUrl"
|
||||
label="素材链接url"
|
||||
placeholder="输入url"
|
||||
/>
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="description"
|
||||
label="素材描述"
|
||||
placeholder="输入描述 "
|
||||
/>
|
||||
<Upload
|
||||
maxCount={1}
|
||||
action="/api-file/files-anon"
|
||||
showUploadList={false}
|
||||
beforeUpload={async (file) => {
|
||||
const result = await handleImport(file);
|
||||
if (result && result.name) {
|
||||
setFile(result.name);
|
||||
}
|
||||
return false;
|
||||
}}
|
||||
>
|
||||
<div className={styles.button_view}>
|
||||
<Button>
|
||||
<UploadOutlined />
|
||||
上传素材
|
||||
</Button>
|
||||
</div>
|
||||
</Upload>
|
||||
</ProForm.Group>
|
||||
</ModalForm>
|
||||
);
|
||||
|
||||
@@ -127,4 +127,13 @@ export async function deleteHomeCarousel(id: number) {
|
||||
method: 'DELETE',
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
export async function refund(params?: { [key: string]: string | number }) {
|
||||
const { current, pageSize, ...rest } = params ?? {};
|
||||
const result = await request<SYSTEM.Page<ORDERS.Refund>>('/api-order/refund', {
|
||||
method: 'GET',
|
||||
params: { page: current, limit: pageSize, ...rest },
|
||||
});
|
||||
return { data: result.data, total: result.count };
|
||||
}
|
||||
|
||||
@@ -80,4 +80,15 @@ declare namespace ORDERS {
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
type Refund = {
|
||||
id: number;
|
||||
orderNo: string;
|
||||
refundNo: string;
|
||||
status: number;
|
||||
state: number;
|
||||
approveReason: string;
|
||||
createTime?: string;
|
||||
tenantId?: string;
|
||||
updateTime?: string;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user