From d0002e6b39d6fdddbe73953c4303383d5d3d104f Mon Sep 17 00:00:00 2001 From: wylyl22 <2373073266@qq.com> Date: Wed, 27 Jul 2022 15:29:50 +0800 Subject: [PATCH] wyl --- components/chartdisplay/index.js | 10 ++- components/option/columnarOption.js | 10 +-- .../Salesranking/Vehicletype/Vehicletype.js | 88 ++++++++++++------- .../Salesranking/Vehicletype/Vehicletype.wxml | 34 ++++--- .../Salesranking/Vehicletype/Vehicletype.wxss | 10 ++- 5 files changed, 93 insertions(+), 59 deletions(-) diff --git a/components/chartdisplay/index.js b/components/chartdisplay/index.js index daef192..5eee526 100644 --- a/components/chartdisplay/index.js +++ b/components/chartdisplay/index.js @@ -3,6 +3,9 @@ const app = getApp() Component({ data: { showChart: true, + sSpec:'', + sPriceType:'', + sEnergyType:'' }, // onShow() { // this.getTabBar().init(); @@ -14,7 +17,6 @@ Component({ }, methods: { getTrend(){ - let sStartTime =wx.getStorageSync('newTime') || ''; let sEndTime = wx.getStorageSync('newTime') || ''; app.globalData.request({ @@ -24,9 +26,9 @@ Component({ sEndTime:sEndTime, iPageIndex: "iPageIndex", iPageSize: "iPageSize", - // sSpec:wx.getStorageSync('sSpec') || '', - // sPriceType:wx.getStorageSync('sPriceType') || '', - // sEnergyType:wx.getStorageSync('sEnergyType') || '' + // sSpec:this.data. , + sPriceType:wx.getStorageSync('sPriceType') || '', + sEnergyType:wx.getStorageSync('sEnergyType') || '' }).then(res => { let carName = [] let carValue=[] diff --git a/components/option/columnarOption.js b/components/option/columnarOption.js index ffd3fe3..a095679 100644 --- a/components/option/columnarOption.js +++ b/components/option/columnarOption.js @@ -26,8 +26,8 @@ export default function histogram(dx = [], ds = [], color1 = '', direction = tru yAxisIndex:[0], // left:"93%", start:0, - end:80, - handleSize: 30 + end:40, + // handleSize: 30 }], // legend: { // x:'15', @@ -130,9 +130,9 @@ export default function histogram(dx = [], ds = [], color1 = '', direction = tru } } }] : [{ - max:50, - min:0, - splitNumber:5, + // max:50, + // min:0, + // splitNumber:5, type: 'category', data: dx, axisTick: { diff --git a/pages/index/Salesranking/Vehicletype/Vehicletype.js b/pages/index/Salesranking/Vehicletype/Vehicletype.js index 2263347..bfed2ec 100644 --- a/pages/index/Salesranking/Vehicletype/Vehicletype.js +++ b/pages/index/Salesranking/Vehicletype/Vehicletype.js @@ -1,7 +1,8 @@ const app = getApp() import brokenLine from "../../../../components/option/singleLineOption" +import histogram from "../../../../components/option/columnarOption" let iPageIndex = 1 // 当前第几页,0代表第一页 -let iPageSize = 20 //每页显示多少数据 +let iPageSize =20 //每页显示多少数据 Component({ data: { select: false, @@ -10,7 +11,6 @@ Component({ grade_name3: '按能源', grade_name4: '列表展示', grades4: ['列表展示', '图表展示'], - //弹出框 show: false, duration: 300, @@ -35,42 +35,31 @@ Component({ }, lifetimes: { attached() { - let sTimeType = wx.getStorageSync("sTimeType") || 34; - let sStartTime = wx.getStorageSync("sStartTime") || ''; - let sEndTime = wx.getStorageSync("sEndTime") || ''; - this.getData(sTimeType, sStartTime, sEndTime); + this.getData(); } }, - 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() + // onLoad() { + // let pages = getCurrentPages(); + // let currentPage = pages[pages.length - 1] + // let options = currentPage.options + // this.setData({ + // id: options.id // }) // }, - - searchScrollLower() { - - }, methods: { - getData(sTimeType, sStartTime, sEndTime) { + getData() { wx.showToast({ title: '加载中', icon: 'loading', duration: 3000 }) - this.getAmount(sTimeType, sStartTime, sEndTime); + this.getAmount(); this.getTrend(); setTimeout(() => { wx.hideToast(); },500) }, + // 排行榜数据 getTrend(){ wx.showToast({ title: '加载中', @@ -96,17 +85,28 @@ Component({ }) } app.globalData.request(obj,(database)=>{ + console.log("这是第一条数据",database.Data) + const carName=[] + const carValue=[] + database.Data.forEach(e=>{ + carName.push(e.seriesname) + carValue.push(e.salescount) + }) this.setData({ - ranking:database.Data + // ranking:database.Data, + brandOption:histogram(carName,carValue,'#0084FF',false) }) }).then(res => { + console.log("结果",res && res.length > 0) if (res && res.length > 0) { iPageIndex++; - //把新请求到的数据添加到dataList里 + //把新请求到的数据添加到列表里 let list = this.data.ranking.concat(res); + // console.log("123",list) this.setData({ ranking: list, //获取数据数组 - loadMore: false //把"上拉加载"的变量设为false,显示 + loadMore: false,//把"上拉加载"的变量设为false,显示 + }); if (res.length < iPageSize) { this.setData({ @@ -118,6 +118,7 @@ Component({ this.setData({ loadAll: true, //把“没有数据”设为true,显示 loadMore: false //把"上拉加载"的变量设为false,隐藏 + }); } setTimeout(() => { @@ -125,7 +126,8 @@ Component({ }, 500) }) }, - getAmount(sTimeType, sStartTime, sEndTime) { + // 筛选列表 + getAmount() { //能源 app.globalData.request({ action: 'getEnergy', @@ -138,7 +140,7 @@ Component({ } arr.push(obj) }) - arr.push({name:"全部",value:""}) + // arr.push({name:"全部",value:""}) this.setData({ grades3: arr, @@ -156,6 +158,7 @@ Component({ } arr.push(obj) }) + // arr.push({name:"全部",value:""}) this.setData({ grades2: arr }) @@ -173,7 +176,7 @@ Component({ } arr.push(obj) }) - // console.log(arr) + // arr.push({name:"全部",value:""}) this.setData({ grades1: arr, }) @@ -189,6 +192,7 @@ Component({ // console.log(this.data.roomLevel) // console.log(this.data.builds) }, + //点击下拉 bindShowMsg(e) { var id = e.currentTarget.id if (id == 1) { @@ -221,9 +225,12 @@ Component({ }) } }, + // 按级别 mySelect1(e) { var name = e.currentTarget.dataset.name.name var value = e.currentTarget.dataset.name.value + iPageIndex=1 + iPageSize = 20 this.setData({ grade_name1: name, sSpec: value, @@ -231,9 +238,12 @@ Component({ }) this.getTrend() }, + // 按价格 mySelect2(e) { var name = e.currentTarget.dataset.name.name var value = e.currentTarget.dataset.name.value + iPageIndex=1 + iPageSize = 20 this.setData({ grade_name2: name, select2: false, @@ -241,9 +251,12 @@ Component({ }) this.getTrend() }, + // 按能源 mySelect3(e) { var name = e.currentTarget.dataset.name.name var value = e.currentTarget.dataset.name.value + iPageIndex=1 + iPageSize = 20 this.setData({ grade_name3: name, select3: false, @@ -251,6 +264,7 @@ Component({ }) this.getTrend() }, + // 列表展示 mySelect4(e) { var name = e.currentTarget.dataset.name this.setData({ @@ -259,8 +273,19 @@ Component({ a: name != "列表展示" }) }, - a(){ - console.log(this.data) + // 全部 + all(){ + iPageIndex=1 + iPageSize = 20 + this.setData({ + grade_name1: '按级别', + grade_name2: '按价格', + grade_name3: '按能源', + sSpec: '', + sPriceType: '', + sEnergyType: '', + }) + this.getTrend() }, bindDateChange: function(e) { this.setData({ @@ -335,6 +360,7 @@ Component({ //页面上拉触底事件的处理函数 onReachBottom: function () { console.log("上拉触底事件") + console.log(iPageIndex) let that = this if (!that.data.loadMore) { that.setData({ diff --git a/pages/index/Salesranking/Vehicletype/Vehicletype.wxml b/pages/index/Salesranking/Vehicletype/Vehicletype.wxml index e2a901a..c5ecda3 100644 --- a/pages/index/Salesranking/Vehicletype/Vehicletype.wxml +++ b/pages/index/Salesranking/Vehicletype/Vehicletype.wxml @@ -2,8 +2,8 @@ - - 全部 + + 全部 @@ -25,7 +25,7 @@ - {{item.name}} + {{item.name}} @@ -72,7 +72,10 @@ 销量排行榜 - + + + + 销量排行榜 @@ -81,7 +84,7 @@ 品牌名称 销量 - + @@ -104,10 +107,10 @@ {{item.salescount}} - + - 销量趋势 - + 销量趋势 + @@ -131,22 +134,17 @@ --> - - + + 销量趋势 - + {{models}}销量趋势 - + - + \ No newline at end of file diff --git a/pages/index/Salesranking/Vehicletype/Vehicletype.wxss b/pages/index/Salesranking/Vehicletype/Vehicletype.wxss index c88c507..e82deb0 100644 --- a/pages/index/Salesranking/Vehicletype/Vehicletype.wxss +++ b/pages/index/Salesranking/Vehicletype/Vehicletype.wxss @@ -162,7 +162,10 @@ font-size: 36rpx; padding: 32rpx 32rpx 0 32rpx; } - +.tubiao{ + height: 1000rpx; + width: 100%; +} .ranking { width: 654rpx; display: flex; @@ -306,6 +309,11 @@ height: 390rpx; padding: 0 32rpx 32rpx 32rpx; } +.brand_tu{ + width: 100%; + height: 390rpx; + padding: 0 32rpx 32rpx 32rpx; +} .qushi{ width: 90%; height:80rpx;