commit
1b3a1fed98
@ -1,76 +1,120 @@
|
||||
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: 300000
|
||||
})
|
||||
app.globalData.request({action: 'getCheZhuLatestTimeHome',sType:'Marketing'}).then(res => {
|
||||
// wx.setStorageSync('newTime', res)
|
||||
const newTime=res
|
||||
this.setData({
|
||||
newTime
|
||||
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)
|
||||
this.setData({
|
||||
newTime: wx.getStorageSync('newTime')
|
||||
})
|
||||
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 => {
|
||||
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: '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),
|
||||
},
|
||||
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({
|
||||
brandOption:histogram(carName,carCount,'#0084FF'),
|
||||
// modelOption:histogram()
|
||||
});
|
||||
this.setData({
|
||||
modelOption: histogram(carName, carCount, '#20CC62'),
|
||||
})
|
||||
resolve(true)
|
||||
}).catch(() => {
|
||||
reject(false)
|
||||
})
|
||||
})
|
||||
setTimeout(() =>{
|
||||
wx.hideToast();
|
||||
},500)
|
||||
},
|
||||
|
||||
priceSel(e){
|
||||
},
|
||||
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?a="+this.newTime
|
||||
})
|
||||
ranking() {
|
||||
wx.navigateTo({
|
||||
url: "/pages/index/Salesranking/Salesranking"
|
||||
})
|
||||
},
|
||||
//车型排行
|
||||
vehicletype(){
|
||||
wx.navigateTo({
|
||||
url: "/pages/index/Salesranking/Salesranking"
|
||||
})
|
||||
vehicletype() {
|
||||
wx.navigateTo({
|
||||
url: "/pages/index/Salesranking/Salesranking"
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
@ -1,66 +0,0 @@
|
||||
// index/home/home.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
<!--index/home/home.wxml-->
|
||||
<text>index/home/home.wxml</text>
|
@ -1 +0,0 @@
|
||||
/* index/home/home.wxss */
|
Loading…
Reference in new issue