星油闪充小程序
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.
 
 
 
 

123 lines
2.8 KiB

<template>
<view class="periodPrice_body">
<scroll-view v-if="viewData.list&&viewData.list.length" style="height: 100%;" scroll-y="true" @scrolltolower='scrolltolower'>
<station-item :data="item" :key="index" v-for="(item,index) in viewData.list"></station-item>
</scroll-view>
<image class="qx" v-else src="@/static/qs.png" mode=""></image>
</view>
</template>
<script>
import station from '@/api/station.js'
import {page} from "./AntiCorruptionLayer.js"
import stationItem from "@/components/stationItem/stationItem.vue"
export default {
components: {
stationItem
},
data() {
return {
// uni.getStorageSync('location').longitude
pageData: {
currentPage: 1,
stationName: '',
stationLng: uni.getStorageSync('location').longitude||116.38,
stationLat: uni.getStorageSync('location').latitude||39.90,
sortType: ''
},
viewData:null,
}
},
onLoad(e) {},
created() {
},
onShow() {
this.pageData.currentPage = 1
this.getList();
},
methods: {
difSource(e) {
switch (e) {
case 'XXCD':
return {
label: '星星充电',
color: '#E48011CC'
}
case 'QT':
return {
label: '其他',
color: '#121836CC'
}
case 'KD':
return {
label: '快电',
color: '#FF5F0FCC'
}
case 'TLD':
return {
label: '特来电',
color: '#7AA0F4CC'
}
case 'YKC':
return {
label: '云快充',
color: '#00A7EBCC'
}
case 'ZGGD':
return {
label: '中国国电',
color: '#27AB3BCC'
}
}
},
difTags(res) {
res.data.forEach((item, index) => {
item['tags'] = ['maxCurrent', 'createSource'].map((tag, tagIndex) => {
let result = {}
switch (tag) {
case 'maxCurrent':
result = {
label: `最大${item[tag]}A`,
color: '#6EA29BCC'
}
break;
case 'createSource':
let source = this.difSource(item[tag]);
result = {
...source
}
break;
}
return result
});
if (index == 0) item['tags'].unshift({
label: '距离最近',
color: '#36658DFF'
})
})
},
getList() {
station.getCollectStations(this.pageData).then(res => {
if (res.code == 20000) {
this.difTags(res);
if (this.pageData.currentPage !== 1) {
let data = new this.tool.Anticorrosive(res, page);
this.viewData.list = this.viewData.list.concat(data.list)
} else {
this.viewData = new this.tool.Anticorrosive(res, page);
}
}
})
},
scrolltolower() {
uni.showToast({
title: '到底了',
icon: 'none'
})
}
},
}
</script>
<style lang="scss" scoped>
@import 'index.scss';
</style>