...
|
...
|
@@ -103,17 +103,21 @@ |
|
|
}
|
|
|
|
|
|
this.dateRange = newDay !== this.curDay ? [newDay, curDay] : [newDay, newDay];
|
|
|
|
|
|
},
|
|
|
dateRange(newDate) {
|
|
|
this.beginDate = Array.isArray(newDate) ? newDate[0] : newDate;
|
|
|
this.endDate = Array.isArray(newDate) ? newDate[1] : newDate;
|
|
|
this.day = this.beginDate === this.endDate === this.today ? '' : this.beginDate;
|
|
|
this.curTarget = 'uv';
|
|
|
|
|
|
this.getOverviewData();
|
|
|
|
|
|
if (this.beginDate === this.endDate) {
|
|
|
|
|
|
// if (this.beginDate === this.endDate) {
|
|
|
this.getDataFlag = true;
|
|
|
this.getOverviewTrend();
|
|
|
}
|
|
|
this.getOverviewData();
|
|
|
// }
|
|
|
},
|
|
|
curTarget(value) {
|
|
|
|
...
|
...
|
@@ -123,11 +127,11 @@ |
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (this.beginDate === this.endDate) {
|
|
|
this.setOverviewParams(this.curTarget);
|
|
|
} else {
|
|
|
this.setOverviewParamsRank(this.curTarget);
|
|
|
}
|
|
|
// if (this.beginDate === this.endDate) {
|
|
|
this.getOverviewTrend();
|
|
|
// } else {
|
|
|
// this.setOverviewParamsRank();
|
|
|
// }
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
...
|
...
|
@@ -137,38 +141,9 @@ |
|
|
loadData() {
|
|
|
this.getOverviewData();
|
|
|
|
|
|
if (this.beginDate === this.endDate) {
|
|
|
// if (this.beginDate === this.endDate) {
|
|
|
this.getOverviewTrend();
|
|
|
}
|
|
|
},
|
|
|
getOverviewTrend() {
|
|
|
this.goodService.getOverviewTrend({
|
|
|
type: this.curTarget,
|
|
|
begin: this.beginDate,
|
|
|
end: this.endDate,
|
|
|
platform: '1,2'
|
|
|
}).then(ret => {
|
|
|
|
|
|
let result = _.castArray(ret.data);
|
|
|
|
|
|
let item01 = [],
|
|
|
item02 = [];
|
|
|
|
|
|
_.forEach(result[0], it=>{
|
|
|
item01.push(it);
|
|
|
});
|
|
|
_.forEach(result[1], it=>{
|
|
|
item02.push(it);
|
|
|
});
|
|
|
|
|
|
this.overviewChartData.xAxis = _.map(_.flatten(item01), 'hour');
|
|
|
this.overviewChartData.uv = [_.map(_.flatten(item01), 'value'), _.map(_.flatten(item02), 'value')];
|
|
|
this.overviewChartData.pv = [_.map(_.flatten(item01), 'value'), _.map(_.flatten(item02), 'value')];
|
|
|
this.overviewChartData.orderCount = [_.map(_.flatten(item01), 'value'), _.map(_.flatten(item02), 'value')];
|
|
|
this.overviewChartData.orderAmount = [_.map(_.flatten(item01), 'value'), _.map(_.flatten(item02), 'value')];
|
|
|
|
|
|
this.setOverviewParams();
|
|
|
});
|
|
|
// }
|
|
|
},
|
|
|
setOverviewParams() {
|
|
|
|
...
|
...
|
@@ -203,8 +178,62 @@ |
|
|
]
|
|
|
};
|
|
|
},
|
|
|
getOverviewTrend() {
|
|
|
this.goodService.getOverviewTrend({
|
|
|
type: this.curTarget,
|
|
|
begin: this.beginDate,
|
|
|
end: this.endDate,
|
|
|
platform: '1,2'
|
|
|
}).then(ret => {
|
|
|
|
|
|
if (this.beginDate === this.endDate) {
|
|
|
let result = _.castArray(ret.data);
|
|
|
|
|
|
let item01 = [],
|
|
|
item02 = [];
|
|
|
|
|
|
_.forEach(result[0], it=>{
|
|
|
item01.push(it);
|
|
|
});
|
|
|
_.forEach(result[1], it=>{
|
|
|
item02.push(it);
|
|
|
});
|
|
|
this.overviewChartData.xAxis = _.map(_.flatten(item01), 'hour');
|
|
|
this.overviewChartData.uv = [_.map(_.flatten(item01), 'value'), _.map(_.flatten(item02), 'value')];
|
|
|
this.overviewChartData.pv = [_.map(_.flatten(item01), 'value'), _.map(_.flatten(item02), 'value')];
|
|
|
this.overviewChartData.orderCount = [_.map(_.flatten(item01), 'value'), _.map(_.flatten(item02), 'value')];
|
|
|
this.overviewChartData.orderAmount = [_.map(_.flatten(item01), 'value'), _.map(_.flatten(item02), 'value')];
|
|
|
console.log('进错没有')
|
|
|
this.setOverviewParams();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
console.log('进来了,大王');
|
|
|
let data = ret.data;
|
|
|
|
|
|
let sum = [],
|
|
|
name = [];
|
|
|
|
|
|
_.forEach(data, function(value, key) {
|
|
|
|
|
|
sum.push(
|
|
|
_.sum(_.map(value, 'value'))
|
|
|
);
|
|
|
name.push(key);
|
|
|
|
|
|
});
|
|
|
|
|
|
this.overviewChartData.xAxis = name;
|
|
|
this.overviewChartData.uv = sum;
|
|
|
this.overviewChartData.pv = sum;
|
|
|
this.overviewChartData.orderCount = sum;
|
|
|
this.overviewChartData.orderAmount = sum;
|
|
|
|
|
|
this.setOverviewParamsRank();
|
|
|
}
|
|
|
|
|
|
});
|
|
|
},
|
|
|
getOverviewData() {
|
|
|
this.goodService.getData({
|
|
|
begin: this.beginDate,
|
...
|
...
|
@@ -232,12 +261,21 @@ |
|
|
this.overviewChartData.orderAmount = _.get(ret, 'orderAmount');
|
|
|
this.overviewChartData.xAxis = _.map(formatData, 'hour');
|
|
|
|
|
|
this.setOverviewParamsRank();
|
|
|
// this.setOverviewParamsRank();
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
exportFile() {
|
|
|
let param = {};
|
|
|
|
|
|
param.begin = this.beginDate;
|
|
|
param.end = this.endDate;
|
|
|
param.platform = '1,2';
|
|
|
|
|
|
const href = '/Api/platform/exportOneShopOverview?queryConf=' +
|
|
|
JSON.stringify(param);
|
|
|
|
|
|
window.open(href, '_blank');
|
|
|
},
|
|
|
},
|
|
|
components: {
|
...
|
...
|
|