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.
104 lines
3.2 KiB
104 lines
3.2 KiB
const app = getApp();
|
|
import histogram from "../../option/columnarOption"
|
|
Component({
|
|
data: {
|
|
showChart: true,
|
|
},
|
|
onShow() {
|
|
this.getTabBar().init();
|
|
},
|
|
lifetimes: {
|
|
attached() {
|
|
let sTimeType = wx.getStorageSync("sTimeType2") || 34;
|
|
let sStartTime = wx.getStorageSync("sStartTime") || '';
|
|
let sEndTime = wx.getStorageSync("sEndTime") || '';
|
|
this.getData(sTimeType, sStartTime, sEndTime);
|
|
}
|
|
},
|
|
methods: {
|
|
changeTime(e) {
|
|
let sTimeType = e.detail.sTimeType;
|
|
let sStartTime = e.detail.sStartTime;
|
|
let sEndTime = e.detail.sEndTime;
|
|
this.getData(sTimeType, sStartTime, sEndTime);
|
|
},
|
|
getData(sTimeType, sStartTime, sEndTime) {
|
|
wx.showToast({
|
|
title: '加载中',
|
|
icon: 'loading',
|
|
duration: 300000
|
|
})
|
|
Promise.all([
|
|
this.getpinpai(sTimeType, sStartTime, sEndTime),
|
|
this.getchexing(sTimeType, sStartTime, sEndTime)
|
|
]).then(() => {
|
|
setTimeout(() => {
|
|
wx.hideToast();
|
|
}, 500)
|
|
})
|
|
|
|
|
|
|
|
},
|
|
getpinpai(sTimeType, sStartTime, sEndTime) {
|
|
return new Promise((resolve, reject) => {
|
|
//品牌
|
|
app.globalData.request({
|
|
action: 'getWeiYiCountHome0528',
|
|
sType: 'Home',
|
|
sQueryType: 1,
|
|
sTimeType: sTimeType,
|
|
sStartTime: sStartTime,
|
|
sEndTime: sEndTime,
|
|
}).then(res => {
|
|
const arr = []
|
|
const arr1 = []
|
|
res.forEach(ele => {
|
|
arr.push(ele.key);
|
|
arr1.push(ele.value)
|
|
})
|
|
this.setData({
|
|
brandOption: histogram(arr, arr1, "#0084FF")
|
|
})
|
|
resolve(true)
|
|
}).catch(() => {
|
|
reject(false)
|
|
})
|
|
})
|
|
|
|
},
|
|
getchexing(sTimeType, sStartTime, sEndTime) {
|
|
return new Promise((resolve, reject) => {
|
|
//车型
|
|
app.globalData.request({
|
|
action: 'getWeiYiCountHome0528',
|
|
sType: 'Home',
|
|
sQueryType: 2,
|
|
sTimeType: sTimeType,
|
|
sStartTime: sStartTime,
|
|
sEndTime: sEndTime,
|
|
}).then(res => {
|
|
const arr = []
|
|
const arr1 = []
|
|
res.forEach(ele => {
|
|
arr.push(ele.key);
|
|
arr1.push(ele.value)
|
|
})
|
|
this.setData({
|
|
modelOption: histogram(arr, arr1, "#20CC62")
|
|
})
|
|
resolve(true)
|
|
}).catch(() => {
|
|
reject(false)
|
|
})
|
|
})
|
|
|
|
},
|
|
priceSel(e) {
|
|
this.setData({
|
|
intervalSel: e.currentTarget.dataset.index
|
|
})
|
|
}
|
|
|
|
}
|
|
}) |