<template>
<u--input fontSize="28rpx" color="#B9C5D3" disabled disabledColor="#fff"
v-model="params.firstDeliveryDate" placeholder="请选择首次发货日期">
</u--input>
<u--input fontSize="28rpx" color="#B9C5D3" disabled disabledColor="#fff" v-model="params.dayValue"
placeholder="请输入天数">
</u--input>
<van-calendar color="#3194f2" title="日历" :poppable="false" :show-confirm="false" class="calendar" readonly
type="multiple" :default-date="defaultDate" :max-date="maxDate" :show-title="false" />
</template>
export default {
data () {
params: {
dayValue: '', //天数
firstDeliveryDate: '' //首次发货日期
},
numberOfTimes:99,
maxDate:new Date().getTime()
},
computed: {
defaultDate () {
const { dayValue, firstDeliveryDate } = this.params
if (!dayValue || !firstDeliveryDate) return []
const tmp = []
for (let i = 0, n = this.numberOfTimes; i < n; i++) {
tmp.push(new Date(firstDeliveryDate).getTime() + 24 * 60 * 60 * 1000 * (dayValue + 1) * i)
}
this.maxDate = tmp.at(-1)
return tmp
}
},
}