♻️ refactor: 卡密商品有效期不做限制

This commit is contained in:
wangsongsole 2023-08-11 17:19:11 +08:00
parent f555d81c8f
commit c90d03a409
1 changed files with 28 additions and 28 deletions

View File

@ -417,33 +417,33 @@ const UseProductPop = forwardRef((props, ref) => {
}
}
const onDisabledTime = (date) => {
let step1 = JSON.parse(sessionStorage.getItem("knockGold_effectDate"))
const min = new Date(step1.begin_time)
const hour = min.getHours()
const minute = min.getMinutes()
const second = min.getSeconds()
const isSame = isSameDay(date, min)
// const onDisabledTime = (date) => {
// let step1 = JSON.parse(sessionStorage.getItem("knockGold_effectDate"))
// const min = new Date(step1.begin_time)
// const hour = min.getHours()
// const minute = min.getMinutes()
// const second = min.getSeconds()
// const isSame = isSameDay(date, min)
return isSame
? {
disabledHours: () => initArray(hour),
disabledMinutes: (hourValue) => (hourValue === hour ? initArray(minute) : []),
disabledSeconds: (hourValue, minuteValue) =>
hourValue === hour && minuteValue === minute ? initArray(second) : []
}
: {}
}
const onDisabledRange = (date, type) => {
let step1 = JSON.parse(sessionStorage.getItem("knockGold_effectDate"))
let disabled = false
if (step1) {
let str = moment(date).format("YYYY-MM-DD HH:mm:ss")
disabled =
moment(str).add(1, "days").isBefore(step1.begin_time) || moment(str).isAfter(step1.end_time)
}
return disabled
}
// return isSame
// ? {
// disabledHours: () => initArray(hour),
// disabledMinutes: (hourValue) => (hourValue === hour ? initArray(minute) : []),
// disabledSeconds: (hourValue, minuteValue) =>
// hourValue === hour && minuteValue === minute ? initArray(second) : []
// }
// : {}
// }
// const onDisabledRange = (date, type) => {
// let step1 = JSON.parse(sessionStorage.getItem("knockGold_effectDate"))
// let disabled = false
// if (step1) {
// let str = moment(date).format("YYYY-MM-DD HH:mm:ss")
// disabled =
// moment(str).add(1, "days").isBefore(step1.begin_time) || moment(str).isAfter(step1.end_time)
// }
// return disabled
// }
const onUploadChangeGoods = (files, type) => {
//
@ -533,8 +533,8 @@ const UseProductPop = forwardRef((props, ref) => {
end_time: val
})
}}
disabledTime={onDisabledTime}
disabledDate={onDisabledRange}
// disabledTime={onDisabledTime}
// disabledDate={onDisabledRange}
/>
</FormItem>
) : null}