From b14e9d14a3bba25bb33dd1aaf677af85f1320b06 Mon Sep 17 00:00:00 2001 From: xiaowen <372193233@qq.com> Date: Fri, 22 Jul 2022 11:22:54 +0800 Subject: [PATCH] cxw-010203 --- components/indexCom/rankingChild/index.js | 119 ++++++++++++---------- 1 file changed, 63 insertions(+), 56 deletions(-) diff --git a/components/indexCom/rankingChild/index.js b/components/indexCom/rankingChild/index.js index c372eaf..60aae32 100644 --- a/components/indexCom/rankingChild/index.js +++ b/components/indexCom/rankingChild/index.js @@ -1,91 +1,98 @@ -import histogram from "../../option/columnarOption" +import histogram from "../../option/columnarOption" const app = getApp() Component({ data: { - imageUrl: getApp().globalData.imageUrl, + imageUrl: getApp().globalData.imageUrl, showChart: true, - + + }, + lifetimes: { + attached() { + this.getData() + } }, - lifetimes:{ - attached(){ - this.getData() - } - }, methods: { - getData(){ + getData() { wx.showToast({ title: '加载中', icon: 'loading', duration: 30000 - }) - app.globalData.request({action: 'getCheZhuLatestTimeHome',sType:'Marketing'}).then(res => { + }) + app.globalData.request({ + action: 'getCheZhuLatestTimeHome', + sType: 'Marketing' + }).then(res => { wx.setStorageSync('newTime', res) this.setData({ - newTime:wx.getStorageSync('newTime') + 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) - }); + app.globalData.request({ + action: 'getCheZhuCarBrandRankingHome', + sType: 'Marketing', + sTimeType: wx.getStorageSync('sTimeType') || 34, + 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'), + brandOption: histogram(carName, carCount, '#0084FF'), }) }) - app.globalData.request({action: 'getCheZhuCarSeriesRankingHome',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.seriesname), - carCount.push(e.salescount) - }); + app.globalData.request({ + action: 'getCheZhuCarSeriesRankingHome', + sType: 'Marketing', + sTimeType: wx.getStorageSync('sTimeType') || 34, + sStartTime: wx.getStorageSync('newTime') || "", + sEndTime: wx.getStorageSync('newTime') || "" + }).then(res => { + console.log(res) + const carName = [] + const carCount = [] + res.forEach(e => { + carName.push(e.seriesname), + carCount.push(e.salescount) + }); this.setData({ - modelOption:histogram(carName,carCount,'#20CC62'), + modelOption: histogram(carName, carCount, '#20CC62'), }) }) - setTimeout(() =>{ + setTimeout(() => { wx.hideToast(); - },1000) - }, - - priceSel(e){ + }, 1000) + }, + + priceSel(e) { this.setData({ intervalSel: e.currentTarget.dataset.index }) }, - Rankdetail(){ - wx.navigateTo({ - url: "/pages/index/Salesranking/Salesranking" - }) + Rankdetail() { + wx.navigateTo({ + url: "/pages/index/Salesranking/Salesranking" + }) }, //品牌排行 - ranking(){ - wx.navigateTo({ - url: "/pages/index/Salesranking/Salesranking" - }) + ranking() { + wx.navigateTo({ + url: "/pages/index/Salesranking/Salesranking" + }) }, //车型排行 - vehicletype(){ - wx.navigateTo({ - url: "/pages/index/Salesranking/Salesranking" - }) + vehicletype() { + wx.navigateTo({ + url: "/pages/index/Salesranking/Salesranking" + }) } - + } }) \ No newline at end of file