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.

153 lines
2.8 KiB

// pages/index/Salesranking/Allbrands/Allbrands.js
var newtime = new Date();
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
imageUrl: getApp().globalData.imageUrl,
end: newtime.toLocaleDateString(),
show: false,
date: wx.getStorageSync('newTime'),
date2: wx.getStorageSync('newTime'),
currentDate: new Date().getTime(),
minDate: new Date().getTime(),
ranking: [],
},
// 点击日期组件确定事件
bindDateChange(e) {
that.setData({
date: e.detail.value,
})
},
bindDateChange2(e) {
that.setData({
date2: e.detail.value,
})
},
dropdownSel(e) {
this.setData({
value1: e.detail
})
},
priceSel(e) {
this.setData({
priceSelected: e.currentTarget.dataset.index
})
},
//详情跳转
detail(e) {
var name = e.currentTarget.dataset.carname
wx.navigateTo({
url: '/pages/index/Brandsales/Brandsales?carName=' + name,
})
console.log('123we', name)
},
showPopup() {
this.setData({
show: true
});
},
onClose() {
this.setData({
show: false
});
},
onInput(event) {
this.setData({
currentDate: event.detail,
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getData()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
getData() {
wx.showToast({
title: '加载中',
icon: 'loading',
duration: 30000
})
// let sTimeType = wx.getStorageSync("sTimeType") || 34;
let sStartTime = wx.getStorageSync('newTime') || '';
let sEndTime = wx.getStorageSync('newTime') || '';
app.globalData.request({
action: 'getCheZhuCarBrandRankingHome',
sType: 'Marketing',
sTimeType: '4',
sStartTime: sStartTime,
sEndTime: sEndTime,
iPageIndex: '1',
}).then(res => {
const arr = []
res.forEach(e => {
let obj = {
name: e.brand,
img: e.img,
share: e.percentage,
sales: e.salescount
}
arr.push(obj)
});
this.setData({
ranking: arr
})
})
setTimeout(() => {
wx.hideToast();
}, 500)
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})