张涛 1 年間 前
コミット
02fd84fb08

+ 2
- 2
src/pages/member/Edit.jsx ファイルの表示

@@ -32,9 +32,9 @@ export default (props) => {
32 32
   ];
33 33
   const contentList = {
34 34
     // 会员基本信息
35
-    tab1: <MemberInfo memberList={memberList} />,
35
+    tab1: <MemberInfo key="1" memberList={memberList} />,
36 36
     // 会员卡信息
37
-    tab2: <MemberCardInfo taMemberCardList={memberList?.taMemberCardList} />,
37
+    tab2: <MemberCardInfo key="2" taMemberCardList={memberList?.taMemberCardList} />,
38 38
   };
39 39
   return (
40 40
     <Page>

+ 31
- 35
src/pages/member/components/MemberCardInfo.jsx ファイルの表示

@@ -1,41 +1,37 @@
1 1
 import React from "react";
2
-import { Card } from "antd";
2
+import { Button, Card, Switch } from "antd";
3 3
 export default (props) => {
4 4
   const { taMemberCardList } = props;
5 5
 
6
-  const CardAll = () => {
7
-    return (taMemberCardList || []).map((it) => {
8
-      return (
9
-        <Card
10
-          id={it?.cardId}
11
-          style={{ width: "100%" }}
12
-          title={it?.cardType ? it?.cardType : "会员卡"}
13
-        >
14
-          <Card.Grid>
15
-            <Card.Meta title="开卡人姓名" description={it?.memberName} />
16
-          </Card.Grid>
17
-          <Card.Grid>
18
-            <Card.Meta title="手机号" description={it?.memberPhone} />
19
-          </Card.Grid>
20
-          <Card.Grid>
21
-            <Card.Meta title="总次数" description={it?.totalAmount} />
22
-          </Card.Grid>
23
-          <Card.Grid>
24
-            <Card.Meta title="剩余次数" description={it?.leftAmount} />
25
-          </Card.Grid>
26
-          <Card.Grid>
27
-            <Card.Meta title="开卡日期" description={it?.bizDate} />
28
-          </Card.Grid>
29
-          <Card.Grid>
30
-            <Card.Meta title="总时长" description={it?.totalTime} />
31
-          </Card.Grid>
32
-          <Card.Grid>
33
-            <Card.Meta title="截止日期" description={it?.expireTime} />
34
-          </Card.Grid>
35
-        </Card>
36
-      );
37
-    });
38
-  };
39 6
 
40
-  return <CardAll />;
7
+  return (taMemberCardList || []).map((it) => (
8
+      <Card
9
+        key={it?.cardId}
10
+        style={{ width: "100%", marginTop: 16 }}
11
+        title={it?.cardType ? it?.cardType : "会员卡"}
12
+        loading={!it}
13
+      >
14
+        <Card.Grid>
15
+          <Card.Meta title="开卡人姓名" description={it?.memberName} />
16
+        </Card.Grid>
17
+        <Card.Grid>
18
+          <Card.Meta title="手机号" description={it?.memberPhone} />
19
+        </Card.Grid>
20
+        <Card.Grid>
21
+          <Card.Meta title="总次数" description={it?.totalAmount} />
22
+        </Card.Grid>
23
+        <Card.Grid>
24
+          <Card.Meta title="剩余次数" description={it?.leftAmount} />
25
+        </Card.Grid>
26
+        <Card.Grid>
27
+          <Card.Meta title="开卡日期" description={it?.bizDate} />
28
+        </Card.Grid>
29
+        <Card.Grid>
30
+          <Card.Meta title="总时长" description={it?.totalTime} />
31
+        </Card.Grid>
32
+        <Card.Grid>
33
+          <Card.Meta title="截止日期" description={it?.expireTime} />
34
+        </Card.Grid>
35
+      </Card>
36
+  ));
41 37
 };

+ 11
- 7
src/pages/member/components/MemberInfo.jsx ファイルの表示

@@ -3,10 +3,7 @@ import React from "react";
3 3
 export default (props) => {
4 4
   const { memberList } = props;
5 5
   return (
6
-    <Card
7
-      style={{ width: "100%" }}
8
-      title="会员信息"
9
-    >
6
+    <Card style={{ width: "100%" }} title="会员信息">
10 7
       <Card.Grid>
11 8
         <Card.Meta title="会员名称" description={memberList?.memberName} />
12 9
       </Card.Grid>
@@ -14,15 +11,22 @@ export default (props) => {
14 11
         <Card.Meta title="手机号" description={memberList?.phone} />
15 12
       </Card.Grid>
16 13
       <Card.Grid>
17
-        <Card.Meta title="性别" description={memberList?.sex} />
14
+        <Card.Meta
15
+          title="性别"
16
+          description={
17
+            memberList?.sex == 1 ? "男" : memberList?.sex == 2 ? "女" : "未知"
18
+          }
19
+        />
18 20
       </Card.Grid>
19 21
       <Card.Grid>
20
-        <Card.Meta title="状态" description={memberList?.status} />
22
+        <Card.Meta
23
+          title="状态"
24
+          description={memberList?.status == 1 ? "正常" : "异常"}
25
+        />
21 26
       </Card.Grid>
22 27
       <Card.Grid>
23 28
         <Card.Meta title="注册日期" description={memberList?.bizDate} />
24 29
       </Card.Grid>
25
-
26 30
     </Card>
27 31
   );
28 32
 };

+ 7
- 0
src/pages/member/components/SelectCardModal.jsx ファイルの表示

@@ -14,11 +14,18 @@ export default (props) => {
14 14
       (res.records || []).map((x) => {
15 15
         packList[x.packageId] = x.packageName;
16 16
       });
17
+      let disabledNum = 0;
17 18
       const data = cardList?.map((x) => {
19
+        // const dataNum = record.taMemberCardList.reduce((total, item) => {
20
+        //   return (total += item.leftAmount);
21
+        // }, 0);
22
+        disabledNum += x.leftAmount;
23
+        console.log(disabledNum);
18 24
         return {
19 25
           ...x,
20 26
           value: x.cardId,
21 27
           label: packList[x.packageId],
28
+          disabled: !disabledNum,
22 29
         };
23 30
       });
24 31
       setCardOptions(data);

+ 25
- 12
src/pages/member/index.jsx ファイルの表示

@@ -82,18 +82,31 @@ export default (props) => {
82 82
       <List
83 83
         // actionRef={actionRef}
84 84
         rowKey="memberId"
85
-        onEdit={(record) => navigate(`/member/edit?id=${record.memberId}`)}
86
-        columnOptionRender={(_, record) => [
87
-          <Button
88
-            key="A2"
89
-            style={{ padding: 0 }}
90
-            type="link"
91
-            disabled={!record.taMemberCardList?.length}
92
-            onClick={() => onModalNewCard("核销卡", record)}
93
-          >
94
-            核销卡
95
-          </Button>,
96
-        ]}
85
+        // onEdit={(record) => navigate(`/member/edit?id=${record.memberId}`)}
86
+        columnOptionRender={(_, record) => {
87
+          const dataNum = record.taMemberCardList.reduce((total, item) => {
88
+            return (total += item.leftAmount);
89
+          }, 0);
90
+          return [
91
+            <Button
92
+              key="A3"
93
+              style={{ padding: 0 }}
94
+              type="link"
95
+              onClick={() => navigate(`/member/edit?id=${record.memberId}`)}
96
+            >
97
+              详情
98
+            </Button>,
99
+            <Button
100
+              key="A2"
101
+              style={{ padding: 0 }}
102
+              type="link"
103
+              disabled={!dataNum}
104
+              onClick={() => onModalNewCard("核销卡", record)}
105
+            >
106
+              核销卡
107
+            </Button>,
108
+          ];
109
+        }}
97 110
         request={getTaMember}
98 111
         columns={columns}
99 112
         toolBarRender={(record) => {