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 = () => {};