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