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.
132 lines
4.3 KiB
132 lines
4.3 KiB
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: 50000
|
|
})
|
|
Promise.all([this.getTimeData(), this.getBrandData(), this.getModelData()]).then(() => {
|
|
setTimeout(() => {
|
|
wx.hideToast();
|
|
}, 500)
|
|
})
|
|
},
|
|
// 获取时间
|
|
getTimeData() {
|
|
return new Promise((resolve, reject) => {
|
|
app.globalData.request({
|
|
action: 'getCheZhuLatestTimeHome',
|
|
sType: 'Marketing'
|
|
}).then(res => {
|
|
wx.setStorageSync('newTime', res)
|
|
resolve(true)
|
|
}).catch(() => {
|
|
reject(false)
|
|
})
|
|
})
|
|
},
|
|
// 获取品牌的数据
|
|
getBrandData() {
|
|
return new Promise((resolve, reject) => {
|
|
app.globalData.request({
|
|
action: 'getCheZhuCarBrandRankingHome',
|
|
sType: 'Marketing',
|
|
sTimeType: 4,
|
|
sStartTime: wx.getStorageSync('newTime') || '',
|
|
sEndTime: wx.getStorageSync('newTime') || ''
|
|
}).then(res => {
|
|
const carName = []
|
|
const carCount = []
|
|
res.forEach(e => {
|
|
carName.push(e.brand),
|
|
carCount.push(e.salescount)
|
|
});
|
|
this.setData({
|
|
brandOption: histogram(carName, carCount,'#0084FF'),
|
|
})
|
|
resolve(true)
|
|
}).catch(() => {
|
|
reject(false)
|
|
})
|
|
})
|
|
},
|
|
getModelData() {
|
|
return new Promise((resolve, reject) => {
|
|
app.globalData.request({
|
|
action: 'getCheZhuCarSeriesRankingHome',
|
|
sType: 'Marketing',
|
|
sTimeType: 4,
|
|
sStartTime: wx.getStorageSync('newTime') || "",
|
|
sEndTime: wx.getStorageSync('newTime') || ""
|
|
}).then(res => {
|
|
const carName = []
|
|
const carCount = []
|
|
res.forEach(e => {
|
|
carName.push(e.seriesname),
|
|
carCount.push(e.salescount)
|
|
});
|
|
this.setData({
|
|
modelOption: histogram(carName, carCount, '#20CC62'),
|
|
})
|
|
resolve(true)
|
|
}).catch(() => {
|
|
reject(false)
|
|
})
|
|
})
|
|
},
|
|
priceSel(e) {
|
|
this.setData({
|
|
intervalSel: e.currentTarget.dataset.index
|
|
})
|
|
},
|
|
Rankdetail() {
|
|
this.getTimeData().then(() => {
|
|
wx.navigateTo({
|
|
url: "/pages/index/Salesranking/Salesranking"
|
|
})
|
|
})
|
|
},
|
|
//品牌排行
|
|
ranking() {
|
|
// if (!wx.getStorageSync('token')) {
|
|
// wx.navigateTo({
|
|
// url: '/pages/mine/pages/bindUser/index'
|
|
// })
|
|
// } else {
|
|
this.getTimeData().then(() => {
|
|
wx.navigateTo({
|
|
url: "/pages/index/Salesranking/Brandranking/Brandranking"
|
|
})
|
|
})
|
|
// }
|
|
},
|
|
//车型排行
|
|
vehicletype() {
|
|
// if (!wx.getStorageSync('token')) {
|
|
// wx.navigateTo({
|
|
// url: '/pages/mine/pages/bindUser/index'
|
|
// })
|
|
// } else {
|
|
this.getTimeData().then(() => {
|
|
wx.navigateTo({
|
|
url: "/pages/index/Salesranking/Salesranking"
|
|
})
|
|
})
|
|
|
|
// }
|
|
}
|
|
|
|
}
|
|
}) |