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.

81 lines
2.8 KiB

const app = getApp();
import sHistogram from "../../option/sColumnarOption"
const color2=['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF','#7257FF']
Component({
data: {
showChart: true,
},
onShow() {
this.getTabBar().init();
},
lifetimes: {
attached() {
let sTimeType = wx.getStorageSync("sTimeType") || 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
})
app.globalData.request({action: 'getHomeBrandSourceType0528', sType: 'Home', sTimeType: sTimeType, sStartTime: sStartTime,sEndTime: sEndTime,sQueryType: 1}).then(res => {
const arr = []
const arr1=[[],[],[],[],[],[],[],[]]
const arr2=[]
res.forEach(ele => {
arr.push(ele.key)
ele.value.forEach(e=>{
arr2.push(e.key)
})
for(let i=0;i<ele.value.length;i++){
arr1[i].push(ele.value[i].value)
}
})
this.setData({
brandOption:sHistogram(arr,arr1,arr2,color2),
})
})
app.globalData.request({action: 'getHomeBrandSourceType0528', sType: 'Home', sTimeType: sTimeType, sStartTime: sStartTime,sEndTime: sEndTime, sQueryType: 2}).then(res => {
const arr = []
const arr1=[[],[],[],[],[],[],[],[]]
const arr2=[]
res.forEach(ele => {
arr.push(ele.key)
ele.value.forEach(e=>{
arr2.push(e.key)
})
for(let i=0;i<ele.value.length;i++){
arr1[i].push(ele.value[i].value)
}
})
this.setData({
modelOption:sHistogram(arr,arr1,arr2,color2),
})
setTimeout(() =>{
wx.hideToast();
},500)
})
},
priceSel(e){
this.setData({
intervalSel: e.currentTarget.dataset.index
})
},
}
})