|
|
|
@ -17,59 +17,82 @@ Component({
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: '加载中',
|
|
|
|
|
icon: 'loading',
|
|
|
|
|
duration: 30000
|
|
|
|
|
duration: 50000
|
|
|
|
|
})
|
|
|
|
|
app.globalData.request({
|
|
|
|
|
action: 'getCheZhuLatestTimeHome',
|
|
|
|
|
sType: 'Marketing'
|
|
|
|
|
}).then(res => {
|
|
|
|
|
wx.setStorageSync('newTime', res)
|
|
|
|
|
this.setData({
|
|
|
|
|
newTime: wx.getStorageSync('newTime')
|
|
|
|
|
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)
|
|
|
|
|
this.setData({
|
|
|
|
|
newTime: wx.getStorageSync('newTime')
|
|
|
|
|
})
|
|
|
|
|
resolve(true)
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
reject(false)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
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'),
|
|
|
|
|
},
|
|
|
|
|
// 获取品牌的数据
|
|
|
|
|
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 => {
|
|
|
|
|
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'),
|
|
|
|
|
})
|
|
|
|
|
resolve(true)
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
reject(false)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
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'),
|
|
|
|
|
},
|
|
|
|
|
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 => {
|
|
|
|
|
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'),
|
|
|
|
|
})
|
|
|
|
|
resolve(true)
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
reject(false)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
wx.hideToast();
|
|
|
|
|
}, 1000)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
priceSel(e) {
|
|
|
|
|
this.setData({
|
|
|
|
|
intervalSel: e.currentTarget.dataset.index
|
|
|
|
|