|
@@ -2,10 +2,10 @@
|
|
|
<template>
|
|
|
<view>
|
|
|
<u-navbar title="">
|
|
|
- <u-search class="search" placeholder="搜索站点名称" v-model="keyword" color="#c8c8c8" @search="search" @click="search" @clickicon='back' @custom='search'></u-search>
|
|
|
+ <u-search class="search" placeholder="搜索站点名称" @change="search" v-model="keyword" color="#c8c8c8" @search="search" @click="search" @clickicon='back' @custom='search'></u-search>
|
|
|
</u-navbar>
|
|
|
<view class="recommend">推荐充电站</view>
|
|
|
- <view class="charing-slow" v-for="(item,index) in stations" :key="item.id">
|
|
|
+ <view class="charing-slow" v-for="(item,index) in stations_filter" :key="item.id">
|
|
|
<text :class="item.type == '慢充'? 'trickle-charge':'fast-charge'">{{item.type}}</text> <text class="station-items">{{item.name}}</text>
|
|
|
<view class="address">
|
|
|
{{item.position}}
|
|
@@ -39,17 +39,25 @@
|
|
|
|
|
|
return {
|
|
|
keyword:'',
|
|
|
+ stations_filter:[],
|
|
|
stations:[
|
|
|
- {name:'荆鹏软件园充电站',position:'湖北省荆州市沙市区江津东路附155号',price:1.2,idleNum:10,total:10,distance:0.1,time:1,type:'慢充',park:'2小时免费停车'},
|
|
|
+/* {name:'荆鹏软件园充电站',position:'湖北省荆州市沙市区江津东路附155号',price:1.2,idleNum:10,total:10,distance:0.1,time:1,type:'慢充',park:'2小时免费停车'},
|
|
|
{name:'荆鹏软件园充电站2',position:'湖北省荆州市沙市区江津东路附156号',price:1.2,idleNum:10,total:10,distance:0.15,time:12,type:'快充',park:'3小时免费停车'},
|
|
|
{name:'荆鹏软件园充电站3',position:'湖北省荆州市沙市区江津东路附157号',price:1.2,idleNum:10,total:10,distance:0.2,time:13,type:'慢充',park:'4小时免费停车'},
|
|
|
{name:'荆鹏大道求助站充电站',position:'湖北省荆州市沙市区江津东路附158号',price:1.2,idleNum:10,total:10,distance:0.3,time:14,type:'快充',park:'5小时免费停车'},
|
|
|
-
|
|
|
+ */
|
|
|
],
|
|
|
}
|
|
|
+ },
|
|
|
+ onLoad(op){
|
|
|
+ if(op!= null && op.stationlist != null){
|
|
|
+ this.stations = decodeURIComponent(op.stationlist)
|
|
|
+ console.log('stations'+JSON.stringify(this.stations))
|
|
|
+ }
|
|
|
+ console.log('op'+JSON.stringify(op))
|
|
|
},
|
|
|
// conponents:{charingSlows},
|
|
|
- methods: {
|
|
|
+ methods: {
|
|
|
back(){
|
|
|
console.log('back');
|
|
|
uni.navigateBack({
|
|
@@ -57,6 +65,17 @@
|
|
|
})
|
|
|
},
|
|
|
search(){
|
|
|
+ console.log('search')
|
|
|
+ this.stations_filter = []
|
|
|
+ if(this.keyword.length<=0){
|
|
|
+ this.stations_filter = this.stations
|
|
|
+ }
|
|
|
+ for(let i = 0;i< this.stations.length;i++){
|
|
|
+ if(this.stations[i].name.indexOf(this.keyword)>=0){
|
|
|
+ this.stations_filter.push(this.stations[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
console.log('search ' + this.keyword);
|
|
|
}
|
|
|
}
|