You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.9 KiB

import { getUserBrand} from "@/api/comm";
import {getUserSeriesName} from "@/api/comm";
import {getSpec,getPrice,getEnergy} from "@/api/comm";
export default {
initData() {
this.form.token = this.getToken;
let obj = Object.assign({},this.form)
getUserBrand(obj).then(res => {
let data = res.data;
let brandList = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]];
let letters = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
for(let i = 0; i<data.length;i++) {
let index = letters.indexOf(data[i].firstword)
if(index >= 0) {
let obj = {
brandname: data[i].brandname,
brandid: data[i].brandid,
firstword: data[i].firstword,
}
brandList[index].push(obj)
}
}
this.brandList = brandList;
this.letters = letters;
})
getSpec(obj).then(res => {
let data = res.data;
this.specList = data
})
getPrice(obj).then(res => {
let data = res.data;
this.priceList = data
})
getEnergy(obj).then(res => {
let data = res.data;
this.energyList = data
})
},
//选择品牌
onBrand(val) {
this.isLoding = true;
this.chosenBrand = val;
let o = {token: this.getToken, sBrandName: this.chosenBrand};
getUserSeriesName(o).then(res => {
let data = res.data;
this.seriesList = data;
this.chosenSeries = undefined;
this.isLoding = false
})
},
//选择车型
onSeries(val) {
this.chosenSeries = val
},
//查询销量
onSearch() {
if(this.chosenBrand != undefined && this.chosenSeries == undefined) {
this.$router.push(
{
path: '/saleRank/brandInfo',
query: {
sBrand: this.chosenBrand,
sStartTime: this.form.sStartTime,
sEndTime: this.form.sEndTime
}
}
);
} else if (this.chosenBrand != undefined && this.chosenSeries != undefined) {
this.$router.push(
{
path: '/saleRank/seriesInfo',
query: {
sBrand: this.chosenBrand,
sSeriesName: this.chosenSeries,
}
}
);
} else {
this.$message.warning('请选择品牌');
return;
}
},
//左侧菜单栏
handlerMenu(val) {
this.window = val.key
}
}