|
|
|
@ -40,7 +40,6 @@ Page({
|
|
|
|
|
//图表
|
|
|
|
|
// positiveOption:brokenLine(dName,dValue,dColor,data),
|
|
|
|
|
imageUrl: getApp().globalData.imageUrl,
|
|
|
|
|
date: '',
|
|
|
|
|
accountIndex: 0,
|
|
|
|
|
ranking: [],
|
|
|
|
|
accountIndex: 0,
|
|
|
|
@ -57,6 +56,56 @@ Page({
|
|
|
|
|
ec: {
|
|
|
|
|
lazyLoad: true // 设置图表懒加载
|
|
|
|
|
},
|
|
|
|
|
dateList: [], //日期列表
|
|
|
|
|
currentDate: '',
|
|
|
|
|
startDate: '',
|
|
|
|
|
endDate: ''
|
|
|
|
|
},
|
|
|
|
|
onLoad() {
|
|
|
|
|
app.globalData.request({
|
|
|
|
|
action: 'getCheZhuLatestTimeHome',
|
|
|
|
|
sType: 'Marketing',
|
|
|
|
|
token: wx.getStorageSync('token') || 't%2BrswgjvzGM=',
|
|
|
|
|
}).then(res => {
|
|
|
|
|
let dateArr = [];
|
|
|
|
|
for(let i=0; i<6;i++) {
|
|
|
|
|
let date = this.getLastMonth(res, i);
|
|
|
|
|
dateArr.push(date);
|
|
|
|
|
};
|
|
|
|
|
this.setData({dateList: dateArr});
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getLastMonth(dt, number = 0) {
|
|
|
|
|
if(number >= 12) {return}
|
|
|
|
|
let year = new Date(dt).getFullYear(); //get年份
|
|
|
|
|
let month = new Date(dt).getMonth() + 1; //get月份
|
|
|
|
|
let m = month - number;
|
|
|
|
|
let y = year;
|
|
|
|
|
if(m < 0) {
|
|
|
|
|
y = y - 1; m = 12 + m;
|
|
|
|
|
};
|
|
|
|
|
if(m < 10) {
|
|
|
|
|
m = '0' + m;
|
|
|
|
|
}
|
|
|
|
|
return y+'-'+m;
|
|
|
|
|
},
|
|
|
|
|
changeDate(option) {
|
|
|
|
|
iPageIndex = 1
|
|
|
|
|
iPageSize = 20
|
|
|
|
|
let value = option.currentTarget.dataset.value;
|
|
|
|
|
this.setData({ranking: [], currentDate: value, startDate: value, endDate: value});
|
|
|
|
|
this.getTrend();
|
|
|
|
|
},
|
|
|
|
|
changePast(option) {
|
|
|
|
|
iPageIndex = 1
|
|
|
|
|
iPageSize = 20
|
|
|
|
|
let value = option.currentTarget.dataset.value;
|
|
|
|
|
if(value == 'past3') {
|
|
|
|
|
this.setData({ranking: [], endDate: this.data.dateList[0], startDate: this.data.dateList[2], currentDate: '近3个月'})
|
|
|
|
|
} else if(value == 'past6') {
|
|
|
|
|
this.setData({ranking: [], endDate: this.data.dateList[0], startDate: this.data.dateList[5], currentDate: '近6个月'})
|
|
|
|
|
}
|
|
|
|
|
this.getTrend();
|
|
|
|
|
},
|
|
|
|
|
// 标签切换点击事件
|
|
|
|
|
onChange(val) {
|
|
|
|
@ -119,8 +168,8 @@ Page({
|
|
|
|
|
let obj = {
|
|
|
|
|
action: 'getCheZhuCarSeriesRankingHome',
|
|
|
|
|
sType: 'Marketing',
|
|
|
|
|
sStartTime: this.data.date,
|
|
|
|
|
sEndTime: this.data.date,
|
|
|
|
|
sStartTime: this.data.startDate,
|
|
|
|
|
sEndTime: this.data.endDate,
|
|
|
|
|
iPageIndex: iPageIndex,
|
|
|
|
|
iPageSize: iPageSize,
|
|
|
|
|
sSpec: this.data.sSpec,
|
|
|
|
@ -308,17 +357,6 @@ Page({
|
|
|
|
|
})
|
|
|
|
|
this.getTrend()
|
|
|
|
|
},
|
|
|
|
|
bindDateChange: function (e) {
|
|
|
|
|
this.data.num1 = true
|
|
|
|
|
iPageIndex = 1
|
|
|
|
|
iPageSize = 20
|
|
|
|
|
this.setData({
|
|
|
|
|
date: e.detail.value,
|
|
|
|
|
ranking: [],
|
|
|
|
|
boxSize1: !this.data.num1 ? 'noall' : 'all1'
|
|
|
|
|
})
|
|
|
|
|
this.getTrend()
|
|
|
|
|
},
|
|
|
|
|
priceSel(e) {
|
|
|
|
|
this.setData({
|
|
|
|
|
intervalSel: e.currentTarget.dataset.index
|
|
|
|
@ -332,8 +370,8 @@ Page({
|
|
|
|
|
action: "getCheZhuCarSeriesListHome",
|
|
|
|
|
sType: "Marketing",
|
|
|
|
|
sSeriesName: models,
|
|
|
|
|
sStartTime: times(this.data.date),
|
|
|
|
|
sEndTime: this.data.date,
|
|
|
|
|
sStartTime: times(this.data.startDate),
|
|
|
|
|
sEndTime: this.data.endDate,
|
|
|
|
|
}).then(res => {
|
|
|
|
|
// console.log(res)
|
|
|
|
|
const dataTime = []
|
|
|
|
@ -364,25 +402,11 @@ Page({
|
|
|
|
|
show: false
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
|
*/
|
|
|
|
|
onLoad(options) {},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
|
*/
|
|
|
|
|
onReady() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
|
*/
|
|
|
|
|
onShow() {
|
|
|
|
|
iPageIndex = 1;
|
|
|
|
|
this.setData({
|
|
|
|
|
date: wx.getStorageSync('newTime')
|
|
|
|
|
startDate: wx.getStorageSync('newTime'),
|
|
|
|
|
endDate: wx.getStorageSync('newTime')
|
|
|
|
|
})
|
|
|
|
|
// this.getTabBar().init();
|
|
|
|
|
this.getData()
|
|
|
|
|