diff --git a/fuintAdmin/src/views/shopowner.vue b/fuintAdmin/src/views/shopowner.vue index fbd5c910a..69d59cf92 100644 --- a/fuintAdmin/src/views/shopowner.vue +++ b/fuintAdmin/src/views/shopowner.vue @@ -374,7 +374,11 @@ export default { start.setMinutes(0) start.setSeconds(0) start.setMilliseconds(0) - this.showValue = [start,new Date()] + this.value1 = [parseTime(new Date()),parseTime(new Date())] + }else if (command=='昨日'){ + let nowDate = new Date(); + let oneWeekAgo = new Date(nowDate.getTime() - 1 * 24 * 60 * 60 * 1000) + this.value1 = [parseTime(oneWeekAgo),parseTime(oneWeekAgo)] } else if (command=='本周'){ let nowDate = new Date(); let oneWeekAgo = new Date(nowDate.getTime() - 6 * 24 * 60 * 60 * 1000) @@ -383,7 +387,14 @@ export default { let nowDate = new Date(); let oneWeekAgo = new Date(nowDate.getTime() - 30 * 24 * 60 * 60 * 1000) this.value1 = [parseTime(oneWeekAgo),parseTime(nowDate)] - } else if (command=='本年'){ + }else if (command=='本季度'){ + let nowDate = new Date(); + let quarterStartMonth = Math.floor((nowDate.getMonth() + 1) / 3) * 3 - 2; + let quarterEndMonth = quarterStartMonth + 2; + let startDate = new Date(nowDate.getFullYear(), quarterStartMonth, 1); + let endDate = new Date(nowDate.getFullYear(), quarterEndMonth + 1, 0); + this.value1 = [parseTime(startDate), parseTime(endDate)]; + } else if (command=='本年'){ let nowDate = new Date(); let oneWeekAgo = new Date(nowDate.getFullYear() - 1, nowDate.getMonth(), nowDate.getDate()) this.value1 = [parseTime(oneWeekAgo),parseTime(nowDate)] @@ -406,7 +417,11 @@ export default { start.setMinutes(0) start.setSeconds(0) start.setMilliseconds(0) - this.showValue = [start,new Date()] + this.showValue = [parseTime(new Date()),parseTime(new Date())] + }else if (command=='昨日'){ + let nowDate = new Date(); + let oneWeekAgo = new Date(nowDate.getTime() - 1 * 24 * 60 * 60 * 1000) + this.showValue = [parseTime(oneWeekAgo),parseTime(oneWeekAgo)] } else if (command=='本周'){ let nowDate = new Date(); let oneWeekAgo = new Date(nowDate.getTime() - 6 * 24 * 60 * 60 * 1000) @@ -415,7 +430,14 @@ export default { let nowDate = new Date(); let oneWeekAgo = new Date(nowDate.getTime() - 30 * 24 * 60 * 60 * 1000) this.showValue = [parseTime(oneWeekAgo),parseTime(nowDate)] - } else if (command=='本年'){ + }else if (command=='本季度'){ + let nowDate = new Date(); + let quarterStartMonth = Math.floor((nowDate.getMonth() + 1) / 3) * 3 - 2; + let quarterEndMonth = quarterStartMonth + 2; + let startDate = new Date(nowDate.getFullYear(), quarterStartMonth, 1); + let endDate = new Date(nowDate.getFullYear(), quarterEndMonth + 1, 0); + this.showValue = [parseTime(startDate), parseTime(endDate)]; + } else if (command=='本年'){ let nowDate = new Date(); let oneWeekAgo = new Date(nowDate.getFullYear() - 1, nowDate.getMonth(), nowDate.getDate()) this.showValue = [parseTime(oneWeekAgo),parseTime(nowDate)] @@ -435,16 +457,27 @@ export default { start.setMinutes(0) start.setSeconds(0) start.setMilliseconds(0) - this.countValue = [start,new Date()] + // this.countValue = [start,new Date()] + this.countValue = [parseTime(new Date()),parseTime(new Date())] + }else if (command=='昨日'){ + let nowDate = new Date(); + let oneWeekAgo = new Date(nowDate.getTime() - 1 * 24 * 60 * 60 * 1000) + this.countValue = [parseTime(oneWeekAgo),parseTime(oneWeekAgo)] } else if (command=='本周'){ let nowDate = new Date(); let oneWeekAgo = new Date(nowDate.getTime() - 6 * 24 * 60 * 60 * 1000) this.countValue = [parseTime(oneWeekAgo),parseTime(nowDate)] } else if (command=='本月'){ - console.log('进入了人本月') let nowDate = new Date(); let oneWeekAgo = new Date(nowDate.getTime() - 30 * 24 * 60 * 60 * 1000) this.countValue = [parseTime(oneWeekAgo),parseTime(nowDate)] + }else if (command=='本季度'){ + let nowDate = new Date(); + let quarterStartMonth = Math.floor((nowDate.getMonth() + 1) / 3) * 3 - 2; + let quarterEndMonth = quarterStartMonth + 2; + let startDate = new Date(nowDate.getFullYear(), quarterStartMonth, 1); + let endDate = new Date(nowDate.getFullYear(), quarterEndMonth + 1, 0); + this.countValue = [parseTime(startDate), parseTime(endDate)]; } else if (command=='本年'){ let nowDate = new Date(); let oneWeekAgo = new Date(nowDate.getFullYear() - 1, nowDate.getMonth(), nowDate.getDate()) @@ -468,14 +501,21 @@ export default { let nowDate = new Date(); let oneWeekAgo = new Date(nowDate.getTime() - 6 * 24 * 60 * 60 * 1000) this.value2 = [parseTime(oneWeekAgo),parseTime(nowDate)] - } else if (command=='近一月'){ + } else if (command=='本月'){ let nowDate = new Date(); let oneWeekAgo = new Date(nowDate.getTime() - 30 * 24 * 60 * 60 * 1000) this.value2 = [parseTime(oneWeekAgo),parseTime(nowDate)] - } else if (command=='近一年'){ + }else if (command=='本季度'){ + let nowDate = new Date(); + let quarterStartMonth = Math.floor((nowDate.getMonth() + 1) / 3) * 3 - 2; + let quarterEndMonth = quarterStartMonth + 2; + let startDate = new Date(nowDate.getFullYear(), quarterStartMonth, 1); + let endDate = new Date(nowDate.getFullYear(), quarterEndMonth + 1, 0); + this.value2 = [parseTime(startDate), parseTime(endDate)]; + } else if (command=='本年'){ let nowDate = new Date(); let oneWeekAgo = new Date(nowDate.getFullYear() - 1, nowDate.getMonth(), nowDate.getDate()) - this.value2 = [parseTime(oneWeekAgo),parseTime(nowDate)] + this.value2 = [parseTime(oneWeekAgo),parseTime(nowDate)] }else if (command=='自定义'){ this.disabled = false } @@ -658,27 +698,30 @@ export default { }) this.dataCount.oilData.forEach(item => { let a =[item.time, ...item.money] - console.log("a",a) count.push(a) }) // 首页数据展示 const showTimes = this.dataShows.oilData.map(item => item.day); const showCount = []; - let cshow = ['product', ...this.dataCount.oilNames] + let cshow = ['product', ...this.dataShows.oilNames] showCount.push(cshow) let showCountType = [] - this.dataCount.oilNames.forEach(item => { + console.log("看看执行") + this.dataShows.oilNames.forEach(item => { let type={ type: 'bar' } showCountType.push(type) }) - this.dataCount.oilData.forEach(item => { - let a =[item.time, ...item.money] - console.log("a",a) + console.log(this.dataShows.oilData) + this.dataShows.oilData.forEach(item => { + let a =[item.day, ...item.oilPrices] showCount.push(a) + console.log("showCount",a) }) + console.log("showCount",showCount) + console.log("showCountType",showCountType) const option = { color: [ @@ -831,7 +874,6 @@ export default { containLabel: true } }; - console.log("option3",option3) const option4 = { tooltip: { trigger: 'axis',