From e183c32f5d088802be19e0b6dc6607a677cb93be Mon Sep 17 00:00:00 2001 From: zhangds Date: Fri, 30 Sep 2022 11:19:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E7=BC=96=E8=BE=91=E6=A0=B9=E6=8D=AE=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UseCouponAddEdit/index.jsx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/UseCouponAddEdit/index.jsx b/src/components/UseCouponAddEdit/index.jsx index 9d427295..062a3e09 100644 --- a/src/components/UseCouponAddEdit/index.jsx +++ b/src/components/UseCouponAddEdit/index.jsx @@ -243,15 +243,14 @@ const UseCouponAddEdit = forwardRef((props, ref) => { if (couponType === 0) { // 1.1 获取归属计划下拉框数据 await getPlanList().then((arr) => { + console.log("arr =>", arr); // 1.2 优惠券管理判断是新增还是编辑 if (editData && editData !== "") { isEditFun(); - // 1.3 设置归属计划数据 let plan_row = arr.find( (item) => item.text === editData.plan_title ); - if ( plan_row && plan_row !== undefined && @@ -687,14 +686,20 @@ const UseCouponAddEdit = forwardRef((props, ref) => { ); }; const onDisabledRange = (date, type) => { - let disabled = false; - if (type === "end") { - disabled = moment(date.getTime()).add(1, "days") <= new Date().getTime(); - } + let isDisabled = false; + let str = moment(date).format("YYYY-MM-DD HH:mm:ss"); if (type === "start") { - disabled = date.getTime() <= new Date().getTime(); + isDisabled = + moment(str).isBefore(form_info_data.date_time[0]) || + moment(str).isAfter(form_info_data.date_time[1]); } - return disabled; + + if (type === "end") { + isDisabled = + moment(str).add(1, "days").isBefore(form_info_data.date_time[0]) || + moment(str).isAfter(form_info_data.date_time[1]); + } + return isDisabled; }; const onPageChange = () => {}; const onCountChange = () => {};