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) { if (couponType === 0) {
// 1.1 // 1.1
await getPlanList().then((arr) => { await getPlanList().then((arr) => {
console.log("arr =>", arr);
// 1.2 // 1.2
if (editData && editData !== "") { if (editData && editData !== "") {
isEditFun(); isEditFun();
// 1.3 // 1.3
let plan_row = arr.find( let plan_row = arr.find(
(item) => item.text === editData.plan_title (item) => item.text === editData.plan_title
); );
if ( if (
plan_row && plan_row &&
plan_row !== undefined && plan_row !== undefined &&
@ -687,14 +686,20 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
); );
}; };
const onDisabledRange = (date, type) => { const onDisabledRange = (date, type) => {
let disabled = false; let isDisabled = false;
if (type === "end") { let str = moment(date).format("YYYY-MM-DD HH:mm:ss");
disabled = moment(date.getTime()).add(1, "days") <= new Date().getTime();
}
if (type === "start") { 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 onPageChange = () => {};
const onCountChange = () => {}; const onCountChange = () => {};