Commit 8ae9b42c by 夏新然

三个统计

1 parent 8fd353b2
......@@ -75,6 +75,36 @@
"navigationBarTitleText": "基础统计周"
}
},{
"path": "pages/analysis/staticReport/staticMonthReport",
"style": {
"navigationBarTitleText": "基础统计月"
}
},{
"path": "pages/analysis/staticReport/staticYearReport",
"style": {
"navigationBarTitleText": "基础统计年"
}
},{
"path": "pages/analysis/inoutReport/inoutDayReport",
"style": {
"navigationBarTitleText": "进出客流对比"
}
},{
"path": "pages/analysis/rankReport/rankDayReport",
"style": {
"navigationBarTitleText": "排行榜统计"
}
},{
"path": "pages/analysis/rankReport/rankWeekReport",
"style": {
"navigationBarTitleText": "排行榜统计"
}
},{
"path": "pages/analysis/staticReport/staticWeekReport",
"style": {
"navigationBarTitleText": "基础统计周"
}
},{
"path": "pages/analysis/condition",
"style": {
"navigationBarTitleText": ""
......
......@@ -85,10 +85,10 @@
:anchor="currentDate"
@confirm="dateConfirm">
<div class="typeBox">
<span :class="{'activeDateType':currentDateType=='day'}" @click="dateClick('day')">日</span>
<span :class="{'activeDateType':currentDateType=='week'}" @click="dateClick('week')">周</span>
<span :class="{'activeDateType':currentDateType=='month'}" @click="dateClick('month')">月</span>
<span :class="{'activeDateType':currentDateType=='year'}" @click="dateClick('year')">年</span>
<span :class="{'activeDateType':currentDateType=='day'}" @click="dateClick('day')">日</span>
<span v-show="allShow=='true'" :class="{'activeDateType':currentDateType=='week'}" @click="dateClick('week')">周</span>
<span v-show="allShow=='true'" :class="{'activeDateType':currentDateType=='month'}" @click="dateClick('month')">月</span>
<span v-show="allShow=='true'" :class="{'activeDateType':currentDateType=='year'}" @click="dateClick('year')">年</span>
</div>
</awesome-picker>
</div>
......@@ -101,6 +101,7 @@
export default{
data(){
return{
allShow:true,
leftImg:leftImg,
rightText:'保存',
navheight:0,
......@@ -135,7 +136,8 @@
floorText:'',
storeText:'',
id:'',
atoken:''
atoken:'',
backUrl:''
}
},
onLoad: function (option) {
......@@ -143,6 +145,18 @@
this.activeType=option.type;
}
uni.getStorage({
key:'backUrl',
success: (res) => {
this.backUrl=res.data;
}
})
uni.getStorage({
key:'allShow',
success: (res) => {
this.allShow=res.data;
}
})
uni.getStorage({
key:'currentDateType',
success: (res) => {
this.currentDateType2=res.data;
......@@ -358,16 +372,37 @@
key:'currentDateType',
data:this.currentDateType
})
if(this.currentDateType2=='day'){
uni.navigateTo({
url:"staticReport/staticDayReport?types="+this.activeType,
})
}else if(this.currentDateType2=='week'){
uni.navigateTo({
url:"staticReport/staticWeekReport?types="+this.activeType,
})
var urls=''
switch (this.backUrl)
{
case 1:{
if(this.currentDateType2=='day'){
urls='staticReport/staticDayReport'
}else if(this.currentDateType2=='week'){
urls='staticReport/staticWeekReport'
}else if(this.currentDateType2=='month'){
urls='staticReport/staticMonthReport'
}else if(this.currentDateType2=='year'){
urls='staticReport/staticYearReport'
}
}
break;
case 2:{
urls='inoutReport/inoutDayReport'
}
break;
case 3:{
if(this.currentDateType2=='day'){
urls='rankReport/rankDayReport'
}else if(this.currentDateType2=='week'){
urls='rankReport/rankWeekReport'
}
}
break;
}
uni.navigateTo({
url:urls+"?types="+this.activeType,
})
},
goStoreList(){
uni.navigateTo({
......
......@@ -42,11 +42,13 @@
},{
text:"进出客流对比",
iconSrc:inout,
rArrow:arrow
rArrow:arrow,
src:'inoutReport/inoutDayReport'
},{
text:"排行榜统计",
iconSrc:rank,
rArrow:arrow
rArrow:arrow,
src:'rankReport/rankDayReport'
},{
text:"同环比分析",
iconSrc:yoy,
......@@ -86,7 +88,9 @@
}]
}
},
onLoad: function (option) {},
onLoad: function (option) {
this.initDate();
},
computed: {
i18n() {
return this.$t("index")
......@@ -103,6 +107,23 @@
animationDuration: 200
})
},
initDate(){
uni.setStorage({
key:'currentDateType',
data:'day'
})
var dates=new Date()
var y=dates.getFullYear();
var m=dates.getMonth()+1;
m=m<10?'0'+m:m;
var d=dates.getDate();
d=d<10?'0'+d:d;
var initDate=y+'-'+m+'-'+d;
uni.setStorage({
key:'selectDate',
data:initDate
})
}
},
}
</script>
......
<template>
<div>
<headerComp :leftImgSrc="leftImg" :title="titleStr" :rightImgSrc="rightImg" @leftClick="backFun" @rightClick="conditionFun"></headerComp>
<div style="height: 18.11upx;"></div>
<div class="selectBox">
<div class="sItem" :class="{ checkedItem: isHour}" @click="checkFun('hour')">小时级</div>
<div class="sItem" :class="{ checkedItem: isMin}" @click="checkFun('min')">分钟级</div>
</div>
<v-table v-if="columns.length>0"
is-horizontal-resize
style="width:100%"
:columns="columns"
:table-data="tableData"
row-hover-color="#eee"
:title-rows="titleRows"
row-click-color="#edf7ff"
:height='500'
></v-table>
</div>
</template>
<script>
import headerComp from '../../../components/header'
import backArrow from '../../../static/header/backArrow.png'
import other from '../../../static/header/other.png'
import tables from '../../../components/table'
export default{
data(){
return{
titleStr:'进出客流对比',
leftImg:backArrow,
rightImg:other,
atoken:'',
keyArr:[],
chartIds:'',
reportType:'mall',
accountId:[],
orgIds:'',
date:'',
isHour:true,
isMin:false,
chartDatas:{},
chartData:{},
tableData:[],
columns:[],
gateId:[],
floorId:[],
storeId:[],
titleRows:[]
}
},
onLoad: function (option) {
if(option.types){
this.reportType=option.types;
}
uni.getStorage({
key:'atoken',
success:(res)=>{
this.atoken=res.data;
}
})
uni.getStorage({
key:'accountList',
success:(res)=>{
if(res.data){
var list=JSON.parse(res.data);
list.forEach((item,index)=>{
if(index==0){
this.accountId.push(item.id)
}
})
}
}
})
uni.getStorage({
key:'selectAccountIdArr',
success:(res)=> {
this.accountId=JSON.parse(res.data);
},
complete: (res) => {
}
})
uni.getStorage({
key:'selectGateIdArr',
success:(res)=> {
this.gateId=JSON.parse(res.data);
},
complete: (res) => {
}
})
uni.getStorage({
key:'selectFloorIdArr',
success:(res)=> {
this.floorId=JSON.parse(res.data);
},
complete: (res) => {
}
})
uni.getStorage({
key:'selectStoreIdArr',
success:(res)=> {
this.storeId=JSON.parse(res.data);
},
complete: (res) => {
}
})
const date = new Date();
var year = date.getFullYear();
var monthIndex = date.getMonth();
var month = monthIndex+1 > 9 ? monthIndex+1 : '0' + (monthIndex+1);
const d = date.getDate();
var day= d > 9 ? d : '0' + d;
this.date=year+'-'+month+'-'+day;
uni.getStorage({
key:'selectDate',
success:(res)=> {
this.date=res.data
},
complete: (res) => {
}
})
this.getReportKey();
},
computed: {
i18n() {
return this.$t("index")
}
},
components:{
headerComp,tables
},
methods: {
checkFun(val){
switch (val)
{
case 'hour':{
this.isHour=true;
this.isMin=false;
this.getChartData()
// this.$emit('handleFun','15');
}
break;
case 'min':{
this.isHour=false;
this.isMin=true;
this.getChartData()
// this.$emit('handleFun','30');
}
break;
}
},
backFun(){
uni.reLaunch({
url:"../index",
})
},
conditionFun(){
uni.setStorage({
key:'backUrl',
data:2
})
uni.setStorage({
key:'allShow',
data:'false'
})
uni.navigateTo({
url:'../condition'
})
},
getReportKey(){
var report='trafficInAndOut';
this.keyArr=['trafficInAndOutTable'];
uni.showLoading({
title: '加载中'
});
uni.request({
url:window.url+'/reportCharts',
data:{
report:report,
_t:Date.parse(new Date())/1000
},
header: {
'Authorization': this.atoken //自定义请求头信息
},
method:'GET',
success:(res) =>{
this.chartIds='';
res.data.data.forEach(item=>{
if(this.keyArr.indexOf(item.key)!='-1'){
this.chartIds+=item.id+','
}
})
this.chartIds=this.chartIds.substring(0,this.chartIds.length-1);
this.getChartData();
}
})
},
setTabelData(){
this.columns=[];
this.tableData=[];
var oneArr=[];
var twoArr=[];
this.titleRows=[];
this.chartDatas.xaxis.data.forEach((item,index)=>{
if(index==0){
oneArr.push({fields:[item],title:item,titleAlign:'center',rowspan:2})
this.columns.push( {field: item, title:item, width: 20, titleAlign: 'center',columnAlign:'center',isResize:true,isFrozen: true})
}else{
var headArr=eval(item);
oneArr.push({fields:[headArr[0]+headArr[1],headArr[0]+headArr[2]],title:headArr[0],titleAlign:'center',colspan:2});
twoArr.push( {fields: [headArr[0]+headArr[1]], title:headArr[1], width: 20, titleAlign: 'center'})
twoArr.push( {fields: [headArr[0]+headArr[2]], title:headArr[2], width: 20, titleAlign: 'center'})
this.columns.push( {field: headArr[0]+headArr[1], title:headArr[1], width: 20, titleAlign: 'center',columnAlign:'center',isResize:true})
this.columns.push( {field: headArr[0]+headArr[2], title:headArr[2], width: 20, titleAlign: 'center',columnAlign:'center',isResize:true})
}
})
this.titleRows.push(oneArr)
this.titleRows.push(twoArr)
console.log(JSON.stringify(this.titleRows))
this.chartDatas.series.forEach((item,index)=>{
var obj={}
item.data.forEach((item,index)=>{
if(index==0){
obj[this.chartDatas.xaxis.data[index]]=item;
}else{
if(index%2==1){
var headItem=eval(this.chartDatas.xaxis.data[ Math.ceil(index/2)]);
obj[headItem[0]+headItem[1]]=item;
}else{
var headItem=eval(this.chartDatas.xaxis.data[ Math.ceil(index/2)]);
obj[headItem[0]+headItem[2]]=item;
}
}
})
this.tableData.push(obj)
})
},
getChartData(){
this.orgIds=''
var data={}
var url=window.url+'/report/trafficInAndOut/mall';
if(this.reportType=='mall'){
this.accountId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
url=window.url+'/report/trafficInAndOut/mall';
data={
orgIds:this.orgIds,
date:this.date,
chartIds:this.chartIds,
_t:Date.parse(new Date())/1000
}
}else if(this.reportType=='gate'){
this.gateId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
url=window.url+'/report/trafficInAndOut/gate';
data={
orgIds:this.orgIds,
date:this.date,
chartIds:this.chartIds,
_t:Date.parse(new Date())/1000
}
}else if(this.reportType=='floor'){
this.floorId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
url=window.url+'/report/trafficInAndOut/floor';
data={
orgIds:this.orgIds,
date:this.date,
chartIds:this.chartIds,
_t:Date.parse(new Date())/1000
}
}else if(this.reportType=='area'){
this.storeId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
url=window.url+'/report/trafficInAndOut/zone';
data={
orgIds:this.orgIds,
date:this.date,
chartIds:this.chartIds,
_t:Date.parse(new Date())/1000
}
}
if(this.isHour){
data.option='TAB_HOUR'
}else{
data.option='TAB_MINUTE'
}
uni.request({
url:url,
header: {
'Authorization': this.atoken //自定义请求头信息
},
data:data,
method:'GET',
success:(res) =>{
uni.hideLoading()
var datas=res.data.data;
this.chartData=datas.body;
this.chartDatas=datas.body.trafficInAndOutTable;
this.setTabelData()
}
})
}
},
}
</script>
<style>
.selectBox{
width: 646.73upx;
height: 61.59upx;
font-size: 18.11upx;
line-height: 61.59upx;
display: flex;
flex-direction: row;
margin: 0 auto;
margin-bottom: 18.11upx;
}
.sItem{
flex: 1;
background:#FFFFFF;
text-align: center;
cursor: pointer;
border-right:1px solid #DBDBDB ;
}
.sItem:last-of-type{
border-right:none
}
.checkedItem{
background: #0069FF;
color: #FFFFFF;
border: #0069FF;
}
</style>
<template>
<div>
<headerComp :leftImgSrc="leftImg" :title="titleStr" :rightImgSrc="rightImg" @leftClick="backFun" @rightClick="conditionFun"></headerComp>
<div style="height: 18.11upx;"></div>
<!-- <div class="selectBox">
<div class="sItem" :class="{ checkedItem: isDay}" @click="checkFun('day')">天汇总</div>
<div class="sItem" :class="{ checkedItem: isHour}" @click="checkFun('hour')">小时级</div>
<div class="sItem" :class="{ checkedItem: isMin}" @click="checkFun('min')">分钟级</div>
</div> -->
<v-table v-if="columns.length>0"
is-horizontal-resize
style="width:100%"
:columns="columns"
:table-data="tableData"
row-hover-color="#eee"
row-click-color="#edf7ff"
:height='500'
></v-table>
</div>
</template>
<script>
import headerComp from '../../../components/header'
import backArrow from '../../../static/header/backArrow.png'
import other from '../../../static/header/other.png'
import tables from '../../../components/table'
export default{
data(){
return{
titleStr:'排行榜统计',
leftImg:backArrow,
rightImg:other,
atoken:'',
keyArr:[],
chartIds:'',
reportType:'mall',
accountId:[],
orgIds:'',
date:'',
isDay:true,
isHour:false,
isMin:false,
chartDatas:{},
chartData:{},
tableData:[],
columns:[],
gateId:[],
floorId:[],
storeId:[]
}
},
onLoad: function (option) {
if(option.types){
this.reportType=option.types;
}
uni.getStorage({
key:'atoken',
success:(res)=>{
this.atoken=res.data;
}
})
uni.getStorage({
key:'accountList',
success:(res)=>{
if(res.data){
var list=JSON.parse(res.data);
list.forEach((item,index)=>{
if(index==0){
this.accountId.push(item.id)
}
})
}
}
})
uni.getStorage({
key:'selectAccountIdArr',
success:(res)=> {
this.accountId=JSON.parse(res.data);
},
complete: (res) => {
}
})
uni.getStorage({
key:'selectGateIdArr',
success:(res)=> {
this.gateId=JSON.parse(res.data);
},
complete: (res) => {
}
})
uni.getStorage({
key:'selectFloorIdArr',
success:(res)=> {
this.floorId=JSON.parse(res.data);
},
complete: (res) => {
}
})
uni.getStorage({
key:'selectStoreIdArr',
success:(res)=> {
this.storeId=JSON.parse(res.data);
},
complete: (res) => {
}
})
const date = new Date();
var year = date.getFullYear();
var monthIndex = date.getMonth();
var month = monthIndex+1 > 9 ? monthIndex+1 : '0' + (monthIndex+1);
const d = date.getDate();
var day= d > 9 ? d : '0' + d;
this.date=year+'-'+month+'-'+day;
uni.getStorage({
key:'selectDate',
success:(res)=> {
this.date=res.data
},
complete: (res) => {
}
})
this.getReportKey();
},
computed: {
i18n() {
return this.$t("index")
}
},
components:{
headerComp,tables
},
methods: {
checkFun(val){
switch (val)
{
case 'day':{
this.isDay=true;
this.isHour=false;
this.isMin=false;
this.chartDatas=this.chartData.kpiData;
this.setTabelData()
// this.$emit('handleFun','7');
}
break;
case 'hour':{
this.isDay=false;
this.isHour=true;
this.isMin=false;
this.chartDatas=this.chartData.trafficHour;
this.setTabelData()
// this.$emit('handleFun','15');
}
break;
case 'min':{
this.isDay=false;
this.isHour=false;
this.isMin=true;
this.chartDatas=this.chartData.traffic10Min;
this.setTabelData()
// this.$emit('handleFun','30');
}
break;
}
},
backFun(){
uni.reLaunch({
url:"../index",
})
},
conditionFun(){
uni.setStorage({
key:'backUrl',
data:3
})
uni.setStorage({
key:'allShow',
data:'true'
})
uni.navigateTo({
url:'../condition'
})
},
getReportKey(){
var report='ranking';
this.keyArr=['rankingList'];
uni.showLoading({
title: '加载中'
});
uni.request({
url:window.url+'/reportCharts',
data:{
report:report,
_t:Date.parse(new Date())/1000
},
header: {
'Authorization': this.atoken //自定义请求头信息
},
method:'GET',
success:(res) =>{
this.chartIds='';
res.data.data.forEach(item=>{
if(this.keyArr.indexOf(item.key)!='-1'){
this.chartIds+=item.id+','
}
})
this.chartIds=this.chartIds.substring(0,this.chartIds.length-1);
this.getChartData();
}
})
},
setTabelData(){
this.columns=[];
this.tableData=[];
this.columns.push({field: '名称', title:'名称', width: 20, titleAlign: 'center',columnAlign:'center',isResize:true,isFrozen: true})
this.chartDatas.xaxis.data.forEach((item,index)=>{
this.columns.push( {field: item, title:item, width: 20, titleAlign: 'center',columnAlign:'center',isResize:true})
})
this.chartDatas.series.forEach((item,index)=>{
var obj={}
item.data.forEach((item,index)=>{
obj[this.chartDatas.xaxis.data[index]]=item;
})
obj['名称']=item.name;
this.tableData.push(obj)
})
},
getChartData(){
this.orgIds=''
var data={}
var url=window.url+'/report/ranking/mall';
if(this.reportType=='mall'){
this.accountId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
var startDate=this.date;
var endDate=this.date;
url=window.url+'/report/ranking/mall';
data={
orgIds:this.orgIds,
startDate:startDate,
endDate: endDate,
chartIds:this.chartIds,
kpiTypes:'TRAFFIC',
_t:Date.parse(new Date())/1000
}
}else if(this.reportType=='gate'){
this.gateId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
var startDate=this.date;
var endDate=this.date;
url=window.url+'/report/ranking/gate';
data={
orgIds:this.orgIds,
startDate:startDate,
endDate: endDate,
chartIds:this.chartIds,
kpiTypes:'TRAFFIC',
_t:Date.parse(new Date())/1000
}
}else if(this.reportType=='floor'){
this.floorId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
url=window.url+'/report/ranking/floor';
var startDate=this.date;
var endDate=this.date;
data={
orgIds:this.orgIds,
startDate:startDate,
endDate: endDate,
chartIds:this.chartIds,
kpiTypes:'TRAFFIC',
_t:Date.parse(new Date())/1000
}
}else if(this.reportType=='area'){
this.storeId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
url=window.url+'/report/ranking/zone';
var startDate=this.date;
var endDate=this.date;
data={
orgIds:this.orgIds,
startDate:startDate,
endDate: endDate,
chartIds:this.chartIds,
kpiTypes:'TRAFFIC',
_t:Date.parse(new Date())/1000
}
}
uni.request({
url:url,
header: {
'Authorization': this.atoken //自定义请求头信息
},
data:data,
method:'GET',
success:(res) =>{
uni.hideLoading()
var datas=res.data.data;
this.chartData=datas.body;
this.chartDatas=datas.body.rankingList;
this.setTabelData()
}
})
}
},
}
</script>
<style>
.selectBox{
width: 646.73upx;
height: 61.59upx;
font-size: 18.11upx;
line-height: 61.59upx;
display: flex;
flex-direction: row;
margin: 0 auto;
margin-bottom: 18.11upx;
}
.sItem{
flex: 1;
background:#FFFFFF;
text-align: center;
cursor: pointer;
border-right:1px solid #DBDBDB ;
}
.sItem:last-of-type{
border-right:none
}
.checkedItem{
background: #0069FF;
color: #FFFFFF;
border: #0069FF;
}
</style>
<template>
<div>
<headerComp :leftImgSrc="leftImg" :title="titleStr" :rightImgSrc="rightImg" @leftClick="backFun" @rightClick="conditionFun"></headerComp>
<div style="height: 18.11upx;"></div>
<!-- <div class="selectBox">
<div class="sItem" :class="{ checkedItem: isDay}" @click="checkFun('day')">天汇总</div>
<div class="sItem" :class="{ checkedItem: isHour}" @click="checkFun('hour')">小时级</div>
<div class="sItem" :class="{ checkedItem: isMin}" @click="checkFun('min')">分钟级</div>
</div> -->
<v-table v-if="columns.length>0"
is-horizontal-resize
style="width:100%"
:columns="columns"
:table-data="tableData"
row-hover-color="#eee"
row-click-color="#edf7ff"
:height='500'
></v-table>
</div>
</template>
<script>
import headerComp from '../../../components/header'
import backArrow from '../../../static/header/backArrow.png'
import other from '../../../static/header/other.png'
import tables from '../../../components/table'
export default{
data(){
return{
titleStr:'排行榜统计',
leftImg:backArrow,
rightImg:other,
atoken:'',
keyArr:[],
chartIds:'',
reportType:'mall',
accountId:[],
orgIds:'',
date:'',
isDay:true,
isHour:false,
isMin:false,
chartDatas:{},
chartData:{},
tableData:[],
columns:[],
gateId:[],
floorId:[],
storeId:[]
}
},
onLoad: function (option) {
if(option.types){
this.reportType=option.types;
}
uni.getStorage({
key:'atoken',
success:(res)=>{
this.atoken=res.data;
}
})
uni.getStorage({
key:'accountList',
success:(res)=>{
if(res.data){
var list=JSON.parse(res.data);
list.forEach((item,index)=>{
if(index==0){
this.accountId.push(item.id)
}
})
}
}
})
uni.getStorage({
key:'selectAccountIdArr',
success:(res)=> {
this.accountId=JSON.parse(res.data);
},
complete: (res) => {
}
})
uni.getStorage({
key:'selectGateIdArr',
success:(res)=> {
this.gateId=JSON.parse(res.data);
},
complete: (res) => {
}
})
uni.getStorage({
key:'selectFloorIdArr',
success:(res)=> {
this.floorId=JSON.parse(res.data);
},
complete: (res) => {
}
})
uni.getStorage({
key:'selectStoreIdArr',
success:(res)=> {
this.storeId=JSON.parse(res.data);
},
complete: (res) => {
}
})
const date = new Date();
var year = date.getFullYear();
var monthIndex = date.getMonth();
var month = monthIndex+1 > 9 ? monthIndex+1 : '0' + (monthIndex+1);
const d = date.getDate();
var day= d > 9 ? d : '0' + d;
this.date=year+'-'+month+'-'+day;
uni.getStorage({
key:'selectDate',
success:(res)=> {
this.date=res.data
},
complete: (res) => {
}
})
this.getReportKey();
},
computed: {
i18n() {
return this.$t("index")
}
},
components:{
headerComp,tables
},
methods: {
checkFun(val){
switch (val)
{
case 'day':{
this.isDay=true;
this.isHour=false;
this.isMin=false;
this.chartDatas=this.chartData.kpiData;
this.setTabelData()
// this.$emit('handleFun','7');
}
break;
case 'hour':{
this.isDay=false;
this.isHour=true;
this.isMin=false;
this.chartDatas=this.chartData.trafficHour;
this.setTabelData()
// this.$emit('handleFun','15');
}
break;
case 'min':{
this.isDay=false;
this.isHour=false;
this.isMin=true;
this.chartDatas=this.chartData.traffic10Min;
this.setTabelData()
// this.$emit('handleFun','30');
}
break;
}
},
backFun(){
uni.reLaunch({
url:"../index",
})
},
conditionFun(){
uni.setStorage({
key:'backUrl',
data:3
})
uni.setStorage({
key:'allShow',
data:'true'
})
uni.navigateTo({
url:'../condition'
})
},
getReportKey(){
var report='ranking';
this.keyArr=['rankingList'];
uni.showLoading({
title: '加载中'
});
uni.request({
url:window.url+'/reportCharts',
data:{
report:report,
_t:Date.parse(new Date())/1000
},
header: {
'Authorization': this.atoken //自定义请求头信息
},
method:'GET',
success:(res) =>{
this.chartIds='';
res.data.data.forEach(item=>{
if(this.keyArr.indexOf(item.key)!='-1'){
this.chartIds+=item.id+','
}
})
this.chartIds=this.chartIds.substring(0,this.chartIds.length-1);
this.getChartData();
}
})
},
setTabelData(){
this.columns=[];
this.tableData=[];
this.chartDatas.xaxis.data.forEach((item,index)=>{
if(index==0){
this.columns.push( {field: item, title:item, width: 20, titleAlign: 'center',columnAlign:'center',isResize:true,isFrozen: true})
}else{
this.columns.push( {field: item, title:item, width: 20, titleAlign: 'center',columnAlign:'center',isResize:true})
}
})
this.chartDatas.series.forEach((item,index)=>{
var obj={}
item.data.forEach((item,index)=>{
obj[this.chartDatas.xaxis.data[index]]=item;
})
this.tableData.push(obj)
})
},
getChartData(){
this.orgIds=''
var data={}
var url=window.url+'/report/ranking/mall';
if(this.reportType=='mall'){
this.accountId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
var startDate=this.date.split(',')[0];
var endDate=this.date.split(',')[1];
url=window.url+'/report/ranking/mall';
data={
orgIds:this.orgIds,
startDate:startDate,
endDate: endDate,
chartIds:this.chartIds,
kpiTypes:'TRAFFIC',
_t:Date.parse(new Date())/1000
}
}else if(this.reportType=='gate'){
this.gateId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
var startDate=this.date.split(',')[0];
var endDate=this.date.split(',')[1];
url=window.url+'/report/ranking/gate';
data={
orgIds:this.orgIds,
startDate:startDate,
endDate: endDate,
chartIds:this.chartIds,
kpiTypes:'TRAFFIC',
_t:Date.parse(new Date())/1000
}
}else if(this.reportType=='floor'){
this.floorId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
url=window.url+'/report/ranking/floor';
var startDate=this.date.split(',')[0];
var endDate=this.date.split(',')[1];
data={
orgIds:this.orgIds,
startDate:startDate,
endDate: endDate,
chartIds:this.chartIds,
kpiTypes:'TRAFFIC',
_t:Date.parse(new Date())/1000
}
}else if(this.reportType=='area'){
this.storeId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
url=window.url+'/report/ranking/zone';
var startDate=this.date.split(',')[0];
var endDate=this.date.split(',')[1];
data={
orgIds:this.orgIds,
startDate:startDate,
endDate: endDate,
chartIds:this.chartIds,
kpiTypes:'TRAFFIC',
_t:Date.parse(new Date())/1000
}
}
uni.request({
url:url,
header: {
'Authorization': this.atoken //自定义请求头信息
},
data:data,
method:'GET',
success:(res) =>{
uni.hideLoading()
var datas=res.data.data;
this.chartData=datas.body;
this.chartDatas=datas.body.rankingList;
this.setTabelData()
}
})
}
},
}
</script>
<style>
.selectBox{
width: 646.73upx;
height: 61.59upx;
font-size: 18.11upx;
line-height: 61.59upx;
display: flex;
flex-direction: row;
margin: 0 auto;
margin-bottom: 18.11upx;
}
.sItem{
flex: 1;
background:#FFFFFF;
text-align: center;
cursor: pointer;
border-right:1px solid #DBDBDB ;
}
.sItem:last-of-type{
border-right:none
}
.checkedItem{
background: #0069FF;
color: #FFFFFF;
border: #0069FF;
}
</style>
......@@ -165,10 +165,18 @@
},
backFun(){
uni.reLaunch({
url:"index",
url:"../index",
})
},
conditionFun(){
uni.setStorage({
key:'backUrl',
data:1
})
uni.setStorage({
key:'allShow',
data:'true'
})
uni.navigateTo({
url:'../condition'
})
......@@ -198,7 +206,7 @@
}
})
this.chartIds=this.chartIds.substring(0,this.chartIds.length-1);
this.getChartData('day');
this.getChartData();
}
})
},
......@@ -212,7 +220,6 @@
this.columns.push( {field: item, title:item, width: 20, titleAlign: 'center',columnAlign:'center',isResize:true})
}
})
console.log(JSON.stringify(this.columns))
this.chartDatas.series.forEach((item,index)=>{
var obj={}
item.data.forEach((item,index)=>{
......@@ -221,7 +228,8 @@
this.tableData.push(obj)
})
},
getChartData(type){
getChartData(){
this.orgIds=''
var data={}
var url=window.url+'/report/basics/day/mall';
if(this.reportType=='mall'){
......
<template>
<div>
<headerComp :leftImgSrc="leftImg" :title="titleStr" :rightImgSrc="rightImg" @leftClick="backFun" @rightClick="conditionFun"></headerComp>
<div style="height: 18.11upx;"></div>
<!-- <div class="selectBox">
<div class="sItem" :class="{ checkedItem: isDay}" @click="checkFun('day')">天汇总</div>
<div class="sItem" :class="{ checkedItem: isHour}" @click="checkFun('hour')">小时级</div>
<div class="sItem" :class="{ checkedItem: isMin}" @click="checkFun('min')">分钟级</div>
</div> -->
<v-table v-if="columns.length>0"
is-horizontal-resize
style="width:100%"
:columns="columns"
:table-data="tableData"
row-hover-color="#eee"
row-click-color="#edf7ff"
:height='500'
></v-table>
</div>
</template>
<script>
import headerComp from '../../../components/header'
import backArrow from '../../../static/header/backArrow.png'
import other from '../../../static/header/other.png'
import tables from '../../../components/table'
export default{
data(){
return{
titleStr:'基础统计',
leftImg:backArrow,
rightImg:other,
atoken:'',
keyArr:[],
chartIds:'',
reportType:'mall',
accountId:[],
orgIds:'',
date:'',
isDay:true,
isHour:false,
isMin:false,
chartDatas:{},
chartData:{},
tableData:[],
columns:[],
gateId:[],
floorId:[],
storeId:[]
}
},
onLoad: function (option) {
if(option.types){
this.reportType=option.types;
}
uni.getStorage({
key:'atoken',
success:(res)=>{
this.atoken=res.data;
}
})
uni.getStorage({
key:'accountList',
success:(res)=>{
if(res.data){
var list=JSON.parse(res.data);
list.forEach((item,index)=>{
if(index==0){
this.accountId.push(item.id)
}
})
}
}
})
uni.getStorage({
key:'selectAccountIdArr',
success:(res)=> {
this.accountId=JSON.parse(res.data);
},
complete: (res) => {
}
})
uni.getStorage({
key:'selectGateIdArr',
success:(res)=> {
this.gateId=JSON.parse(res.data);
},
complete: (res) => {
}
})
uni.getStorage({
key:'selectFloorIdArr',
success:(res)=> {
this.floorId=JSON.parse(res.data);
},
complete: (res) => {
}
})
uni.getStorage({
key:'selectStoreIdArr',
success:(res)=> {
this.storeId=JSON.parse(res.data);
},
complete: (res) => {
}
})
const date = new Date();
var year = date.getFullYear();
var monthIndex = date.getMonth();
var month = monthIndex+1 > 9 ? monthIndex+1 : '0' + (monthIndex+1);
const d = date.getDate();
var day= d > 9 ? d : '0' + d;
this.date=year+'-'+month+'-'+day;
uni.getStorage({
key:'selectDate',
success:(res)=> {
this.date=res.data
},
complete: (res) => {
}
})
this.getReportKey();
},
computed: {
i18n() {
return this.$t("index")
}
},
components:{
headerComp,tables
},
methods: {
checkFun(val){
switch (val)
{
case 'day':{
this.isDay=true;
this.isHour=false;
this.isMin=false;
this.chartDatas=this.chartData.kpiData;
this.setTabelData()
// this.$emit('handleFun','7');
}
break;
case 'hour':{
this.isDay=false;
this.isHour=true;
this.isMin=false;
this.chartDatas=this.chartData.trafficHour;
this.setTabelData()
// this.$emit('handleFun','15');
}
break;
case 'min':{
this.isDay=false;
this.isHour=false;
this.isMin=true;
this.chartDatas=this.chartData.traffic10Min;
this.setTabelData()
// this.$emit('handleFun','30');
}
break;
}
},
backFun(){
uni.reLaunch({
url:"../index",
})
},
conditionFun(){
uni.setStorage({
key:'backUrl',
data:1
})
uni.setStorage({
key:'allShow',
data:'true'
})
uni.navigateTo({
url:'../condition'
})
},
getReportKey(){
var report='BasicReport';
this.keyArr=['kpiData','detailData'];
uni.showLoading({
title: '加载中'
});
uni.request({
url:window.url+'/reportCharts',
data:{
report:report,
_t:Date.parse(new Date())/1000
},
header: {
'Authorization': this.atoken //自定义请求头信息
},
method:'GET',
success:(res) =>{
this.chartIds='';
res.data.data.forEach(item=>{
if(this.keyArr.indexOf(item.key)!='-1'){
this.chartIds+=item.id+','
}
})
this.chartIds=this.chartIds.substring(0,this.chartIds.length-1);
this.getChartData();
}
})
},
setTabelData(){
this.columns=[];
this.tableData=[];
this.chartDatas.xaxis.data.forEach((item,index)=>{
if(index==0){
this.columns.push( {field: item, title:item, width: 20, titleAlign: 'center',columnAlign:'center',isResize:true,isFrozen: true})
}else{
this.columns.push( {field: item, title:item, width: 20, titleAlign: 'center',columnAlign:'center',isResize:true})
}
})
console.log(JSON.stringify(this.columns))
this.chartDatas.series.forEach((item,index)=>{
var obj={}
item.data.forEach((item,index)=>{
obj[this.chartDatas.xaxis.data[index]]=item;
})
this.tableData.push(obj)
})
},
getChartData(){
this.orgIds=''
var data={}
var url=window.url+'/report/basics/mall';
if(this.reportType=='mall'){
this.accountId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
var startDate=this.date.split(',')[0];
var endDate=this.date.split(',')[1];
url=window.url+'/report/basics/mall';
data={
orgIds:this.orgIds,
startDate:startDate,
endDate: endDate,
chartIds:this.chartIds,
_t:Date.parse(new Date())/1000
}
}else if(this.reportType=='gate'){
this.gateId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
var startDate=this.date.split(',')[0];
var endDate=this.date.split(',')[1];
url=window.url+'/report/basics/gate';
data={
orgIds:this.orgIds,
startDate:startDate,
endDate: endDate,
chartIds:this.chartIds,
_t:Date.parse(new Date())/1000
}
}else if(this.reportType=='floor'){
this.floorId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
url=window.url+'/report/basics/floor';
var startDate=this.date.split(',')[0];
var endDate=this.date.split(',')[1];
data={
orgIds:this.orgIds,
startDate:startDate,
endDate: endDate,
chartIds:this.chartIds,
_t:Date.parse(new Date())/1000
}
}else if(this.reportType=='area'){
this.storeId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
url=window.url+'/report/basics/zone';
var startDate=this.date.split(',')[0];
var endDate=this.date.split(',')[1];
data={
orgIds:this.orgIds,
startDate:startDate,
endDate: endDate,
chartIds:this.chartIds,
_t:Date.parse(new Date())/1000
}
}
uni.request({
url:url,
header: {
'Authorization': this.atoken //自定义请求头信息
},
data:data,
method:'GET',
success:(res) =>{
uni.hideLoading()
var datas=res.data.data;
this.chartData=datas.body;
this.chartDatas=datas.body.detailData;
this.setTabelData()
}
})
}
},
}
</script>
<style>
.selectBox{
width: 646.73upx;
height: 61.59upx;
font-size: 18.11upx;
line-height: 61.59upx;
display: flex;
flex-direction: row;
margin: 0 auto;
margin-bottom: 18.11upx;
}
.sItem{
flex: 1;
background:#FFFFFF;
text-align: center;
cursor: pointer;
border-right:1px solid #DBDBDB ;
}
.sItem:last-of-type{
border-right:none
}
.checkedItem{
background: #0069FF;
color: #FFFFFF;
border: #0069FF;
}
</style>
......@@ -165,10 +165,18 @@
},
backFun(){
uni.reLaunch({
url:"index",
url:"../index",
})
},
conditionFun(){
uni.setStorage({
key:'backUrl',
data:1
})
uni.setStorage({
key:'allShow',
data:'true'
})
uni.navigateTo({
url:'../condition'
})
......@@ -222,6 +230,7 @@
})
},
getChartData(){
this.orgIds=''
var data={}
var url=window.url+'/report/basics/mall';
if(this.reportType=='mall'){
......
<template>
<div>
<headerComp :leftImgSrc="leftImg" :title="titleStr" :rightImgSrc="rightImg" @leftClick="backFun" @rightClick="conditionFun"></headerComp>
<div style="height: 18.11upx;"></div>
<!-- <div class="selectBox">
<div class="sItem" :class="{ checkedItem: isDay}" @click="checkFun('day')">天汇总</div>
<div class="sItem" :class="{ checkedItem: isHour}" @click="checkFun('hour')">小时级</div>
<div class="sItem" :class="{ checkedItem: isMin}" @click="checkFun('min')">分钟级</div>
</div> -->
<v-table v-if="columns.length>0"
is-horizontal-resize
style="width:100%"
:columns="columns"
:table-data="tableData"
row-hover-color="#eee"
row-click-color="#edf7ff"
:height='500'
></v-table>
</div>
</template>
<script>
import headerComp from '../../../components/header'
import backArrow from '../../../static/header/backArrow.png'
import other from '../../../static/header/other.png'
import tables from '../../../components/table'
export default{
data(){
return{
titleStr:'基础统计',
leftImg:backArrow,
rightImg:other,
atoken:'',
keyArr:[],
chartIds:'',
reportType:'mall',
accountId:[],
orgIds:'',
date:'',
isDay:true,
isHour:false,
isMin:false,
chartDatas:{},
chartData:{},
tableData:[],
columns:[],
gateId:[],
floorId:[],
storeId:[]
}
},
onLoad: function (option) {
if(option.types){
this.reportType=option.types;
}
uni.getStorage({
key:'atoken',
success:(res)=>{
this.atoken=res.data;
}
})
uni.getStorage({
key:'accountList',
success:(res)=>{
if(res.data){
var list=JSON.parse(res.data);
list.forEach((item,index)=>{
if(index==0){
this.accountId.push(item.id)
}
})
}
}
})
uni.getStorage({
key:'selectAccountIdArr',
success:(res)=> {
this.accountId=JSON.parse(res.data);
},
complete: (res) => {
}
})
uni.getStorage({
key:'selectGateIdArr',
success:(res)=> {
this.gateId=JSON.parse(res.data);
},
complete: (res) => {
}
})
uni.getStorage({
key:'selectFloorIdArr',
success:(res)=> {
this.floorId=JSON.parse(res.data);
},
complete: (res) => {
}
})
uni.getStorage({
key:'selectStoreIdArr',
success:(res)=> {
this.storeId=JSON.parse(res.data);
},
complete: (res) => {
}
})
const date = new Date();
var year = date.getFullYear();
var monthIndex = date.getMonth();
var month = monthIndex+1 > 9 ? monthIndex+1 : '0' + (monthIndex+1);
const d = date.getDate();
var day= d > 9 ? d : '0' + d;
this.date=year+'-'+month+'-'+day;
uni.getStorage({
key:'selectDate',
success:(res)=> {
this.date=res.data
},
complete: (res) => {
}
})
this.getReportKey();
},
computed: {
i18n() {
return this.$t("index")
}
},
components:{
headerComp,tables
},
methods: {
checkFun(val){
switch (val)
{
case 'day':{
this.isDay=true;
this.isHour=false;
this.isMin=false;
this.chartDatas=this.chartData.kpiData;
this.setTabelData()
// this.$emit('handleFun','7');
}
break;
case 'hour':{
this.isDay=false;
this.isHour=true;
this.isMin=false;
this.chartDatas=this.chartData.trafficHour;
this.setTabelData()
// this.$emit('handleFun','15');
}
break;
case 'min':{
this.isDay=false;
this.isHour=false;
this.isMin=true;
this.chartDatas=this.chartData.traffic10Min;
this.setTabelData()
// this.$emit('handleFun','30');
}
break;
}
},
backFun(){
uni.reLaunch({
url:"../index",
})
},
conditionFun(){
uni.setStorage({
key:'backUrl',
data:1
})
uni.setStorage({
key:'allShow',
data:'true'
})
uni.navigateTo({
url:'../condition'
})
},
getReportKey(){
var report='BasicReport';
this.keyArr=['kpiData','detailData'];
uni.showLoading({
title: '加载中'
});
uni.request({
url:window.url+'/reportCharts',
data:{
report:report,
_t:Date.parse(new Date())/1000
},
header: {
'Authorization': this.atoken //自定义请求头信息
},
method:'GET',
success:(res) =>{
this.chartIds='';
res.data.data.forEach(item=>{
if(this.keyArr.indexOf(item.key)!='-1'){
this.chartIds+=item.id+','
}
})
this.chartIds=this.chartIds.substring(0,this.chartIds.length-1);
this.getChartData();
}
})
},
setTabelData(){
this.columns=[];
this.tableData=[];
this.chartDatas.xaxis.data.forEach((item,index)=>{
if(index==0){
this.columns.push( {field: item, title:item, width: 20, titleAlign: 'center',columnAlign:'center',isResize:true,isFrozen: true})
}else{
this.columns.push( {field: item, title:item, width: 20, titleAlign: 'center',columnAlign:'center',isResize:true})
}
})
console.log(JSON.stringify(this.columns))
this.chartDatas.series.forEach((item,index)=>{
var obj={}
item.data.forEach((item,index)=>{
obj[this.chartDatas.xaxis.data[index]]=item;
})
this.tableData.push(obj)
})
},
getChartData(){
this.orgIds=''
var data={}
var url=window.url+'/report/basics/mall';
if(this.reportType=='mall'){
this.accountId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
var startDate=this.date.split(',')[0];
var endDate=this.date.split(',')[1];
url=window.url+'/report/basics/mall';
data={
orgIds:this.orgIds,
startDate:startDate,
endDate: endDate,
chartIds:this.chartIds,
_t:Date.parse(new Date())/1000
}
}else if(this.reportType=='gate'){
this.gateId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
var startDate=this.date.split(',')[0];
var endDate=this.date.split(',')[1];
url=window.url+'/report/basics/gate';
data={
orgIds:this.orgIds,
startDate:startDate,
endDate: endDate,
chartIds:this.chartIds,
_t:Date.parse(new Date())/1000
}
}else if(this.reportType=='floor'){
this.floorId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
url=window.url+'/report/basics/floor';
var startDate=this.date.split(',')[0];
var endDate=this.date.split(',')[1];
data={
orgIds:this.orgIds,
startDate:startDate,
endDate: endDate,
chartIds:this.chartIds,
_t:Date.parse(new Date())/1000
}
}else if(this.reportType=='area'){
this.storeId.forEach(item=>{
this.orgIds+=item+','
})
this.orgIds=this.orgIds.substring(0,this.orgIds.length-1)
url=window.url+'/report/basics/zone';
var startDate=this.date.split(',')[0];
var endDate=this.date.split(',')[1];
data={
orgIds:this.orgIds,
startDate:startDate,
endDate: endDate,
chartIds:this.chartIds,
_t:Date.parse(new Date())/1000
}
}
uni.request({
url:url,
header: {
'Authorization': this.atoken //自定义请求头信息
},
data:data,
method:'GET',
success:(res) =>{
uni.hideLoading()
var datas=res.data.data;
this.chartData=datas.body;
this.chartDatas=datas.body.detailData;
this.setTabelData()
}
})
}
},
}
</script>
<style>
.selectBox{
width: 646.73upx;
height: 61.59upx;
font-size: 18.11upx;
line-height: 61.59upx;
display: flex;
flex-direction: row;
margin: 0 auto;
margin-bottom: 18.11upx;
}
.sItem{
flex: 1;
background:#FFFFFF;
text-align: center;
cursor: pointer;
border-right:1px solid #DBDBDB ;
}
.sItem:last-of-type{
border-right:none
}
.checkedItem{
background: #0069FF;
color: #FFFFFF;
border: #0069FF;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!