fangmingyue 1 rok temu
rodzic
commit
9aa349e170
1 zmienionych plików z 4 dodań i 2 usunięć
  1. 4
    2
      src/pages/member/components/SelectCardModal.jsx

+ 4
- 2
src/pages/member/components/SelectCardModal.jsx Wyświetl plik

@@ -2,6 +2,7 @@ import { ProFormSelect } from "@ant-design/pro-components";
2 2
 import React from "react";
3 3
 import { getTaPackage } from "@/services/taPackage";
4 4
 import { queryDict } from "@/utils/request";
5
+import moment from "moment";
5 6
 import { Select } from "antd";
6 7
 
7 8
 export default (props) => {
@@ -15,6 +16,7 @@ export default (props) => {
15 16
         packList[x.packageId] = x.packageName;
16 17
       });
17 18
       let disabledNum = 0;
19
+      let currentTime = new moment().format();
18 20
       const data = cardList?.map((x) => {
19 21
         // const dataNum = record.taMemberCardList.reduce((total, item) => {
20 22
         //   return (total += item.leftAmount);
@@ -24,8 +26,8 @@ export default (props) => {
24 26
           ...x,
25 27
           value: x.cardId,
26 28
           label: packList[x.packageId],
27
-          //如果是次卡次数等于0就禁用,否则非次卡截至日期小于当前日期就禁用
28
-          disabled: x.limitUnit == 'order' ? disabledNum == 0 : x?.expireTime < x?.createdAt
29
+          //如果是次卡次数等于0就禁用,否则非次卡截至日期小于实时日期就禁用
30
+          disabled: x.limitUnit == 'order' ? disabledNum == 0 : x?.expireTime < currentTime
29 31
         };
30 32
       });
31 33
       setCardOptions(data);