Commit 55128f11 authored by zhengke's avatar zhengke

s

parent 5d735343
......@@ -183,6 +183,7 @@ export default {
monthstr: 0,
outbranchid:-1
},
monthList:[],
companyList:[],
}
},
......@@ -206,46 +207,50 @@ export default {
let url='http://47.96.23.199:5001/api/order/get_sale_numandpreferprice_statistics'
this.apiRequest(url,{msg:this.msg},r=>{
if(r.data.resultCode==1){
console.log(r,'errrrrr');
let data = r.data.data;
this.dataList=data;
this.getCompany(data);
let tempArr = [];
for (let i = 0; i < data.length; i++) {
if (tempArr.indexOf(data[i].MonthStr) === -1) {
this.dataList.push({
month: data[i].MonthStr,
List: [data[i]]
});
tempArr.push(data[i].MonthStr);
} else {
for (let j = 0; j < this.dataList.length; j++) {
if (this.dataList[j].month == data[i].MonthStr) {
this.dataList[j].List.push(data[i]);
break;
}
}
}
}
//数量不够push空
this.dataList.forEach(x=>{
if(x.List.length<this.companyList.length){
for(var i=0;i<this.companyList.length-x.List.length;i++){
x.List.push({
GuestNum:'',
MonthStr:'',
OutBranchName:'',
PreferPrice:'',
RB_Branch_Id:'',
YearStr:''
})
}
}
})
// for (let i = 0; i < data.length; i++) {
// if (tempArr.indexOf(data[i].MonthStr) === -1) {
// this.dataList.push({
// month: data[i].MonthStr,
// List: [data[i]]
// });
// tempArr.push(data[i].MonthStr);
// } else {
// for (let j = 0; j < this.dataList.length; j++) {
// if (this.dataList[j].month == data[i].MonthStr) {
// this.dataList[j].List.push(data[i]);
// break;
// }
// }
// }
// }
// console.log(this.dataList,'datalist');
// //数量不够push空
// this.dataList.forEach(x=>{
// if(x.List.length<this.companyList.length){
// for(var i=0;i<this.companyList.length-x.List.length;i++){
// x.List.push({
// GuestNum:'',
// MonthStr:'',
// OutBranchName:'',
// PreferPrice:'',
// RB_Branch_Id:'',
// YearStr:''
// })
// }
// }
// })
}
})
},
//去重获取公司
getCompany(dataList){
this.companyList = [];
this.monthList = [1,2,3,4,5,6,7,8,9,10,11,12];
var obj = {};
for(var i =0; i<dataList.length; i++){
if(!obj[dataList[i].OutBranchName]){
......@@ -253,7 +258,62 @@ export default {
obj[dataList[i].OutBranchName] = true;
}
}
let Arr = [];
this.companyList.forEach((cItem, cIndex) => {
let Arr2=[];
this.monthList.forEach((mItem, mIndex) => {
var bMonth = this.getOtherMonth(cItem.RB_Branch_Id, mItem);
let Obj = {
GuestNum:0,
MonthStr:'',
OutBranchName:'',
PreferPrice:0,
RB_Branch_Id:0,
YearStr:''
}
if (bMonth) {
console.log(bMonth,'bMonth');
Obj.GuestNum=bMonth.GuestNum
Obj.MonthStr=bMonth.MonthStr
Obj.OutBranchName=bMonth.OutBranchName
Obj.PreferPrice=bMonth.PreferPrice
Obj.RB_Branch_Id=bMonth.RB_Branch_Id
Obj.YearStr=bMonth.YearStr
console.log(Arr2,'Arrrrrrrr');
} else {
Obj.GuestNum=0
Obj.MonthStr=bMonth.MonthStr
Obj.OutBranchName=bMonth.OutBranchName
Obj.PreferPrice=0
Obj.RB_Branch_Id=bMonth.RB_Branch_Id
Obj.YearStr=bMonth.YearStr
}
Arr2.push(obj)
});
var obj = {
month: cItem.MonthStr,
List:Arr2,
};
Arr.push(obj);
});
// console.log(Arr,'Arrrrrrrr');
},
getOtherMonth(branchId, monthStr) {
var obj = "";
this.dataList.forEach(dItem => {
if (dItem.RB_Branch_Id == branchId && monthStr == dItem.MonthStr) {
obj = dItem;
}
});
return obj;
},
//点击跳转
goSalesMap(){
this.$router.push({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment