fix[订单服务]:新增订单号查询景区素材,设备序号的逻辑
This commit is contained in:
@@ -9,38 +9,38 @@
|
||||
export default {
|
||||
dev: {
|
||||
'/api-uaa/': {
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
target: 'http://127.0.0.1:9900',
|
||||
target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-user/': {
|
||||
target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
target: 'http://119.45.169.13:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-log/': {
|
||||
target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
target: 'http://119.45.169.13:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-search/': {
|
||||
target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
target: 'http://119.45.169.13:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-generator/': {
|
||||
target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
target: 'http://119.45.169.13:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-file/': {
|
||||
target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
target: 'http://119.45.169.13:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api-order/': {
|
||||
target: 'http://127.0.0.1:9900',
|
||||
// target: 'http://119.45.169.13:9900',
|
||||
// target: 'http://127.0.0.1:9900',
|
||||
target: 'http://119.45.169.13:9900',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -30,12 +30,17 @@ const { Link } = Typography;
|
||||
// }
|
||||
// };
|
||||
|
||||
// 状态颜色映射
|
||||
const statusColorMap = {
|
||||
0: { color: 'yellow', text: '待处理' },
|
||||
1: { color: 'orange', text: '待处理' },
|
||||
3: { color: 'green', text: '已完成' },
|
||||
2: { color: 'red', text: '已取消' },
|
||||
0: { color: 'yellow', text: '待支付' },
|
||||
1: { color: 'orange', text: '已支付排队中' },
|
||||
2: { color: 'gray', text: '已取消' },
|
||||
3: { color: 'red', text: '设备执行完成' },
|
||||
4: { color: 'lightblue', text: '正在服务中' },
|
||||
5: { color: 'pink', text: '素材上传中' },
|
||||
6: { color: 'green', text: '素材上传完成' },
|
||||
7: { color: 'darkgray', text: '退款中' },
|
||||
8: { color: 'cyan', text: '已退款' },
|
||||
9: { color: 'purple', text: '退款失败' }
|
||||
};
|
||||
|
||||
// 渲染状态标签
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||
const [form] = Form.useForm();
|
||||
return (
|
||||
<ModalForm
|
||||
title="修改景区"
|
||||
title="修改二维码"
|
||||
form={form}
|
||||
visible={props.updateModalVisible}
|
||||
onFinish={props.onSubmit}
|
||||
|
||||
+42
-28
@@ -1,24 +1,32 @@
|
||||
import {
|
||||
ModalForm,
|
||||
ProForm,
|
||||
ProFormSelect,
|
||||
ProFormText,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Form } from 'antd';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export type FormValueType = Partial<ORDERS.Tourism>;
|
||||
export type FormValueType = Partial<ORDERS.Refund>;
|
||||
|
||||
export type UpdateFormProps = {
|
||||
onVisibleChange: (flag: boolean) => void;
|
||||
onSubmit: (values: FormValueType) => Promise<void>;
|
||||
updateModalVisible: boolean;
|
||||
values?: ORDERS.Tourism;
|
||||
values?: ORDERS.Refund;
|
||||
};
|
||||
|
||||
const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||
const [form] = Form.useForm();
|
||||
const { values } = props;
|
||||
|
||||
useEffect(() => {
|
||||
form.setFieldsValue(values);
|
||||
}, [form, values]);
|
||||
|
||||
return (
|
||||
<ModalForm
|
||||
title="修改景区"
|
||||
title="退款审核"
|
||||
form={form}
|
||||
visible={props.updateModalVisible}
|
||||
onFinish={props.onSubmit}
|
||||
@@ -26,41 +34,47 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||
>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '名称不为空',
|
||||
},
|
||||
]}
|
||||
readonly = {true}
|
||||
width="md"
|
||||
name="tourismName"
|
||||
label="名称"
|
||||
placeholder="输入名称"
|
||||
name="orderNo"
|
||||
label="订单编号"
|
||||
/>
|
||||
<ProFormText
|
||||
readonly={true}
|
||||
width="md"
|
||||
name="refundNo"
|
||||
label="退款编号"
|
||||
/>
|
||||
<ProFormText
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '地址不为空',
|
||||
message: '审核理由不为空',
|
||||
},
|
||||
]}
|
||||
width="md"
|
||||
name="tourismAddress"
|
||||
label="地址"
|
||||
placeholder="输入地址"
|
||||
/>
|
||||
<ProFormText
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '手机号不为空',
|
||||
},
|
||||
]}
|
||||
width="md"
|
||||
name="tourismPhone"
|
||||
label="手机号"
|
||||
placeholder="输入手机号"
|
||||
name="approveReason"
|
||||
label="审核理由"
|
||||
placeholder="输入审核理由"
|
||||
/>
|
||||
<ProFormSelect
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '审核状态不为空',
|
||||
},
|
||||
]}
|
||||
width="md"
|
||||
name="state"
|
||||
label="状态"
|
||||
placeholder="请选择审核状态"
|
||||
options={[
|
||||
{ label: '审核中', value: 0 },
|
||||
{ label: '已通过', value: 1 },
|
||||
{ label: '已拒绝', value: 2 },
|
||||
// 添加更多选项...
|
||||
]}
|
||||
/>
|
||||
</ProForm.Group>
|
||||
</ModalForm>
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { refund } from '@/services/orders/api';
|
||||
import { refund, updateRefund } from '@/services/orders/api';
|
||||
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
||||
import {
|
||||
PageContainer,
|
||||
@@ -6,29 +6,30 @@ import {
|
||||
ProTable,
|
||||
QueryFilter,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Typography, Popconfirm, Tag } from 'antd';
|
||||
import { Typography, Tag, Space, message } from 'antd';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import UpdateForm from './components/UpdateForm';
|
||||
|
||||
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 handleEdit = async (fields: ORDERS.Refund) => {
|
||||
const hide = message.loading('正在更新');
|
||||
try {
|
||||
const result = await updateRefund({ ...fields });
|
||||
hide();
|
||||
if (result.resp_code === 0) {
|
||||
message.success('审核成功');
|
||||
return true;
|
||||
} else {
|
||||
message.error(result.resp_msg);
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('审核失败');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// 状态颜色映射
|
||||
const statusColorMap = {
|
||||
@@ -61,6 +62,8 @@ const renderState = (state: {} | null | undefined) => {
|
||||
const TableList: React.FC = () => {
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [params, setParams] = useState<Record<string, string | number>>({ });
|
||||
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
|
||||
const [currentRow, setCurrentRow] = useState<ORDERS.Refund>();
|
||||
const columns: ProColumns<ORDERS.Refund>[] = [
|
||||
{
|
||||
dataIndex: 'index',
|
||||
@@ -100,19 +103,17 @@ const TableList: React.FC = () => {
|
||||
{
|
||||
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>,
|
||||
render: (_, entity) =>
|
||||
<Space>
|
||||
<Link
|
||||
onClick={() => {
|
||||
setCurrentRow(entity);
|
||||
handleUpdateModalVisible(true);
|
||||
}}
|
||||
>
|
||||
修改
|
||||
</Link>
|
||||
</Space>
|
||||
},
|
||||
];
|
||||
|
||||
@@ -140,6 +141,24 @@ const TableList: React.FC = () => {
|
||||
showQuickJumper: true,
|
||||
}}
|
||||
/>
|
||||
<UpdateForm
|
||||
onSubmit={async (values) => {
|
||||
if (currentRow) {
|
||||
|
||||
const success = await handleEdit({ ...currentRow, ...values });
|
||||
if (success) {
|
||||
handleUpdateModalVisible(false);
|
||||
if (actionRef.current) {
|
||||
actionRef.current.reload();
|
||||
}
|
||||
}
|
||||
setCurrentRow(undefined);
|
||||
}
|
||||
}}
|
||||
onVisibleChange={handleUpdateModalVisible}
|
||||
updateModalVisible={updateModalVisible}
|
||||
values={currentRow}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -137,3 +137,12 @@ export async function refund(params?: { [key: string]: string | number }) {
|
||||
});
|
||||
return { data: result.data, total: result.count };
|
||||
}
|
||||
|
||||
export async function updateRefund(data: ORDERS.Refund): Promise<API.Result<ORDERS.Refund>> {
|
||||
const result = await request<API.Result<ORDERS.Refund>>('/api-order/refund/approve', {
|
||||
method: 'POST',
|
||||
data,
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user