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