dev
xiaowen 3 years ago
parent af44720c60
commit b14e9d14a3

@ -1,91 +1,98 @@
import histogram from "../../option/columnarOption" import histogram from "../../option/columnarOption"
const app = getApp() const app = getApp()
Component({ Component({
data: { data: {
imageUrl: getApp().globalData.imageUrl, imageUrl: getApp().globalData.imageUrl,
showChart: true, showChart: true,
},
lifetimes: {
attached() {
this.getData()
}
}, },
lifetimes:{
attached(){
this.getData()
}
},
methods: { methods: {
getData(){ getData() {
wx.showToast({ wx.showToast({
title: '加载中', title: '加载中',
icon: 'loading', icon: 'loading',
duration: 30000 duration: 30000
}) })
app.globalData.request({action: 'getCheZhuLatestTimeHome',sType:'Marketing'}).then(res => { app.globalData.request({
action: 'getCheZhuLatestTimeHome',
sType: 'Marketing'
}).then(res => {
wx.setStorageSync('newTime', res) wx.setStorageSync('newTime', res)
this.setData({ this.setData({
newTime:wx.getStorageSync('newTime') newTime: wx.getStorageSync('newTime')
}) })
}) })
app.globalData.request({action: 'getCheZhuCarBrandRankingHome',sType:'Marketing', app.globalData.request({
sTimeType:"4", action: 'getCheZhuCarBrandRankingHome',
sStartTime:wx.getStorageSync('newTime'), sType: 'Marketing',
sEndTime:wx.getStorageSync('newTime')} sTimeType: wx.getStorageSync('sTimeType') || 34,
).then(res => { sStartTime: wx.getStorageSync('newTime') || '',
console.log(res) sEndTime: wx.getStorageSync('newTime') || ''
const carName=[] }).then(res => {
const carCount=[] console.log(res)
res.forEach(e => { const carName = []
carName.push(e.brand), const carCount = []
carCount.push(e.salescount) res.forEach(e => {
}); carName.push(e.brand),
carCount.push(e.salescount)
});
this.setData({ this.setData({
brandOption:histogram(carName,carCount,'#0084FF'), brandOption: histogram(carName, carCount, '#0084FF'),
}) })
}) })
app.globalData.request({action: 'getCheZhuCarSeriesRankingHome',sType:'Marketing', app.globalData.request({
sTimeType:"4", action: 'getCheZhuCarSeriesRankingHome',
sStartTime:wx.getStorageSync('newTime'), sType: 'Marketing',
sEndTime:wx.getStorageSync('newTime')} sTimeType: wx.getStorageSync('sTimeType') || 34,
).then(res => { sStartTime: wx.getStorageSync('newTime') || "",
console.log(res) sEndTime: wx.getStorageSync('newTime') || ""
const carName=[] }).then(res => {
const carCount=[] console.log(res)
res.forEach(e => { const carName = []
carName.push(e.seriesname), const carCount = []
carCount.push(e.salescount) res.forEach(e => {
}); carName.push(e.seriesname),
carCount.push(e.salescount)
});
this.setData({ this.setData({
modelOption:histogram(carName,carCount,'#20CC62'), modelOption: histogram(carName, carCount, '#20CC62'),
}) })
}) })
setTimeout(() =>{ setTimeout(() => {
wx.hideToast(); wx.hideToast();
},1000) }, 1000)
}, },
priceSel(e){ priceSel(e) {
this.setData({ this.setData({
intervalSel: e.currentTarget.dataset.index intervalSel: e.currentTarget.dataset.index
}) })
}, },
Rankdetail(){ Rankdetail() {
wx.navigateTo({ wx.navigateTo({
url: "/pages/index/Salesranking/Salesranking" url: "/pages/index/Salesranking/Salesranking"
}) })
}, },
//品牌排行 //品牌排行
ranking(){ ranking() {
wx.navigateTo({ wx.navigateTo({
url: "/pages/index/Salesranking/Salesranking" url: "/pages/index/Salesranking/Salesranking"
}) })
}, },
//车型排行 //车型排行
vehicletype(){ vehicletype() {
wx.navigateTo({ wx.navigateTo({
url: "/pages/index/Salesranking/Salesranking" url: "/pages/index/Salesranking/Salesranking"
}) })
} }
} }
}) })
Loading…
Cancel
Save