fix: 修复优惠券编辑根据计划时间选择

This commit is contained in:
zhangds 2022-09-30 11:19:54 +08:00
parent 08f28aaad0
commit e183c32f5d
1 changed files with 13 additions and 8 deletions

View File

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