wylyl22 3 years ago
parent f492c9a54e
commit d0002e6b39

@ -3,6 +3,9 @@ const app = getApp()
Component({ Component({
data: { data: {
showChart: true, showChart: true,
sSpec:'',
sPriceType:'',
sEnergyType:''
}, },
// onShow() { // onShow() {
// this.getTabBar().init(); // this.getTabBar().init();
@ -14,7 +17,6 @@ Component({
}, },
methods: { methods: {
getTrend(){ getTrend(){
let sStartTime =wx.getStorageSync('newTime') || ''; let sStartTime =wx.getStorageSync('newTime') || '';
let sEndTime = wx.getStorageSync('newTime') || ''; let sEndTime = wx.getStorageSync('newTime') || '';
app.globalData.request({ app.globalData.request({
@ -24,9 +26,9 @@ Component({
sEndTime:sEndTime, sEndTime:sEndTime,
iPageIndex: "iPageIndex", iPageIndex: "iPageIndex",
iPageSize: "iPageSize", iPageSize: "iPageSize",
// sSpec:wx.getStorageSync('sSpec') || '', // sSpec:this.data. ,
// sPriceType:wx.getStorageSync('sPriceType') || '', sPriceType:wx.getStorageSync('sPriceType') || '',
// sEnergyType:wx.getStorageSync('sEnergyType') || '' sEnergyType:wx.getStorageSync('sEnergyType') || ''
}).then(res => { }).then(res => {
let carName = [] let carName = []
let carValue=[] let carValue=[]

@ -26,8 +26,8 @@ export default function histogram(dx = [], ds = [], color1 = '', direction = tru
yAxisIndex:[0], yAxisIndex:[0],
// left:"93%", // left:"93%",
start:0, start:0,
end:80, end:40,
handleSize: 30 // handleSize: 30
}], }],
// legend: { // legend: {
// x:'15', // x:'15',
@ -130,9 +130,9 @@ export default function histogram(dx = [], ds = [], color1 = '', direction = tru
} }
} }
}] : [{ }] : [{
max:50, // max:50,
min:0, // min:0,
splitNumber:5, // splitNumber:5,
type: 'category', type: 'category',
data: dx, data: dx,
axisTick: { axisTick: {

@ -1,7 +1,8 @@
const app = getApp() const app = getApp()
import brokenLine from "../../../../components/option/singleLineOption" import brokenLine from "../../../../components/option/singleLineOption"
import histogram from "../../../../components/option/columnarOption"
let iPageIndex = 1 // 当前第几页,0代表第一页 let iPageIndex = 1 // 当前第几页,0代表第一页
let iPageSize = 20 //每页显示多少数据 let iPageSize =20 //每页显示多少数据
Component({ Component({
data: { data: {
select: false, select: false,
@ -10,7 +11,6 @@ Component({
grade_name3: '按能源', grade_name3: '按能源',
grade_name4: '列表展示', grade_name4: '列表展示',
grades4: ['列表展示', '图表展示'], grades4: ['列表展示', '图表展示'],
//弹出框 //弹出框
show: false, show: false,
duration: 300, duration: 300,
@ -35,42 +35,31 @@ Component({
}, },
lifetimes: { lifetimes: {
attached() { attached() {
let sTimeType = wx.getStorageSync("sTimeType") || 34; this.getData();
let sStartTime = wx.getStorageSync("sStartTime") || '';
let sEndTime = wx.getStorageSync("sEndTime") || '';
this.getData(sTimeType, sStartTime, sEndTime);
} }
}, },
onLoad() { // onLoad() {
let pages = getCurrentPages(); // let pages = getCurrentPages();
let currentPage = pages[pages.length - 1] // let currentPage = pages[pages.length - 1]
let options = currentPage.options // let options = currentPage.options
this.setData({ // this.setData({
id: options.id // id: options.id
})
},
// onShow() {
// this.getData().then(() => {
// this.getLikeData()
// }) // })
// }, // },
searchScrollLower() {
},
methods: { methods: {
getData(sTimeType, sStartTime, sEndTime) { getData() {
wx.showToast({ wx.showToast({
title: '加载中', title: '加载中',
icon: 'loading', icon: 'loading',
duration: 3000 duration: 3000
}) })
this.getAmount(sTimeType, sStartTime, sEndTime); this.getAmount();
this.getTrend(); this.getTrend();
setTimeout(() => { setTimeout(() => {
wx.hideToast(); wx.hideToast();
},500) },500)
}, },
// 排行榜数据
getTrend(){ getTrend(){
wx.showToast({ wx.showToast({
title: '加载中', title: '加载中',
@ -96,17 +85,28 @@ Component({
}) })
} }
app.globalData.request(obj,(database)=>{ 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({ this.setData({
ranking:database.Data // ranking:database.Data,
brandOption:histogram(carName,carValue,'#0084FF',false)
}) })
}).then(res => { }).then(res => {
console.log("结果",res && res.length > 0)
if (res && res.length > 0) { if (res && res.length > 0) {
iPageIndex++; iPageIndex++;
//把新请求到的数据添加到dataList里 //把新请求到的数据添加到列表
let list = this.data.ranking.concat(res); let list = this.data.ranking.concat(res);
// console.log("123",list)
this.setData({ this.setData({
ranking: list, //获取数据数组 ranking: list, //获取数据数组
loadMore: false //把"上拉加载"的变量设为false显示 loadMore: false,//把"上拉加载"的变量设为false显示
}); });
if (res.length < iPageSize) { if (res.length < iPageSize) {
this.setData({ this.setData({
@ -118,6 +118,7 @@ Component({
this.setData({ this.setData({
loadAll: true, //把“没有数据”设为true显示 loadAll: true, //把“没有数据”设为true显示
loadMore: false //把"上拉加载"的变量设为false隐藏 loadMore: false //把"上拉加载"的变量设为false隐藏
}); });
} }
setTimeout(() => { setTimeout(() => {
@ -125,7 +126,8 @@ Component({
}, 500) }, 500)
}) })
}, },
getAmount(sTimeType, sStartTime, sEndTime) { // 筛选列表
getAmount() {
//能源 //能源
app.globalData.request({ app.globalData.request({
action: 'getEnergy', action: 'getEnergy',
@ -138,7 +140,7 @@ Component({
} }
arr.push(obj) arr.push(obj)
}) })
arr.push({name:"全部",value:""}) // arr.push({name:"全部",value:""})
this.setData({ this.setData({
grades3: arr, grades3: arr,
@ -156,6 +158,7 @@ Component({
} }
arr.push(obj) arr.push(obj)
}) })
// arr.push({name:"全部",value:""})
this.setData({ this.setData({
grades2: arr grades2: arr
}) })
@ -173,7 +176,7 @@ Component({
} }
arr.push(obj) arr.push(obj)
}) })
// console.log(arr) // arr.push({name:"全部",value:""})
this.setData({ this.setData({
grades1: arr, grades1: arr,
}) })
@ -189,6 +192,7 @@ Component({
// console.log(this.data.roomLevel) // console.log(this.data.roomLevel)
// console.log(this.data.builds) // console.log(this.data.builds)
}, },
//点击下拉
bindShowMsg(e) { bindShowMsg(e) {
var id = e.currentTarget.id var id = e.currentTarget.id
if (id == 1) { if (id == 1) {
@ -221,9 +225,12 @@ Component({
}) })
} }
}, },
// 按级别
mySelect1(e) { mySelect1(e) {
var name = e.currentTarget.dataset.name.name var name = e.currentTarget.dataset.name.name
var value = e.currentTarget.dataset.name.value var value = e.currentTarget.dataset.name.value
iPageIndex=1
iPageSize = 20
this.setData({ this.setData({
grade_name1: name, grade_name1: name,
sSpec: value, sSpec: value,
@ -231,9 +238,12 @@ Component({
}) })
this.getTrend() this.getTrend()
}, },
// 按价格
mySelect2(e) { mySelect2(e) {
var name = e.currentTarget.dataset.name.name var name = e.currentTarget.dataset.name.name
var value = e.currentTarget.dataset.name.value var value = e.currentTarget.dataset.name.value
iPageIndex=1
iPageSize = 20
this.setData({ this.setData({
grade_name2: name, grade_name2: name,
select2: false, select2: false,
@ -241,9 +251,12 @@ Component({
}) })
this.getTrend() this.getTrend()
}, },
// 按能源
mySelect3(e) { mySelect3(e) {
var name = e.currentTarget.dataset.name.name var name = e.currentTarget.dataset.name.name
var value = e.currentTarget.dataset.name.value var value = e.currentTarget.dataset.name.value
iPageIndex=1
iPageSize = 20
this.setData({ this.setData({
grade_name3: name, grade_name3: name,
select3: false, select3: false,
@ -251,6 +264,7 @@ Component({
}) })
this.getTrend() this.getTrend()
}, },
// 列表展示
mySelect4(e) { mySelect4(e) {
var name = e.currentTarget.dataset.name var name = e.currentTarget.dataset.name
this.setData({ this.setData({
@ -259,8 +273,19 @@ Component({
a: name != "列表展示" 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) { bindDateChange: function(e) {
this.setData({ this.setData({
@ -335,6 +360,7 @@ Component({
//页面上拉触底事件的处理函数 //页面上拉触底事件的处理函数
onReachBottom: function () { onReachBottom: function () {
console.log("上拉触底事件") console.log("上拉触底事件")
console.log(iPageIndex)
let that = this let that = this
if (!that.data.loadMore) { if (!that.data.loadMore) {
that.setData({ that.setData({

@ -2,8 +2,8 @@
<view class="vehicletype"> <view class="vehicletype">
<scroll-view scroll-x="{{true}}" style="white-space: nowrap;height: 100%; width: 100%;background: #ffffff;"> <scroll-view scroll-x="{{true}}" style="white-space: nowrap;height: 100%; width: 100%;background: #ffffff;">
<view class="top" bindtap="a"> <view class="top" bindtap="all">
<view class="box_title" >全部</view> <view class="box_title">全部</view>
</view> </view>
<view class="top"> <view class="top">
<view class="box_title"> <view class="box_title">
@ -25,7 +25,7 @@
<!-- 下拉需要显示的列表 --> <!-- 下拉需要显示的列表 -->
<view class="select_box" wx:if="{{select1}}"> <view class="select_box" wx:if="{{select1}}">
<view wx:for="{{grades1}}" wx:key="unique"> <view wx:for="{{grades1}}" wx:key="unique">
<view class="select_one" bindtap="mySelect1" data-name="{{item}}">{{item.name}}</view> <view class="select_one" bindtap="mySelect1" data-name="{{item}}">{{item.name}}</view>
</view> </view>
</view> </view>
</view> </view>
@ -72,7 +72,10 @@
<view class="list"> <view class="list">
<view class="list_event" wx:if="{{a}}"> <view class="list_event" wx:if="{{a}}">
<view class="text">销量排行榜</view> <view class="text">销量排行榜</view>
<chart-display></chart-display> <view style=" height: 1000rpx;">
<c-echars showChart="{{showChart}}" canvasId="chart-canvas" chartId="chartbar" chartOption="{{brandOption}}" height="100%"></c-echars>
</view>
</view> </view>
<view class="list_event" wx:else> <view class="list_event" wx:else>
<view class="text">销量排行榜</view> <view class="text">销量排行榜</view>
@ -81,7 +84,7 @@
<view class="ptitle">品牌名称</view> <view class="ptitle">品牌名称</view>
<view class="xtitle2">销量</view> <view class="xtitle2">销量</view>
</view> </view>
<view class="ranks" wx:for="{{ranking}}" wx:key="index" data-ranking='{{item}}'> <view class="ranks" wx:for="{{ranking}}" wx:key="index" data-ranking='{{item}}'>
<view style="display: flex;"> <view style="display: flex;">
<view class="dis_image"> <view class="dis_image">
<image class="rank_num" wx:if="{{index === 0}}" src="{{imageUrl}}/img_diyi.png"></image> <image class="rank_num" wx:if="{{index === 0}}" src="{{imageUrl}}/img_diyi.png"></image>
@ -104,10 +107,10 @@
</view> </view>
<view style="width: 30%;"> <view style="width: 30%;">
<view class="volume">{{item.salescount}}</view> <view class="volume">{{item.salescount}}</view>
<view class="trend" data-car="{{item.seriesname}}" bindtap="popup" data-position="bottom"> <view class="trend" data-car="{{item.seriesname}}" bindtap="popup" data-position="bottom">
<van-icon size="16px" name="arrow" /> <van-icon size="16px" name="arrow" />
<view>销量趋势</view> <view>销量趋势</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
@ -131,22 +134,17 @@
</view> </view>
</page-container> --> </page-container> -->
<van-popup <van-popup show="{{ show }}" position="bottom" custom-style="height: 40%;" bind:close="onClose">
show="{{ show }}" <view class="detail-page">
position="bottom"
custom-style="height: 40%;"
bind:close="onClose"
>
<view class="detail-page">
<view style="display: flex;"> <view style="display: flex;">
<view class="qushi">销量趋势</view> <view class="qushi">销量趋势</view>
<view class="tubiao" bindtap="exit"> <view class="tubiao" bindtap="exit">
<van-icon name="cross"/> <van-icon name="cross" />
</view> </view>
</view> </view>
<view class="pinlai">{{models}}销量趋势</view> <view class="pinlai">{{models}}销量趋势</view>
<view class="brand_tu"> <view class="brand_tu">
<c-echars flocShow="{{false}} "showChart="{{showChart}}" canvasId="tonalitybar-canvas" chartId="tonalitybar" chartOption="{{positiveOption}}" width="100%"height='100%' ></c-echars> <c-echars flocShow="{{false}} " showChart="{{showChart}}" canvasId="tonalitybar-canvas" chartId="tonalitybar" chartOption="{{positiveOption}}" width="100%" height='100%'></c-echars>
</view> </view>
</view> </view>
</van-popup> </van-popup>

@ -162,7 +162,10 @@
font-size: 36rpx; font-size: 36rpx;
padding: 32rpx 32rpx 0 32rpx; padding: 32rpx 32rpx 0 32rpx;
} }
.tubiao{
height: 1000rpx;
width: 100%;
}
.ranking { .ranking {
width: 654rpx; width: 654rpx;
display: flex; display: flex;
@ -306,6 +309,11 @@
height: 390rpx; height: 390rpx;
padding: 0 32rpx 32rpx 32rpx; padding: 0 32rpx 32rpx 32rpx;
} }
.brand_tu{
width: 100%;
height: 390rpx;
padding: 0 32rpx 32rpx 32rpx;
}
.qushi{ .qushi{
width: 90%; width: 90%;
height:80rpx; height:80rpx;

Loading…
Cancel
Save