wylyl22 3 years ago
commit 1b3a1fed98

@ -69,6 +69,7 @@
background-color: #ffffff;
margin: 32rpx;
border-radius: 4rpx;
padding-bottom: 26px;
}
.Cumulative {

@ -1,76 +1,120 @@
import histogram from "../../option/columnarOption"
import histogram from "../../option/columnarOption"
const app = getApp()
Component({
data: {
imageUrl: getApp().globalData.imageUrl,
imageUrl: getApp().globalData.imageUrl,
showChart: true,
},
lifetimes:{
attached(){
this.getData()
}
},
lifetimes: {
attached() {
this.getData()
}
},
methods: {
getData(){
getData() {
wx.showToast({
title: '加载中',
icon: 'loading',
duration: 300000
})
app.globalData.request({action: 'getCheZhuLatestTimeHome',sType:'Marketing'}).then(res => {
// wx.setStorageSync('newTime', res)
const newTime=res
this.setData({
newTime
duration: 50000
})
Promise.all([this.getTimeData(), this.getBrandData(), this.getModelData()]).then(() => {
setTimeout(() => {
wx.hideToast();
}, 500)
})
},
// 获取时间
getTimeData() {
return new Promise((resolve, reject) => {
app.globalData.request({
action: 'getCheZhuLatestTimeHome',
sType: 'Marketing'
}).then(res => {
wx.setStorageSync('newTime', res)
this.setData({
newTime: wx.getStorageSync('newTime')
})
resolve(true)
}).catch(() => {
reject(false)
})
})
},
// 获取品牌的数据
getBrandData() {
return new Promise((resolve, reject) => {
app.globalData.request({
action: 'getCheZhuCarBrandRankingHome',
sType: 'Marketing',
sTimeType: 4,
sStartTime: wx.getStorageSync('newTime') || '',
sEndTime: wx.getStorageSync('newTime') || ''
}).then(res => {
console.log(res)
const carName = []
const carCount = []
res.forEach(e => {
carName.push(e.brand),
carCount.push(e.salescount)
});
this.setData({
brandOption: histogram(carName, carCount, '#0084FF'),
})
resolve(true)
}).catch(() => {
reject(false)
})
})
app.globalData.request({action: 'getCheZhuCarBrandRankingHome',sType:'Marketing',
sTimeType:"4",
sStartTime:wx.getStorageSync('newTime'),
sEndTime:wx.getStorageSync('newTime')}).then(res => {
console.log(res)
const carName=[]
const carCount=[]
res.forEach(e => {
carName.push(e.brand),
},
getModelData() {
return new Promise((resolve, reject) => {
app.globalData.request({
action: 'getCheZhuCarSeriesRankingHome',
sType: 'Marketing',
sTimeType: 4,
sStartTime: wx.getStorageSync('newTime') || "",
sEndTime: wx.getStorageSync('newTime') || ""
}).then(res => {
console.log(res)
const carName = []
const carCount = []
res.forEach(e => {
carName.push(e.seriesname),
carCount.push(e.salescount)
});
this.setData({
brandOption:histogram(carName,carCount,'#0084FF'),
// modelOption:histogram()
});
this.setData({
modelOption: histogram(carName, carCount, '#20CC62'),
})
resolve(true)
}).catch(() => {
reject(false)
})
})
setTimeout(() =>{
wx.hideToast();
},500)
},
priceSel(e){
},
priceSel(e) {
this.setData({
intervalSel: e.currentTarget.dataset.index
})
},
Rankdetail(){
wx.navigateTo({
url: "/pages/index/Salesranking/Salesranking"
})
Rankdetail() {
wx.navigateTo({
url: "/pages/index/Salesranking/Salesranking"
})
},
//品牌排行
ranking(){
wx.navigateTo({
url: "/pages/index/Salesranking/Salesranking?a="+this.newTime
})
ranking() {
wx.navigateTo({
url: "/pages/index/Salesranking/Salesranking"
})
},
//车型排行
vehicletype(){
wx.navigateTo({
url: "/pages/index/Salesranking/Salesranking"
})
vehicletype() {
wx.navigateTo({
url: "/pages/index/Salesranking/Salesranking"
})
}
}
})

@ -1,66 +0,0 @@
// index/home/home.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

@ -1,3 +0,0 @@
{
"usingComponents": {}
}

@ -1,2 +0,0 @@
<!--index/home/home.wxml-->
<text>index/home/home.wxml</text>

@ -1 +0,0 @@
/* index/home/home.wxss */

@ -5,7 +5,7 @@ Page({
* 页面的初始数据
*/
data: {
end:newtime.toLocaleDateString(),
end:newtime.toLocaleDateString(),
show:false,
date:'2016-09-01',
date2:'2016-09-02',

@ -25,7 +25,10 @@
</view>
<view class="ranks" wx:for="{{ranking}}" wx:key="index" data-ranking='{{item}}'>
<view style="display: flex;">
<view class="ranks_text"> 01</view>
<view class="ranks_text">
<view class="num" wx:if="{{index === 0}}">01</view>
<view class="num" wx:if="{{index}}">{{index >= 9 ? index + 1 : '0' + (index + 1)}}</view>
</view>
<view class="ranks_text1">
<image style="width: 96rpx;height: 72rpx;" src="{{item.img}}"></image>
<view style="margin-left: 15rpx; height: 102rpx;line-height: 102rpx;width: 180rpx;">{{item.name}}

@ -19,9 +19,16 @@ Component({
show: false,
duration: 300,
position: 'bottom',
round: true,
// round: true,
overlay: true,
showChart: true,
//图表
positiveOption:brokenLine(dName,dValue,dColor,data),
imageUrl: getApp().globalData.imageUrl,
date:'2021-01',
accountIndex:0,
ranking:[],
imageUrl: getApp().globalData.imageUrl,
date:'2021-01',
accountIndex:0,
@ -40,6 +47,35 @@ Component({
}
},
onLoad() {
let pages = getCurrentPages();
let currentPage = pages[pages.length - 1]
let options = currentPage.options
this.setData({
id: options.id
})
},
onShow() {
this.getData().then(() => {
this.getLikeData()
})
},
//页面上拉触底事件的处理函数
onReachBottom: function () {
console.log("上拉触底事件")
let that = this
if (!that.data.loadMore) {
that.setData({
loadMore: true, //加载中
loadAll: false //是否加载完所有数据
});
//加载更多,这里做下延时加载
that.getLikeData();
}
},
searchScrollLower() {
this.getLikeData();
},
methods: {
getData(sTimeType, sStartTime, sEndTime){
wx.showToast({
@ -54,17 +90,26 @@ Component({
},500)
},
getTrend(){
app.globalData.request({
let obj = {
action: 'getCheZhuCarSeriesRankingHome',
sType:'Marketing',
sStartTime: "2021-10",
sEndTime:"2021-10",
iPageIndex: "iPageIndex",
iPageSize: "iPageSize",
iPageIndex: iPageIndex,
iPageSize: iPageSize,
// sSpec:wx.getStorageSync('sSpec') || '',
// sPriceType:wx.getStorageSync('sPriceType') || '',
// sEnergyType:wx.getStorageSync('sEnergyType') || ''
}).then(res => {
}
//第一次加载数据
if (iPageIndex == 1) {
this.setData({
loadMore: true, //把"上拉加载"的变量设为true显示
loadAll: false //把“没有数据”设为false隐藏
})
}
app.globalData.request(obj).then(res => {
let arr = []
res.forEach(ele =>{
let ol = {
@ -77,6 +122,30 @@ Component({
this.setData({
ranking:arr
})
console.log('22',arr)
}).then(res =>{
if (res && res.length > 0) {
iPageIndex++;
//把新请求到的数据添加到dataList里
let list = this.data.arr.concat(res);
this.setData({
arr: list, //获取数据数组
loadMore: false //把"上拉加载"的变量设为false显示
});
if (res.length < pageSize) {
this.setData({
loadMore: false, //隐藏加载中。。
loadAll: true //所有数据都加载完了
});
}
} else {
this.setData({
loadAll: true, //把“没有数据”设为true显示
loadMore: false //把"上拉加载"的变量设为false隐藏
});
}
})
},
getAmount(sTimeType, sStartTime, sEndTime){

@ -113,6 +113,8 @@
</view>
</view>
</view>
<view class="loading" hidden="{{!loadMore}}">正在载入更多...</view>
<view class="loading" hidden="{{!loadAll}}">已加载全部</view>
</view>
<page-container show="{{show}}" duration="{{duration}}" position="{{position}}" close-on-slide-down="{{false}}" custom-style="height:50%">
<view class="detail-page">

@ -420,4 +420,11 @@
/* top: 20rpx; */
}
.loading {
position: relative;
bottom: 5rpx;
padding: 10rpx;
text-align: center;
font-size: 12px;
}
Loading…
Cancel
Save