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.

131 lines
3.3 KiB

import histogram from "../../option/columnarOption"
const app = getApp()
Component({
data: {
imageUrl: getApp().globalData.imageUrl,
showChart: true,
currentTime: '',
},
lifetimes: {
attached() {
app.globalData.request({
action: 'getCheZhuLatestTimeHome',
sType: 'Marketing'
}).then(res => {
wx.setStorageSync('newTime', res);
this.setData({currentTime: res});
this.getBrandData();
this.getModelData();
})
}
},
methods: {
getData1() {
wx.showToast({
title: '加载中',
icon: 'loading',
duration: 5000
})
Promise.all([this.getTimeData()]).then(() => {
setTimeout(() => {
wx.hideToast();
}, 500)
})
},
getData() {
wx.showToast({
title: '加载中',
icon: 'loading',
duration: 500000
})
Promise.all([this.getBrandData(), this.getModelData()]).then(() => {
setTimeout(() => {
wx.hideToast();
}, 500)
})
},
// 获取时间
getTimeData() {
app.globalData.request({
action: 'getCheZhuLatestTimeHome',
sType: 'Marketing'
}).then(res => {
wx.setStorageSync('newTime', res)
})
},
// 获取品牌的数据
getBrandData() {
app.globalData.request({
action: 'getCheZhuCarBrandRankingHome',
sType: 'Marketing',
sTimeType: 4,
sStartTime: this.data.currentTime,
sEndTime: this.data.currentTime
}).then(res => {
const carName = []
const carCount = []
res.forEach(e => {
carName.push(e.brand),
carCount.push(e.salescount)
});
this.setData({
brandOption: histogram(carName, carCount, '#0084FF'),
})
})
},
getModelData() {
app.globalData.request({
action: 'getCheZhuCarSeriesRankingHome',
sType: 'Marketing',
sTimeType: 4,
sStartTime: this.data.currentTime,
sEndTime: this.data.currentTime
}).then(res => {
const carName = []
const carCount = []
res.forEach(e => {
carName.push(e.seriesname),
carCount.push(e.salescount)
});
this.setData({
modelOption: histogram(carName, carCount, '#20CC62'),
})
})
},
priceSel(e) {
this.setData({
intervalSel: e.currentTarget.dataset.index
})
},
Rankdetail() {
wx.navigateTo({
url: "/pages/index/Salesranking/Salesranking"
})
},
//品牌排行
ranking() {
// if (!wx.getStorageSync('token')) {
// wx.navigateTo({
// url: '/pages/mine/pages/bindUser/index'
// })
// } else {
wx.navigateTo({
url: "/pages/index/Salesranking/Brandranking/Brandranking"
})
// }
},
//车型排行
vehicletype() {
// if (!wx.getStorageSync('token')) {
// wx.navigateTo({
// url: '/pages/mine/pages/bindUser/index'
// })
// } else {
wx.navigateTo({
url: "/pages/index/Salesranking/Salesranking"
})
// }
}
}
})