|
@@ -3,9 +3,12 @@ import { getTaMember } from "@/services/taMember";
|
3
|
3
|
import List from "@/components/Page/List";
|
4
|
4
|
import moment from "moment";
|
5
|
5
|
import { useNavigate } from "react-router-dom";
|
6
|
|
-import { Button, Popconfirm } from "antd";
|
|
6
|
+import { Button, Modal, Popconfirm } from "antd";
|
|
7
|
+import ModalNewCard from "./components/ModalNewCard";
|
|
8
|
+import { putTaMemberCardIdWrite } from "@/services/taMemberCard";
|
7
|
9
|
export default (props) => {
|
8
|
10
|
const navigate = useNavigate();
|
|
11
|
+ const [isModalOpen, setIsModalOpen] = React.useState(false);
|
9
|
12
|
|
10
|
13
|
const columns = [
|
11
|
14
|
{
|
|
@@ -56,61 +59,60 @@ export default (props) => {
|
56
|
59
|
{
|
57
|
60
|
title: "状态",
|
58
|
61
|
dataIndex: "status",
|
59
|
|
-
|
60
|
62
|
},
|
61
|
63
|
];
|
62
|
|
- const onActive = (record) => {
|
63
|
|
- // postTaMemberCardIdActive().then((res) => {});
|
|
64
|
+ const onModalNewCard = (record) => {
|
|
65
|
+
|
|
66
|
+ setIsModalOpen(true);
|
64
|
67
|
};
|
65
|
|
- const onWrite = (record) => {
|
|
68
|
+ const onWrite = (id) => {
|
66
|
69
|
// putTaMemberCardIdWrite().then((res) => {});
|
67
|
70
|
};
|
68
|
71
|
|
69
|
|
- const ColumnOptionRender = (_, record) => [
|
70
|
|
- <Popconfirm
|
71
|
|
- key="A3"
|
72
|
|
- title="您是否确认发卡?"
|
73
|
|
- onConfirm={() => onActive(record.customId)}
|
74
|
|
- okText="确定"
|
75
|
|
- cancelText="取消"
|
76
|
|
- >
|
77
|
|
- <Button style={{ padding: 0 }} type="link">
|
78
|
|
- 发卡
|
79
|
|
- </Button>
|
80
|
|
- </Popconfirm>,
|
81
|
|
- <Popconfirm
|
82
|
|
- key="A2"
|
83
|
|
- title="您是否确认核销卡?"
|
84
|
|
- onConfirm={() => onWrite(record.customId)}
|
85
|
|
- okText="确定"
|
86
|
|
- cancelText="取消"
|
87
|
|
- >
|
88
|
|
- <Button style={{ padding: 0 }} type="link">
|
89
|
|
- 核销卡
|
90
|
|
- </Button>
|
91
|
|
- </Popconfirm>,
|
92
|
|
- ];
|
93
|
72
|
return (
|
94
|
|
- <List
|
95
|
|
- // actionRef={actionRef}
|
96
|
|
- rowKey="memberId"
|
97
|
|
- onEdit={(record) => navigate(`/member/edit?id=${record.memberId}`)}
|
98
|
|
- columnOptionRender={ColumnOptionRender}
|
99
|
|
-
|
100
|
|
- // onDelete={(record) => handleDelete(record.memberId)}
|
101
|
|
- // toolBarRender={() => [
|
102
|
|
- // <Button
|
103
|
|
- // key="1"
|
104
|
|
- // type="primary"
|
105
|
|
- // onClick={() => {
|
106
|
|
- // navigate("/member/edit");
|
107
|
|
- // }}
|
108
|
|
- // >
|
109
|
|
- // 新增
|
110
|
|
- // </Button>,
|
111
|
|
- // ]}
|
112
|
|
- request={getTaMember}
|
113
|
|
- columns={columns}
|
114
|
|
- />
|
|
73
|
+ <>
|
|
74
|
+ <List
|
|
75
|
+ // actionRef={actionRef}
|
|
76
|
+ rowKey="memberId"
|
|
77
|
+ onEdit={(record) => navigate(`/member/edit?id=${record.memberId}`)}
|
|
78
|
+ columnOptionRender={(_, record) => [
|
|
79
|
+ <Popconfirm
|
|
80
|
+ key="A2"
|
|
81
|
+ title="您是否确认核销卡?"
|
|
82
|
+ onConfirm={() => onWrite(record.memberId)}
|
|
83
|
+ okText="确定"
|
|
84
|
+ cancelText="取消"
|
|
85
|
+ disabled={!record.taMemberCardList?.length}
|
|
86
|
+ >
|
|
87
|
+ <Button
|
|
88
|
+ style={{ padding: 0 }}
|
|
89
|
+ type="link"
|
|
90
|
+ disabled={!record.taMemberCardList?.length}
|
|
91
|
+ >
|
|
92
|
+ 核销卡
|
|
93
|
+ </Button>
|
|
94
|
+ </Popconfirm>,
|
|
95
|
+ ]}
|
|
96
|
+ request={getTaMember}
|
|
97
|
+ columns={columns}
|
|
98
|
+ toolBarRender={(record) => {
|
|
99
|
+ return [
|
|
100
|
+ <Button
|
|
101
|
+ key="1"
|
|
102
|
+ type="primary"
|
|
103
|
+ onClick={() => {
|
|
104
|
+ onModalNewCard(record);
|
|
105
|
+ }}
|
|
106
|
+ >
|
|
107
|
+ 开卡
|
|
108
|
+ </Button>,
|
|
109
|
+ ];
|
|
110
|
+ }}
|
|
111
|
+ />
|
|
112
|
+ <ModalNewCard
|
|
113
|
+ isModalOpen={isModalOpen}
|
|
114
|
+ setIsModalOpen={setIsModalOpen}
|
|
115
|
+ />
|
|
116
|
+ </>
|
115
|
117
|
);
|
116
|
118
|
};
|