|
|
|
@ -13,108 +13,92 @@ Page({
|
|
|
|
|
currentDate: new Date().getTime(),
|
|
|
|
|
minDate: new Date().getTime(),
|
|
|
|
|
ranking: [],
|
|
|
|
|
// ranking: [
|
|
|
|
|
// {
|
|
|
|
|
// time:'2022-05',
|
|
|
|
|
// vehicle:9391,
|
|
|
|
|
// share: 10.02,
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// time:'2022-05',
|
|
|
|
|
// vehicle:9391,
|
|
|
|
|
// share: 10.02,
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// time:'2022-05',
|
|
|
|
|
// vehicle:9391,
|
|
|
|
|
// share: 10.02,
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// time:'2022-05',
|
|
|
|
|
// vehicle:9391,
|
|
|
|
|
// share: 10.02,
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// time:'2022-05',
|
|
|
|
|
// vehicle:9391,
|
|
|
|
|
// share: 10.02,
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// time:'2022-05',
|
|
|
|
|
// vehicle:9391,
|
|
|
|
|
// share: 10.02,
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// time:'2022-05',
|
|
|
|
|
// vehicle:9391,
|
|
|
|
|
// share: 10.02,
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// time:'2022-05',
|
|
|
|
|
// vehicle:9391,
|
|
|
|
|
// share: 10.02,
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// time:'2022-05',
|
|
|
|
|
// vehicle:9391,
|
|
|
|
|
// share: 10.02,
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// time:'2022-05',
|
|
|
|
|
// vehicle:9391,
|
|
|
|
|
// share: 10.02,
|
|
|
|
|
// },
|
|
|
|
|
// ],
|
|
|
|
|
},
|
|
|
|
|
// sliderChange(event) {
|
|
|
|
|
// this.setData({
|
|
|
|
|
// sliderValue: event.detail
|
|
|
|
|
// });
|
|
|
|
|
// },
|
|
|
|
|
dropdownSel(e){
|
|
|
|
|
this.setData({
|
|
|
|
|
value1:e.detail
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getData(){
|
|
|
|
|
times(val){
|
|
|
|
|
var month=val.substring(0,4) //获取年份
|
|
|
|
|
var bYear=val.substring(val.length-2,val.length-1)=="0"//是否为带零的月份
|
|
|
|
|
var year1=val.substring(val.length-1,val.length) //获取月份最后一个数
|
|
|
|
|
var year2=val.substring(val.length-2,val.length) //获取整个月份
|
|
|
|
|
var time,months,years
|
|
|
|
|
if(parseInt(year1)==1){
|
|
|
|
|
months=parseInt(month-2)
|
|
|
|
|
years="12"
|
|
|
|
|
}else{
|
|
|
|
|
if(bYear){
|
|
|
|
|
months=parseInt(month-1)
|
|
|
|
|
years="0"+(parseInt(year1)-1)
|
|
|
|
|
}else{
|
|
|
|
|
if(year2==10){
|
|
|
|
|
years="09"
|
|
|
|
|
months=parseInt(month-1)
|
|
|
|
|
}else{
|
|
|
|
|
months=parseInt(month-1)
|
|
|
|
|
years=(parseInt(year1)-1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
time=months+'-'+years
|
|
|
|
|
return time
|
|
|
|
|
},
|
|
|
|
|
getData(carName,sStartTime=this.times(wx.getStorageSync('newTime')),sEndTime=wx.getStorageSync('newTime')){
|
|
|
|
|
app.globalData.request({
|
|
|
|
|
action: 'getCheZhuCarSeriesListHome',
|
|
|
|
|
sType: 'Marketing',
|
|
|
|
|
// sBrand: wx.getStorageSync('sBrand') || '',
|
|
|
|
|
// sSeriesName:wx.getStorageSync("sSeriesName") || '',
|
|
|
|
|
sBrand: carName|| '',
|
|
|
|
|
sStartTime:sStartTime ||"",
|
|
|
|
|
sEndTime:sEndTime||'',
|
|
|
|
|
}).then(res => {
|
|
|
|
|
const arr=[]
|
|
|
|
|
res.forEach(e => {
|
|
|
|
|
let obj={
|
|
|
|
|
time:e.sourcetime,
|
|
|
|
|
vehicle:e.salescount,
|
|
|
|
|
share:e.salespm,
|
|
|
|
|
}
|
|
|
|
|
arr.push(obj)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
ranking:arr
|
|
|
|
|
})})
|
|
|
|
|
|
|
|
|
|
const time=[]
|
|
|
|
|
const obj={}
|
|
|
|
|
var totalSum=0
|
|
|
|
|
var num=0
|
|
|
|
|
res.forEach(i=>{
|
|
|
|
|
totalSum+=parseInt(i.salescount)
|
|
|
|
|
// console.log(i.salescount)
|
|
|
|
|
if(!obj[i.sourcetime]){
|
|
|
|
|
obj[i.sourcetime] = []
|
|
|
|
|
time.push(i.sourcetime)
|
|
|
|
|
num++
|
|
|
|
|
}
|
|
|
|
|
obj[i.sourcetime].push(i)
|
|
|
|
|
})
|
|
|
|
|
for(let j=0;j<num;j++){
|
|
|
|
|
var sum=0
|
|
|
|
|
for(let a=0;a<obj[time[j]].length;a++){
|
|
|
|
|
sum+= parseInt( obj[time[j]][a].salescount)
|
|
|
|
|
}
|
|
|
|
|
arr.push({times:time[j],sales:sum,share:((sum/totalSum)*100).toFixed(2),brand:carName})
|
|
|
|
|
}
|
|
|
|
|
this.setData({
|
|
|
|
|
ranking:arr
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
priceSel(e){
|
|
|
|
|
this.setData({
|
|
|
|
|
priceSelected: e.currentTarget.dataset.index
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
//详情跳转
|
|
|
|
|
detail(){
|
|
|
|
|
detail(e){
|
|
|
|
|
console.log(e)
|
|
|
|
|
const carBrand=e.currentTarget.dataset.carbrand
|
|
|
|
|
const carTime=e.currentTarget.dataset.cartime
|
|
|
|
|
// console.log(carbrand,carTime)
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: '/pages/index/detailedvolume/detailedvolume',
|
|
|
|
|
url: '/pages/index/detailedvolume/detailedvolume?brand='+carBrand+"&time="+carTime,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
showPopup() {
|
|
|
|
|
this.setData({ show: true });
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onClose() {
|
|
|
|
|
this.setData({ show: false });
|
|
|
|
|
},
|
|
|
|
@ -123,55 +107,52 @@ showPopup() {
|
|
|
|
|
currentDate: event.detail,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 点击日期组件确定事件
|
|
|
|
|
// // 点击日期组件确定事件
|
|
|
|
|
bindDateChange: function (e) {
|
|
|
|
|
// console.log(this.data)
|
|
|
|
|
// this.getData('',this.data.date,"")
|
|
|
|
|
this.setData({
|
|
|
|
|
date: e.detail.value
|
|
|
|
|
date:e.detail.value
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
bindDateChange2: function (e) {
|
|
|
|
|
// this.getData("","",this.data.date)
|
|
|
|
|
this.setData({
|
|
|
|
|
date2: e.detail.value
|
|
|
|
|
date2: e.detail.value
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
|
*/
|
|
|
|
|
onLoad: function (options) {
|
|
|
|
|
this.getData()
|
|
|
|
|
// console.log("这是时间",this.res.ranking)
|
|
|
|
|
// console.log("123",this.options.carName)
|
|
|
|
|
this.getData(this.options.carName)
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
|
*/
|
|
|
|
|
onReady: function () {
|
|
|
|
|
//动态设置标题
|
|
|
|
|
wx.setNavigationBarTitle({
|
|
|
|
|
title:this.data.query.title
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
// onReady: function () {
|
|
|
|
|
// //动态设置标题
|
|
|
|
|
// wx.setNavigationBarTitle({
|
|
|
|
|
// title:this.data.query.title
|
|
|
|
|
// })
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
|
*/
|
|
|
|
|
onShow: function () {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
|
*/
|
|
|
|
|
onHide: function () {
|
|
|
|
|
|
|
|
|
|
onShow: function (options) {
|
|
|
|
|
// console.log(this.data)
|
|
|
|
|
// this.getData(this.options.carName)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
|
*/
|
|
|
|
|
onUnload: function () {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
|
*/
|
|
|
|
@ -179,17 +160,4 @@ showPopup() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
|
*/
|
|
|
|
|
onReachBottom: function () {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 用户点击右上角分享
|
|
|
|
|
*/
|
|
|
|
|
onShareAppMessage: function () {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|