核销订单修改

This commit is contained in:
PC-202306242200\Administrator
2026-03-19 17:43:36 +08:00
parent 6381db650f
commit 3f6f03994e
5 changed files with 203 additions and 8 deletions

View File

@@ -86,8 +86,8 @@ export default defineConfig({
'process.env': { 'process.env': {
// API_URL: "http://guangdongadminapi.zhongshuai2023.com", // API_URL: "http://guangdongadminapi.zhongshuai2023.com",
// API_URL: "http://iadminapi.zhongshuai2023.com", // API_URL: "http://iadminapi.zhongshuai2023.com",
// API_URL: "http://192.168.1.63:1002", API_URL: "http://192.168.112.207:1002",
API_URL: "http://guangdongadminapi.zhongshuai2023.com", // API_URL: "http://guangdongadminapi.zhongshuai2023.com",
// API_URL: "http://192.168.1.54:1002", // API_URL: "http://192.168.1.54:1002",
WS_URL: "ws://lv.com", WS_URL: "ws://lv.com",

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,17 @@
import React from 'react';
interface VisibleProps {
visible: boolean;
onCancel: () => void;
children: React.ReactNode;
}
const Visible: React.FC<VisibleProps> = ({ visible, onCancel, children }) => {
if (!visible) {
return null;
}
return <>{children}</>;
};
export default Visible;

View File

@@ -0,0 +1,55 @@
import React from 'react';
import { Modal, Form, Input, Button, message } from 'antd';
import { request } from '@umijs/max';
interface CheckoutModalProps {
record: any;
onOk: () => void;
}
const CheckoutModal: React.FC<CheckoutModalProps> = ({ record, onOk }) => {
const handleOk = async () => {
try {
const response = await request('/api/orders/updateCheckStatus', {
method: 'post',
headers: {
'Content-Type': 'application/json;charset=UTF-8',
},
data: { id: record?.id, checkStatus: 1 },
});
if (response.success) {
message.success('对账成功');
onOk();
} else {
message.error('对账失败');
}
} catch (error) {
message.error('对账失败');
console.error('Error updating check status:', error);
}
};
return (
<Modal
title="财务对账"
open={true}
onOk={handleOk}
onCancel={onOk}
>
<div>
<p>: {record?.orderNo}</p>
<p>: {record?.shopEntity?.userName} ({record?.shopEntity?.phone})</p>
<p>: {record?.verifier?.userName} ({record?.verifier?.phone})</p>
<p>: ¥{record?.goodsPrice}</p>
<p>: {record?.couponNum}</p>
<p>: {record?.status ? '已核销' : '未核销'}</p>
<p>: {record?.checkStatus ? '已对账' : '未对账'}</p>
<p>: {record?.note || '-'}</p>
<p>: {record?.createTime}</p>
</div>
</Modal>
);
};
export default CheckoutModal;

View File

@@ -1,9 +1,12 @@
import { verificationPage } from '@/services/payment'; import { verificationPage } from '@/services/payment';
import { request } from '@umijs/max';
import React, { useRef, useEffect,useState } from 'react'; import React, { useRef, useEffect, useState } from 'react';
import { useIntl, useAccess } from '@umijs/max'; import { useIntl, useAccess } from '@umijs/max';
import { message, Tag, Image, Button, Select } from 'antd'; import { message, Tag, Image, Button, Select } from 'antd';
import Visible from '@/components/Visible';
import CheckoutModal from './components/CheckoutModal';
import { ActionType, PageContainer, ProTable } from '@ant-design/pro-components'; import { ActionType, PageContainer, ProTable } from '@ant-design/pro-components';
import { usersPage } from '@/services/user/user'; import { usersPage } from '@/services/user/user';
@@ -11,8 +14,9 @@ import { usersPage } from '@/services/user/user';
const LogTableList: React.FC = () => { const LogTableList: React.FC = () => {
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
const [visible, setVisible] = useState(false);
const [record, setRecord] = useState(null);
const [searchParams, setSearchParams] = useState({});
const [shopOption, setShopOption] = useState([]); const [shopOption, setShopOption] = useState([]);
const searchShop = async (value) => { const searchShop = async (value) => {
const { success, data } = await usersPage({ const { success, data } = await usersPage({
@@ -35,13 +39,39 @@ const LogTableList: React.FC = () => {
title: '用户信息', title: '用户信息',
dataIndex: 'userId', dataIndex: 'userId',
valueType: 'text', valueType: 'text',
search: false,
render: (_: any, record: any) => { render: (_: any, record: any) => {
return <div> return <div>
<div>{record?.shopEntity?.userName}</div> <div>{record?.shopEntity?.userName}</div>
<div>{record?.shopEntity?.phone}</div> <div>{record?.shopEntity?.phone}</div>
</div> </div>
}, },
renderFormItem: (
_,
{ type, defaultRender, formItemProps, fieldProps, ...rest },
form,
) => {
return <Select
{...fieldProps}
allowClear
showSearch
placeholder="请输入用户名或手机号"
style={{ width: "100%" }}
filterOption={false}
onSearch={
(e) => {
if (!e) {
return;
}
searchShop(e);
}
}
fieldNames={{
label: "userName",
value: "id"
}}
options={shopOption}
/>
},
}, },
{ {
title: '核销人', title: '核销人',
@@ -106,6 +136,41 @@ const LogTableList: React.FC = () => {
return record.status ? '已核销' : '未核销' return record.status ? '已核销' : '未核销'
} }
}, },
{
title: '财务对账',
dataIndex: 'checkStatus',
valueType: 'text',
search: false,
renderFormItem: (
_,
{ type, defaultRender, formItemProps, fieldProps, ...rest },
form,
) => {
const statusMap = [{
label: '已核销',
value: 1
}, {
label: '未核销',
value: 0
}];
return <Select
{...fieldProps}
allowClear
style={{ width: "100%" }}
filterOption={false}
fieldNames={{
label: "label",
value: "value"
}}
options={statusMap}
/>
},
render: (_, record) => {
return record.checkStatus ? '已对账' : '未对账'
}
},
{ {
title: '备注', title: '备注',
dataIndex: 'note', dataIndex: 'note',
@@ -117,11 +182,62 @@ const LogTableList: React.FC = () => {
valueType: 'text', valueType: 'text',
search: false, search: false,
}, },
{
title: '操作',
dataIndex: 'operation',
search: false,
render: (_, record) => {
return <div>
{!record?.checkStatus && <Button ghost type="primary" disabled={record?.status === 0} onClick={() => {
setVisible(true);
setRecord(record);
}}></Button>}
</div>
},
}
]; ];
const handleExport = async () => {
try {
const response = await request('/api/orders/couponList-export', {
method: 'get',
responseType: 'blob',
params: searchParams
});
// Create download link
const url = window.URL.createObjectURL(new Blob([response]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', `verification-orders-${new Date().getTime()}.xlsx`);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
} catch (error) {
message.error('导出失败');
console.error('Error exporting data:', error);
}
};
return ( return (
<PageContainer> <PageContainer>
<div style={{ width: '100%', float: 'right' }}> <div style={{ width: '100%', float: 'right' }}>
<Visible
visible={visible}
onCancel={() => {
setVisible(false);
}}
>
<CheckoutModal
record={record}
onOk={async () => {
setVisible(false);
if (actionRef.current) {
actionRef.current.reload();
}
}}
/>
</Visible>
<ProTable <ProTable
actionRef={actionRef} actionRef={actionRef}
rowKey="id" rowKey="id"
@@ -129,7 +245,13 @@ const LogTableList: React.FC = () => {
search={{ search={{
labelWidth: 120, labelWidth: 120,
}} }}
toolBarRender={() => [
<Button key="export" type="primary" onClick={handleExport}>
</Button>
]}
request={async (params, sorter, filter) => { request={async (params, sorter, filter) => {
setSearchParams(params);
let { data } = await verificationPage(params) let { data } = await verificationPage(params)
return { return {
data: data?.records || [], data: data?.records || [],
@@ -143,4 +265,4 @@ const LogTableList: React.FC = () => {
); );
}; };
export default LogTableList; export default LogTableList;