时间插架

main
fanfan 8 months ago
parent 549759a877
commit 49b24a4482
  1. 52
      src/views/dataCenter/goods/Index.vue

@ -81,6 +81,7 @@
range-separator="至"
start-placeholder="开始时间"
size="mini"
:default-time="['00:00:00', '23:59:59']"
end-placeholder="结束时间"
value-format="yyyy-MM-dd HH:mm:ss"
>
@ -437,15 +438,23 @@ export default {
{
text: '今天',
onClick(picker) {
picker.$emit('pick', [new Date(), new Date()])
const end = new Date()
const start = new Date()
start.setHours(0, 0, 0)
end.setHours(23, 59, 59)
picker.$emit('pick', [start, end])
},
},
{
text: '昨天',
onClick(picker) {
const date = new Date()
date.setTime(date.getTime() - 3600 * 1000 * 24)
picker.$emit('pick', [date, date])
let start = new Date()
let end = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24)
end.setTime(end.getTime() - 3600 * 1000 * 24)
start.setHours(0, 0, 0)
end.setHours(23, 59, 59)
picker.$emit('pick', [start, end])
},
},
{
@ -455,6 +464,8 @@ export default {
const start = new Date()
end.setTime(start.getTime() - 3600 * 1000 * 24)
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
start.setHours(0, 0, 0)
end.setHours(23, 59, 59)
picker.$emit('pick', [start, end])
},
},
@ -465,6 +476,8 @@ export default {
const start = new Date()
end.setTime(start.getTime() - 3600 * 1000 * 24)
start.setTime(start.getTime() - 3600 * 1000 * 24 * 15)
start.setHours(0, 0, 0)
end.setHours(23, 59, 59)
picker.$emit('pick', [start, end])
},
},
@ -475,19 +488,11 @@ export default {
const start = new Date()
end.setTime(start.getTime() - 3600 * 1000 * 24)
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
start.setHours(0, 0, 0)
end.setHours(23, 59, 59)
picker.$emit('pick', [start, end])
},
},
// {
// text: '90',
// onClick(picker) {
// const end = new Date()
// const start = new Date()
// end.setTime(start.getTime() - 3600 * 1000 * 24)
// start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
// picker.$emit('pick', [start, end])
// },
// },
{
text: '近180天',
onClick(picker) {
@ -495,6 +500,8 @@ export default {
const start = new Date()
end.setTime(start.getTime() - 3600 * 1000 * 24)
start.setTime(start.getTime() - 3600 * 1000 * 24 * 180)
start.setHours(0, 0, 0)
end.setHours(23, 59, 59)
picker.$emit('pick', [start, end])
},
},
@ -505,6 +512,8 @@ export default {
const start = new Date()
end.setTime(start.getTime() - 3600 * 1000 * 24)
start.setTime(start.getTime() - 3600 * 1000 * 24 * 365)
start.setHours(0, 0, 0)
end.setHours(23, 59, 59)
picker.$emit('pick', [start, end])
},
},
@ -518,11 +527,11 @@ export default {
var thisDay = start.getDay()
//
var thisDate = start.getDate()
console.log(thisDay)
console.log(thisDate)
if (thisDay != 0) {
start.setDate(thisDate - thisDay + 1)
}
start.setHours(0, 0, 0)
end.setHours(23, 59, 59)
picker.$emit('pick', [start, end])
},
},
@ -532,7 +541,8 @@ export default {
const end = new Date()
const start = new Date()
end.setTime(start.getTime() - 3600 * 1000 * 24)
start.setDate(1)
start.setHours(0, 0, 0)
end.setHours(23, 59, 59)
picker.$emit('pick', [start, end])
},
},
@ -542,7 +552,8 @@ export default {
const end = new Date()
const start = new Date(end.getFullYear(), Math.floor(end.getMonth() / 3) * 3 - 3, 1)
end.setMonth(start.getMonth() + 3)
end.setDate(0)
start.setHours(0, 0, 0)
end.setHours(23, 59, 59)
picker.$emit('pick', [start, end])
},
},
@ -557,6 +568,8 @@ export default {
var start = new Date(thisYear, Month - 2, 1)
var end = new Date()
end.setTime(end.getTime() - 3600 * 1000 * 24)
start.setHours(0, 0, 0)
end.setHours(23, 59, 59)
picker.$emit('pick', [start, end])
},
},
@ -568,6 +581,8 @@ export default {
start.setMonth(0)
start.setDate(1)
end.setTime(end.getTime() - 3600 * 1000 * 24)
start.setHours(0, 0, 0)
end.setHours(23, 59, 59)
picker.$emit('pick', [start, end])
},
},
@ -597,7 +612,6 @@ export default {
methods: {
validateAmount() {
let row = this.rate
console.log(row)
//0
if (row < 0) {
this.$message.error('金额不能小于0')

Loading…
Cancel
Save