完成功能
1.修改商品
相关界面:
2.订单管理的日期选择
相关界面:
相关代码:
let searchLogo=require("../../../assets/img/查询.svg")
let lastYear=ref(2021)
let lastMonth=ref(9)
let lastDay=ref(5)
let nextYear=ref(new Date().getFullYear())
let nextMonth=ref(new Date().getMonth()+1)
let nextDay=ref(new Date().getDate())
let lastYearList=reactive({
list:[]
})
let lastMonthList=reactive({
list:[]
})
let lastDayList=reactive({
list:[]
})
let nextYearList=reactive({
list:[]
})
let nextMonthList=reactive({
list:[]
})
let nextDayList=reactive({
list:[]
})
let year=new Date().getFullYear();
for(let i=2021;i<=Number(year);i++){
lastYearList.list.push(i);
nextYearList.list.push(i);
}
for(let i=1;i<=new Date().getMonth()+1;i++){
lastMonthList.list.push(i)
nextMonthList.list.push(i)
}
for(let i=1;i<=new Date().getDate();i++){
lastDayList.list.push(i)
nextDayList.list.push(i)
}
watch(
lastYear,
()=>{
lastMonthList.list.splice(0,lastMonthList.list.length)
lastMonth.value=''
if(lastYear.value<new Date().getFullYear()){
for(let i=1;i<=12;i++){
lastMonthList.list[i-1]=i
}
}else {
for(let i=1;i<=new Date().getMonth()+1;i++){
lastMonthList.list[i-1]=i
}
}
}
)
watch(
nextYear,
()=>{
nextMonthList.list.splice(0,nextMonthList.list.length)
nextMonth.value=''
if(nextYear.value<new Date().getFullYear()){
for(let i=1;i<=12;i++){
nextMonthList.list[i-1]=i
}
}else {
for(let i=1;i<=new Date().getMonth()+1;i++){
nextMonthList.list[i-1]=i
}
}
}
)
watch(
lastMonth,
()=>{
lastDayList.list.splice(0,lastDayList.list.length)
lastDay.value=''
if(lastMonth.value==(new Date().getMonth()+1)&&lastYear.value==year){
for(let i=1;i<=new Date().getDate();i++){
lastDayList.list[i-1]=i
}
}else {
for(let i=1;i<=new Date(lastYear.value,lastMonth.value,0).getDate();i++){
lastDayList.list[i-1]=i
}
}
}
)
watch(
nextMonth,
()=>{
nextDayList.list.splice(0, nextDayList.list.length)
lastDay.value=''
if(nextMonth.value==(new Date().getMonth()+1)&&nextYear.value==year){
for(let i=1;i<=new Date().getDate();i++){
nextDayList.list[i-1]=i
}
}else {
for(let i=1;i<=new Date(nextYear.value,nextMonth.value,0).getDate();i++){
nextDayList.list[i-1]=i
}
}
}
)