searchPile.vue 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643
  1. <template>
  2. <view class='font1'>
  3. <ujp-navbar :is-back="false" :height='nav_height'style="background-color: bisque;">
  4. <view style="display: flex;flex-direction: column; width: 100%;height: 100%;">
  5. <view style="display: flex;flex-direction: row; height: 100%; align-items: center;margin-top:0rpx;padding-top: 0rpx;padding-bottom: 20rpx;">
  6. <view style="margin-left:20rpx;width: 160rpx;">
  7. <uni-combox class='font2' ref="city" :border="false" v-model="area" :candidates="cities" @updateModel='updateCity' @updateSelector="updateCitySelector"></uni-combox>
  8. </view>
  9. <view style="margin-left: 20rpx;margin-right: 20rpx; flex:1" >
  10. <u-search height="80" :input-style='inputStyle' placeholder="搜索站点名称" v-model="keyword" :showAction="false" @focus="navigate"></u-search></view>
  11. <view style="margin-right: 20rpx;" v-show="viewMode" @click="listMode">
  12. <text class="iconfont">&#xe613;</text> <text class="list font2">列表</text>
  13. <!-- <u-icon name="list-dot" size="26" color="#c0c4cc"></u-icon>
  14. <label>列表</label>-->
  15. </view>
  16. <view style="margin-right: 20rpx;" v-show="!viewMode" @click="mapMode">
  17. <text class="iconfont">&#xe622;</text> <text class="list font2">地图</text>
  18. <!--<u-icon name="map" size="26" color="#c0c4cc"></u-icon>
  19. <label>地图</label>
  20. -->
  21. </view>
  22. </view>
  23. <view style="display: flex;flex-direction: row;width:100%; justify-content: space-between;align-items: center;">
  24. <view style="margin-left:20rpx;width: 160rpx;">
  25. <uni-combox class='font2' ref="radius" style="width: 200rpx;" :border="false" v-model="radius" :candidates="radiuses" @updateModel='updateRadius' @updateSelector="updateRadiusSelector"></uni-combox>
  26. </view>
  27. <!--
  28. <view style="margin-left: 20rpx;">
  29. <label class="arrow">{{ info.miles_type[preference.miles_index].text }}</label>
  30. <u-icon name="arrow-down-fill" size="13" color="#c0c4cc"></u-icon>
  31. </view>
  32. -->
  33. <view style="margin-left:20rpx;margin-right: 20rpx;flex:1">
  34. <uni-combox ref="type" class='font2' style="width: 200rpx;" :border="false" v-model="type" :candidates="types" @updateModel='updateType' @updateSelector="updateTypeSelector"></uni-combox>
  35. </view>
  36. <!-- <view style="margin-left: 20rpx;margin-right: 20rpx;flex:1">
  37. <label class="arrow">{{ info.obc_type[preference.obc_type_index].text }}</label>
  38. <u-icon name="arrow-down-fill" size="13" color="#c0c4cc"></u-icon>
  39. </view>-->
  40. <view style="margin-right: 20rpx;" @click="open">
  41. <label class="arrow font2">{{ action }}</label>
  42. <u-icon v-if="show" name="arrow-down-fill" size="13" color="#00B962"></u-icon>
  43. <u-icon v-else name="arrow-down-fill" size="13" color="#c0c4cc"></u-icon>
  44. </view>
  45. </view>
  46. </view>
  47. </ujp-navbar>
  48. <view class="content" >
  49. <view v-if="show" class="preference" :style="show ? 'z-index:1024;top:'+navBarHeight+'px;' : 'z-index:0'" style="width: 100%;">
  50. <view class="content-s">
  51. <view class="preference_group">
  52. <view class="preference_group_item"><label class="preference_label">距离我</label></view>
  53. <view>
  54. <u-tag
  55. class="preference_item"
  56. v-for="(item, index) in info.miles_type"
  57. :key="index"
  58. :style="index == preference.miles_index ? 'background-color:#00B962;color:#FFFFFF' : 'background-color:#EFF4F2;color:#926666'"
  59. shape="circle"
  60. :text="item.text"
  61. @click="selectMiles(index)"
  62. ></u-tag>
  63. </view>
  64. </view>
  65. <view class="preference_group">
  66. <view class="preference_group_item"><label class="preference_label">充电站类型</label></view>
  67. <view>
  68. <u-tag
  69. class="preference_item_medium"
  70. v-for="(item, index) in info.obc_type"
  71. :key="index"
  72. :style="index == preference.obc_type_index ? 'background-color:#00B962;color:#FFFFFF' : 'background-color:#EFF4F2;color:#926666'"
  73. shape="circle"
  74. :text="item.text"
  75. @click="selectOBSType(index)"
  76. ></u-tag>
  77. </view>
  78. </view>
  79. <view class="preference_group">
  80. <view class="preference_group_item"><label class="preference_label">是否对外开放</label></view>
  81. <view>
  82. <u-tag
  83. class="preference_item_plus"
  84. v-for="(item, index) in info.obc_status"
  85. :key="index"
  86. :style="index == preference.obc_status_index ? 'background-color:#00B962;color:#FFFFFF' : 'background-color:#EFF4F2;color:#926666'"
  87. shape="circle"
  88. :text="item.text"
  89. @click="selectOBSStatus(index)"
  90. ></u-tag>
  91. </view>
  92. </view>
  93. <view class="preference_group">
  94. <view style="margin-left: 30rpx;"><u-checkbox shape="circle" v-model="preference.save_preference" @change="radioChange">保存偏好设置</u-checkbox></view>
  95. </view>
  96. </view>
  97. <view class="pre-btn" style="display: flex;flex-direction: row;">
  98. <view class="btn-1 font3" @click="reset" style="width: 30%;">重置</view>
  99. <view class="btn-2 font3" @click="close" style="width: 70%;background-color: #00B962;color: #fff;">确定</view>
  100. </view>
  101. </view>
  102. <u-mask :show="show" @click="show = false"></u-mask>
  103. <view v-show="!viewMode" >
  104. <view v-for="(item,index) in stationslist" :key="item.id" class="charing-slow" @click="stationDetail(item)">
  105. <text :class="item.type == '快充' ? 'fast-charge':(item.type == '慢充' ? 'trickle-charge':'fast-trickle-charge')">{{item.type}}</text> <text class="station-items">{{item.name}}</text>
  106. <view class="address">
  107. {{item.position}}
  108. </view>
  109. <view class="price">
  110. <view class="num">{{item.price}}</view>
  111. <view class="unit">
  112. 元/度 起
  113. </view>
  114. </view>
  115. <view class="park">
  116. <text class="park-p" style="color: #FFFFFF;">p</text>
  117. <text class="park-text">2小时免费停车</text>
  118. </view>
  119. <view class="free">
  120. <view class="free-num">
  121. <text style="color:#009143;">空闲{{item.idleNum}}</text>/总数{{item.total}}
  122. </view>
  123. <view class="distance">
  124. <text class="iconfont distance-font">&#xe615;</text>{{item.distance.toFixed(1)}}公里 {{item.time.toFixed(0)}}分钟
  125. </view>
  126. </view>
  127. </view>
  128. <u-divider margin-top="20" bg-color="#F2F4F4">已经到底了</u-divider>
  129. </view>
  130. <view v-show="viewMode">
  131. <view>
  132. <Chargermap @onMoveStart="moveStart" @onMoveEnd="moveEnd" ref="amap" @onClicked="onClicked" @onload="mapdown" @clickMap="clickMap"></Chargermap>
  133. <!--@location="location"-->
  134. <u-image style='position:absolute;z-index:1023;right:40rpx;bottom:520rpx;' src="@/static/img/location.png" width="30px" height="30px" @click="setCenter"></u-image>
  135. </view>
  136. <view v-if="stationsmap.length>0" class="chargerCard" style="border-radius: 20rpx;">
  137. <swiper :current="currentIndex" @change="swiperChange" slide-change-transition-end='swiperTransitionEnd' @transition="swiperTransition" style="height: 100%;">
  138. <swiper-item v-for="(item,index) in stationsmap" :key="item.id" style="height: 100%;">
  139. <view class="swiper-item" style="height: 100%; background-color: #ffffff;" @click="stationDetail(item)">
  140. <view class="card_item" style="padding-top: 5rpx;">
  141. <view style="display: flex;flex-direction: row;">
  142. <view :class="item.type == '快充' ? 'fast-charge':(item.type == '慢充' ? 'trickle-charge':'fast-trickle-charge')" >
  143. {{item.type}}
  144. </view>
  145. <view class="font-weight3" >
  146. {{item.name}}
  147. </view>
  148. </view>
  149. </view>
  150. <view class="card_item" style="color:#8898A9;">
  151. {{item.position}}
  152. </view>
  153. <view class="card_item2" >
  154. <view style="color:#FF6573;margin-right: 10rpx;">
  155. {{item.price}}
  156. </view>
  157. <view style="display: flex; justify-content: center;align-items: center">
  158. 元/度 起
  159. </view>
  160. </view>
  161. <view class="card_item" style="border-bottom: #F1F4F3; border-bottom-width: 2rpx;border-style: solid;border-top-width: 0rpx;border-left-width: 0rpx;border-right-width:0rpx; padding-bottom:20rpx">
  162. <view style="display: flex;flex-direction: row;">
  163. <view style="background-color: #7DB1FF;padding-left: 10rpx;padding-right: 10rpx;color: #FFFFFF;">
  164. P
  165. </view>
  166. <label>{{item.park}}</label>
  167. </view>
  168. <view style="display: flex;flex-direction: row;">
  169. <view style="color: #00B962;" class="font-weight2">
  170. 空闲{{item.idleNum}}
  171. </view>
  172. <view class="font-weight2">
  173. /总数{{item.total}}
  174. </view>
  175. </view>
  176. </view>
  177. <view class="card_item" style="padding-bottom: 20rpx;">
  178. <u-button shape='circle' style="color: #00B962;" @click="getScanCode" >
  179. <u-icon name="scan" size="26" color="#00B962" style="margin-right: 20rpx;"></u-icon>
  180. <label>扫码充电</label>
  181. </u-button>
  182. <view class="round" @click.stop="navigateTo(item)">
  183. <text class="iconfont distance-font">&#xe615;</text>
  184. <view style="margin-right: 10rpx;">
  185. {{item.distance!=null&&item.distance>0.1 ? item.distance.toFixed(1)+'公里':'小于100米'}}
  186. </view>
  187. <view style="margin-right: 10rpx;">
  188. {{item.time!=null?item.time.toFixed(0):''}}分钟
  189. </view>
  190. </view>
  191. </view>
  192. </view>
  193. </swiper-item>
  194. </swiper>
  195. </view>
  196. </view>
  197. </view>
  198. <Tabbar :current="1" ref="tabbarMain" :elderStatus="elderStatus"></Tabbar>
  199. </view>
  200. </template>
  201. <script>
  202. // import api from './site-index.js'
  203. // export default api
  204. import * as indexAPI from '@/apis/index.js'
  205. import * as api from '@/apis/site.js';
  206. import Chargermap from '@/components/Chargermap.vue';
  207. import DoubleSlider from '@/components/double-slider/DoubleSlider.vue';
  208. import Tabbar from '@/components/Tabbar.vue';
  209. import uniCombox from '@/components/uni-combox/components/uni-combox/uni-combox.vue'
  210. import * as WxJsApi from '@/utils/wxJsApi.js'
  211. //import * as Map from '@/utils/openMap.js'
  212. //import MapLoader from '@/utils/AMap'
  213. //import xflSelect from '@/components/xfl-select/xfl-select.vue'
  214. let _self;
  215. export default {
  216. components: {
  217. Chargermap,
  218. DoubleSlider,
  219. Tabbar,
  220. uniCombox,
  221. // xflSelect
  222. },
  223. data() {
  224. return {
  225. elderStatus: false,
  226. inputStyle:{
  227. backgroundColor: 'transparent',
  228. "font-size":'18px',
  229. "font-weight":"normal"
  230. },
  231. nav_height:88,
  232. elderMode:false,
  233. showCity:false,
  234. showType:false,
  235. showRadius:false,
  236. cities: [ '荆州市'],
  237. radiuses:['1公里','2公里','5公里','10公里','20公里','50公里','100公里','200公里'],
  238. types:['交流快充','直流慢充'],
  239. area: '荆州市',
  240. radius:'',
  241. type:'',
  242. centerImg:'@/static/img/location.png',
  243. currentIndex:-1,
  244. navBarHeight:88,
  245. viewMode: true, //地图
  246. keyword: '',
  247. show: false,
  248. mapopen: false,
  249. isReady: false,
  250. id: '',
  251. longitude: 112.28308,
  252. latitude: 30.312084,
  253. name:'荆鹏软件园',
  254. // longitude: '',
  255. // latitude: '',
  256. nearbyStationInfo: {
  257. nearbyShiftDTOList: []
  258. },
  259. action: '筛选',
  260. preference: {
  261. miles_index: 3,
  262. obc_type_index: 0,
  263. obc_status_index: 0,
  264. obc_voltage_index: 0,
  265. save_preference: false,
  266. obc_power: { minValue: 0, maxValue: 500 }
  267. },
  268. stationsmap:[
  269. /* {name:'荆鹏软件园充电站',position:'湖北省荆州市沙市区江津东路附155号',price:1.2,idle:10,total:10,distance:0.1,time:1,type:'慢充'},
  270. {name:'荆鹏软件园充电站2',position:'湖北省荆州市沙市区江津东路附156号',price:1.2,idle:10,total:10,distance:0.1,time:1,type:'快充'},
  271. {name:'荆鹏软件园充电站3',position:'湖北省荆州市沙市区江津东路附157号',price:1.2,idle:10,total:10,distance:0.1,time:1,type:'慢充'},
  272. {name:'荆鹏大道求助站充电站',position:'湖北省荆州市沙市区江津东路附158号',price:1.2,idle:10,total:10,distance:0.1,time:1,type:'快充'},
  273. */
  274. ],
  275. first:true,
  276. timer:null,
  277. swipping:false,
  278. stationslist:[],
  279. info: {
  280. miles_type: [
  281. { distance: 1, text: '1公里' },
  282. { distance: 2, text: '2公里' },
  283. { distance: 5, text: '5公里' },
  284. { distance: 10, text: '10公里' },
  285. { distance: 20, text: '20公里' },
  286. { distance: 50, text: '50公里' },
  287. { distance: 100, text: '100公里' },
  288. { distance: 200, text: '200公里' }
  289. ],
  290. obc_type: [{ value: 0, text: '直流快充' }, { value: 1, text: '交流慢充' }],
  291. obc_status: [{ value: 0, text: '对外开放' }, { value: 1, text: '不对外开放' }],
  292. obc_voltage: [{ value: 0, text: '低于700V' }, { value: 1, text: '700V及以上' }],
  293. obc_power: { minValue: 0, maxValue: 1000 }
  294. },
  295. userId:'',
  296. };
  297. },
  298. onLoad(op) {
  299. _self = this;
  300. var px = uni.upx2px(172);
  301. this.nav_height = px;
  302. // //('longitude0 ' + _self.longitude);
  303. // //('latitude0 ' + _self.latitude);
  304. if (op != null) {
  305. if (op.longitude != null) this.longitude = op.longitude;
  306. if (op.latitude != null) this.latitude = op.latitude;
  307. if (op.id != null) this.id = op.id;
  308. }
  309. if(this.elderMode)
  310. {
  311. window.document.getElementsByTagName('body')[0].style.setProperty('--theme', 1);
  312. }
  313. //navigation.getPoint();
  314. },
  315. onReady() {
  316. if(this.carhelp.get("getElderModeClass") == "长辈模式") {
  317. this.elderStatus = true;
  318. } else {
  319. this.elderStatus = false;
  320. }
  321. // //('长者模式'+JSON.stringify(this.carhelp.get("getElderModeClass")));
  322. this.elderMode = this.carhelp.get('getElderModeClass') == '长辈模式';
  323. //this.elderMode = true;
  324. if(this.elderMode)
  325. this.theme('elder')
  326. else
  327. this.theme('standard')
  328. if (this.carhelp.getPersonInfo()) {
  329. this.userId = this.carhelp.getPersonInfo().id;
  330. }
  331. let preference = this.carhelp.get('preference',this.preference)
  332. if(preference.save_preference)
  333. {
  334. this.preference = preference;
  335. //('preference'+JSON.stringify(preference))
  336. }
  337. this.types = [];
  338. for(let i = 0;i< this.info.obc_type.length;i++){
  339. this.types.push(this.info.obc_type[i].text);
  340. }
  341. this.radiuses = [];
  342. for(let i = 0;i< this.info.miles_type.length;i++){
  343. this.radiuses.push(this.info.miles_type[i].text);
  344. }
  345. this.type = this.info.obc_type[this.preference.obc_type_index].text;
  346. this.radius = this.info.miles_type[this.preference.miles_index].text;
  347. WxJsApi.getWxConfig(['getLocation', 'addEventListener', 'scanQRCode']).then((res) => {
  348. // //(res)
  349. }).catch(error => {
  350. //(error)
  351. })
  352. // //('longitude2 '+this.longitude)
  353. // //('latitude2 '+this.latitude)
  354. this.$refs.amap.init();
  355. //this.getPositionByLonLats();
  356. // this.$refs.amap.setMyStyle("height:1500rpx;width:100%;");
  357. // this.$refs.amap.setMyStyle("height:calc(100%-176rpx);width:100%;");
  358. // //('longitude3 '+this.longitude)
  359. // //('latitude3 '+this.latitude)
  360. },
  361. onShow() {
  362. if(this.$refs.tabbarMain){
  363. this.$refs.tabbarMain.setcount(1);
  364. }
  365. // //('onShow')
  366. if (this.isReady) {
  367. }
  368. },
  369. onHide(){
  370. this.end();
  371. },
  372. methods: {
  373. updateCitySelector(){
  374. //('updateCitySelector');
  375. this.$refs.type.closeSelector();
  376. this.$refs.radius.closeSelector();
  377. //this.$refs.city.closeSelector();
  378. this.show = false;
  379. },
  380. updateTypeSelector(){
  381. //('updateTypeSelector');
  382. //this.$refs.type.closeSelector();
  383. this.$refs.radius.closeSelector();
  384. this.$refs.city.closeSelector();
  385. this.show = false;
  386. },
  387. updateRadiusSelector(){
  388. //('updateRadiusSelector');
  389. this.$refs.type.closeSelector();
  390. //this.$refs.radius.closeSelector();
  391. this.$refs.city.closeSelector();
  392. this.show = false;
  393. },
  394. updateCity(e){
  395. this.close();
  396. },
  397. updateRadius(e){
  398. this.preference.miles_index = e.value;
  399. this.close();
  400. //('updateRadius'+JSON.stringify(e))
  401. },
  402. updateType(e){
  403. this.preference.obc_type_index = e.value;
  404. this.close();
  405. //('updateType'+JSON.stringify(e))
  406. },
  407. setCenter(){
  408. //('getPoint')
  409. WxJsApi.getLocation().then((res) => {
  410. _self.latitude = parseFloat(res.latitude);
  411. _self.longitude = parseFloat(res.longitude);
  412. //let data = {position:{latitude:latitude,longitude:longitude}};
  413. let posCenter= {longitude: _self.longitude,latitude: _self.latitude};
  414. this.$refs.amap.setCenter(posCenter);
  415. }).catch(error => {
  416. uni.showToast({
  417. title:JSON.stringify(error)
  418. })
  419. })
  420. // //('setCenter')
  421. },
  422. getScanCode() {
  423. if(!this.isEnabled())
  424. return;
  425. if (this.userId) {
  426. WxJsApi.scanQRCode(1).then(res => {
  427. if(res) {
  428. indexAPI.scanCode(res).then((response) => {
  429. }).catch(error => {
  430. uni.showToast({
  431. title: error,
  432. icon: "none"
  433. })
  434. })
  435. }
  436. }).catch(error => {
  437. })
  438. } else {
  439. uni.navigateTo({
  440. url: '/pages/login/login'
  441. })
  442. }
  443. },
  444. //导航
  445. guide(signMap,item) {
  446. let self = this;
  447. if (item.position && item.position != '') {
  448. //景点位置partnerAddress 景点经纬度lng lat
  449. var lng = self.lng;
  450. var lat = self.lat;
  451. if (signMap == 'gd') {
  452. // 高德地图
  453. //('signMap')
  454. if (self.customBrowserVersion().android) {
  455. window.location.href = "androidamap://viewMap?sourceApplication=appname&poiname=" + item.position +
  456. "&lat=" + item.latitude + "&lon=" + item.longitude + "&dev=0";
  457. //判断是否跳转
  458. setTimeout(function () {
  459. let hidden = window.document.hidden || window.document.mozHidden || window.document.msHidden ||
  460. window.document.webkitHidden
  461. if (typeof hidden == "undefined" || hidden == false) {
  462. //调用高德地图
  463. window.location.href = "https://uri.amap.com/marker?position=" + item.longitude + "," + item.latitude +
  464. "&name=" + item.position;
  465. }
  466. }, 2000);
  467. } else if (self.customBrowserVersion().ios) {
  468. window.location.href = "iosamap://viewMap?sourceApplication=appname&poiname=" + item.position +
  469. "&lat=" + item.latitude + "&lon=" + item.longitude + "&dev=0";
  470. //判断是否跳转
  471. setTimeout(function () {
  472. let hidden = window.document.hidden || window.document.mozHidden || window.document.msHidden ||
  473. window.document.webkitHidden
  474. if (typeof hidden == "undefined" || hidden == false) {
  475. //调用高德地图
  476. window.location.href = "https://uri.amap.com/marker?position=" + item.longitude + "," + item.latitude +
  477. "&name=" + item.position;
  478. }
  479. }, 2000);
  480. }
  481. } else if (signMap == 'bd') {
  482. // 百度地图
  483. if (self.customBrowserVersion().android) {
  484. //安卓操作系统
  485. let d = new Date();
  486. let t0 = d.getTime();
  487. window.location.href = "androidamap://viewMap?sourceApplication=appname&poiname=" + item.position+
  488. "&lat=" + item.latitude + "&lon=" + item.longitude + "&dev=0";
  489. //由于打开需要1~2秒,利用这个时间差来处理--打开app后,返回h5页面会出现页面变成app下载页面,影响用户体验
  490. var delay = setInterval(function () {
  491. var d = new Date();
  492. var t1 = d.getTime();
  493. if (t1 - t0 < 3000 && t1 - t0 > 2000) {
  494. window.location.href = "http://api.map.baidu.com/marker?location=" + item.latitude + "," +
  495. item.longitude + "&title=" + item.position +
  496. "&content=充电桩&output=html&src=webapp.baidu.openAPIdemo";
  497. }
  498. if (t1 - t0 >= 3000) {
  499. clearInterval(delay);
  500. }
  501. }, 1000);
  502. }
  503. if (self.customBrowserVersion().ios) {
  504. //ios操作系统
  505. let d = new Date();
  506. let t0 = d.getTime();
  507. window.location.href = "iosamap://viewMap?sourceApplication=appname&poiname=" + self.partnerAddress +
  508. "&lat=" + lat + "&lon=" + lng + "&dev=0";
  509. //由于打开需要1~2秒,利用这个时间差来处理--打开app后,返回h5页面会出现页面变成app下载页面,影响用户体验
  510. let delay = setInterval(function () {
  511. var d = new Date();
  512. var t1 = d.getTime();
  513. if (t1 - t0 < 3000 && t1 - t0 > 2000) {
  514. window.location.href = "http://api.map.baidu.com/marker?location=" + item.latitude + "," +
  515. item.longitude + "&title=" + item.position +
  516. "&content=充电桩&output=html&src=webapp.baidu.openAPIdemo";
  517. }
  518. if (t1 - t0 >= 3000) {
  519. clearInterval(delay);
  520. }
  521. }, 1000);
  522. }
  523. }
  524. } else {
  525. uni.showToast({
  526. title:'暂时不知道充电桩位置'
  527. })
  528. }
  529. },
  530. //区分设备
  531. customBrowserVersion() {
  532. var u = navigator.userAgent;
  533. return {
  534. trident: u.indexOf('Trident') > -1, //IE内核
  535. presto: u.indexOf('Presto') > -1, //opera内核
  536. webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
  537. gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
  538. mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
  539. ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
  540. android: u.indexOf('Android') > -1 || u.indexOf('Adr') > -1, //android终端
  541. iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
  542. iPad: u.indexOf('iPad') > -1, //是否iPad
  543. webApp: u.indexOf('Safari') == -1, //是否web应用程序,没有头部与底部
  544. weixin: u.indexOf('MicroMessenger') > -1, //是否微信 (2015-01-22新增)
  545. qq: u.match(/\sQQ/i) == " qq", //是否QQ
  546. isBaidu: u.indexOf('baiduboxapp') !== -1, //是否为百度浏览器
  547. isqqBrowser: u.indexOf('mqqbrowser') !== -1, //是否为qq浏览器
  548. isWxBrowser: u.indexOf('micromessenger') !== -1, //是否为微信浏览器
  549. isUc: u.indexOf('ucbrowser') !== -1, //是否为uc浏览器
  550. };
  551. },
  552. navigateTo(item){
  553. /*
  554. this.elderMode = !this.elderMode;
  555. if(this.elderMode)
  556. this.theme('elder')
  557. else
  558. this.theme('standard')
  559. return;
  560. */
  561. //this.guide('gd',item);
  562. ////('导航'+JSON.stringify(item))
  563. window.location.href="https://uri.amap.com/marker?position="+ item.longitude+","+item.latitude+"&name="+item.name;
  564. //Map.getRoute(item);
  565. //Map.openMap(this.latitude, this.longitude, this.name, 'wgs84')
  566. //var startLngLat = [this.longitude, this.latitude]
  567. //var endLngLat = [item.longitude, item.latitude]
  568. ///let platform = uni.getSystemInfoSync().platform
  569. ////('platform'+JSON.stringify(platform))
  570. //this.$refs.amap.navigate(startLngLat,endLngLat);
  571. },
  572. navigate(){
  573. //('naviage to ')
  574. uni.navigateTo({
  575. url:'/pages/search/search'
  576. })
  577. },
  578. getPoint() {
  579. // //('getPoint')
  580. WxJsApi.getLocation().then((res) => {
  581. var latitude = parseFloat(res.latitude);
  582. var longitude = parseFloat(res.longitude);
  583. let data = {position:{latitude:latitude,longitude:longitude}};
  584. _self.location(data);
  585. if(_self.first)
  586. {
  587. var obj = {
  588. longitude: longitude,
  589. latitude: latitude
  590. };
  591. this.$refs.amap.setPerson(obj);
  592. //let data = {latitude:latitude,longtitude:longitude};
  593. //this.getChargingStationData(data);
  594. this.getNearbyStationInfo();
  595. _self.first = false;
  596. //this.$refs.amap.listenMove();
  597. }
  598. //('当前位置' +JSON.stringify(data))
  599. //this.latitude2 = latitude;
  600. //this.longitude2 = longitude;
  601. /*uni.showToast({
  602. title:JSON.stringify(res)
  603. })*/
  604. //this.message=JSON.stringify(res)
  605. }).catch(error => {
  606. uni.showToast({
  607. title:JSON.stringify(error)
  608. })
  609. })
  610. },
  611. start() {
  612. let self = this;
  613. // 将定时器名字赋值到变量中
  614. this.timer = setInterval(() => {
  615. ////("开始---");
  616. //self.$refs.amap.getLocation1();
  617. //self.$refs.amap.getLocation ();
  618. }, 10000);
  619. },
  620. end() {
  621. clearInterval(this.timer);
  622. this.timer = null // 这里最好清除一下,回归默认值
  623. // 众所周知,定时器返回一个随机整数,用于表示定时器的编号,后面通过名字可以取消这个定时器的执行。
  624. //(this.timer);
  625. },
  626. isEnabled(){
  627. if(this.viewMode)
  628. {
  629. if(this.show)
  630. return false;
  631. }
  632. return true;
  633. },
  634. stationDetail(item){
  635. if(!this.isEnabled())
  636. return;
  637. //('stationDetail'+JSON.stringify(item))
  638. uni.navigateTo({
  639. url:'stationAndPile/stationDetails?id='+item.id
  640. })
  641. /*
  642. uni.navigateTo({
  643. url:'stationAndPile/stationDetails?station='+encodeURIComponent(JSON.stringify(item))
  644. })
  645. */
  646. // //('stationDetail'+JSON.stringify(item))
  647. },
  648. location(e){
  649. if(e.position){
  650. //this.$refs.amap.getPositionByLonLats(e.position);
  651. if(e.position.latitude && e.position.longitude)
  652. if(this.latitude != e.position.latitude ||
  653. this.longitude != e.position.longitude)
  654. {
  655. this.longitude = e.position.longitude;
  656. this.latitude = e.position.latitude;
  657. let data = {latitude:this.latitude,longtitude:this.longitude,findType:"1"};
  658. this.getChargingStationData(data);
  659. //('获取定位'+JSON.stringify(e));
  660. }
  661. }
  662. },
  663. getChargingStationData(pos){
  664. //return;
  665. if(pos == null)
  666. return ;
  667. // //('getChargingStationData'+JSON.stringify(pos))
  668. let data1 = { pageIndex:0,pageSize:20};
  669. if(this.info.obc_type[this.preference.obc_type_index].text.indexOf('直流快充')>=0)
  670. data1.type = "1";
  671. else if(this.info.obc_type[this.preference.obc_type_index].text.indexOf('交流慢充')>=0)
  672. data1.type = "2";
  673. if(pos.longtitude != null)
  674. data1.longitude = pos.longtitude.toString();
  675. if(pos.latitude != null)
  676. data1.latitude = pos.latitude.toString();
  677. if(this.info.miles_type[this.preference.miles_index].distance!=null)
  678. data1.radius = this.info.miles_type[this.preference.miles_index].distance.toString();
  679. //data1.online = "0";//在线
  680. if(pos.findType != null)
  681. data1.findType = pos.findType;
  682. else
  683. data1.findType = "0";
  684. if(data1.findType == "0")
  685. {
  686. // //('getChargingStationData res1'+JSON.stringify(res));
  687. _self.currentIndex = -1;
  688. _self.stationsmap = [];
  689. }else{
  690. _self.stationslist = [];
  691. }
  692. /*
  693. if(this.preference.obc_power.minValue!=null)
  694. data1.powerStart = this.preference.obc_power.minValue.toString();
  695. if(this.preference.obc_power.maxValue!=null)
  696. data1.powerEnd = this.preference.obc_power.maxValue.toString();
  697. */
  698. // //('data1'+JSON.stringify(data1))
  699. api.getChargingStationData(data1).then(function(res){
  700. // //('data1'+JSON.stringify(res))
  701. if(!res.result || !res.data || !res.data.data)
  702. {
  703. //('getChargingStationData res nulll')
  704. return;
  705. }
  706. let items = res.data.data;
  707. if(data1.findType == "0")
  708. {
  709. // //('getChargingStationData res1'+JSON.stringify(res));
  710. // _self.currentIndex = -1;
  711. // _self.stationsmap = [];
  712. //let stations = [];
  713. for(let i = 0;i<items.length;i++)
  714. {
  715. let obj = {
  716. name:'',
  717. position:'',
  718. price:1.2,
  719. idleNum:10,
  720. total:10,
  721. type: data1.type == "2" ? '慢充':'快充',
  722. id: i,
  723. distance:0.9,
  724. time:9,
  725. park: '2小时免费停车',
  726. // longitude: 112.28541 + i * 0.001,
  727. // latitude: 30.308354 + i * 0.01
  728. };
  729. if(items[i].id != null)
  730. obj.id = items[i].id;
  731. else
  732. continue;
  733. if(items[i].type.indexOf("1")>=0 && items[i].type.indexOf("2")>=0)
  734. {
  735. obj.type = '快/慢'
  736. }
  737. if(items[i].name!=null)
  738. obj.name = items[i].name;
  739. if(items[i].address!=null)
  740. obj.position = items[i].address;
  741. if(items[i].costPrice!=null)
  742. obj.price = items[i].costPrice;
  743. if(items[i].availableNum!=null)
  744. obj.idleNum = items[i].availableNum;
  745. if(items[i].totalNum!=null)
  746. obj.total = items[i].totalNum;
  747. if(items[i].longitude!=null)
  748. obj.longitude = items[i].longitude;
  749. if(items[i].latitude!=null)
  750. obj.latitude = items[i].latitude;
  751. if(items[i].distance!=null)
  752. obj.distance = items[i].distance;
  753. if(items[i].time != null){
  754. obj.time = items[i].time;
  755. }
  756. if(items[i].park != null)
  757. obj.park = items[i].park;
  758. /*
  759. let obj = {name:items[i].name,
  760. position:items[i].address,
  761. price:items[i].costPrice,
  762. idleNum:items[i].availableNum,
  763. total:items[i].totalNum,
  764. distance:0.1,
  765. time:1,
  766. type:'慢充',
  767. id: items[i].id,
  768. park: i%2 == 0? '以实际费用为准':'2小时免费停车',
  769. longitude: items[i].longitude,
  770. latitude: items[i].latitude
  771. };*/
  772. _self.stationsmap.push(obj);
  773. //stations.push(obj);
  774. }
  775. _self.$refs.amap.calcDistances([_self.longitude, _self.latitude],_self.stationsmap)
  776. _self.$refs.amap.setChargerList(_self.stationsmap);
  777. _self.currentIndex = 0;
  778. //if(_self.stationsmap.length>0)
  779. /*_self.$refs.amap.calcDistances([_self.longitude, _self.latitude],stations)
  780. _self.stationsmap = stations;
  781. _self.$refs.amap.setChargerList(stations);*/
  782. if(_self.stationsmap.length>0)
  783. {
  784. //('刷新Map'+JSON.stringify(_self.stationsmap));
  785. _self.$refs.amap.updateCharger(_self.stationsmap[0]);
  786. //let index = _self.stationsmap.findIndex(item => item.id == _self.stationsmap[0].id);
  787. //('刷新Map Index'+ _self.currentIndex)
  788. }
  789. }else if(data1.findType == "1")
  790. {
  791. _self.stationslist = [];
  792. // //('getChargingStationData res2'+JSON.stringify(res));
  793. for(let i = 0;i<items.length;i++)
  794. {
  795. let obj = {
  796. name:'',
  797. position:'',
  798. price:1.2,
  799. idleNum:10,
  800. total:10,
  801. type: data1.type == "2" ? '慢充':'快充',
  802. id: i,
  803. distance:0.9,
  804. time:9,
  805. park: '以实际费用为准',
  806. // longitude: 112.28541 + i * 0.001,
  807. // latitude: 30.308354 + i * 0.01
  808. };
  809. if(items[i].id != null)
  810. obj.id = items[i].id;
  811. else
  812. continue;
  813. if(items[i].type.indexOf("1")>=0 && items[i].type.indexOf("2")>=0)
  814. {
  815. obj.type = '快/慢'
  816. }
  817. if(items[i].name!=null)
  818. obj.name = items[i].name;
  819. if(items[i].address!=null)
  820. obj.position = items[i].address;
  821. if(items[i].costPrice!=null)
  822. obj.price = items[i].costPrice;
  823. if(items[i].availableNum!=null)
  824. obj.idleNum = items[i].availableNum;
  825. if(items[i].totalNum!=null)
  826. obj.total = items[i].totalNum;
  827. if(items[i].longitude!=null)
  828. obj.longitude = items[i].longitude;
  829. if(items[i].latitude!=null)
  830. obj.latitude = items[i].latitude;
  831. if(items[i].distance!=null)
  832. obj.distance = items[i].distance;
  833. if(items[i].time != null){
  834. obj.time = items[i].time;
  835. }
  836. if(items[i].park != null)
  837. obj.park = items[i].park;
  838. //arr.push(obj);
  839. _self.stationslist.push(obj);
  840. }
  841. _self.$refs.amap.calcDistances([_self.longitude, _self.latitude],_self.stationslist)
  842. // //(' getChargingStationData stations'+JSON.stringify(_self.stationslist))
  843. }
  844. },function(err){
  845. //('getChargingStationData err'+JSON.stringify(err))
  846. }
  847. )
  848. // //('getChargingStationData end')
  849. },
  850. /*
  851. charge(item){
  852. //('扫码充电')
  853. //#ifdef MP-WEIXIN
  854. uni.scanCode({
  855. success:function(res){
  856. uni.navigateTo({
  857. url:'chargingPileDetails?pile='+encodeURIComponent(JSON.stringify(data))
  858. })
  859. }
  860. })
  861. return;
  862. //#endif
  863. //('扫码充电1')
  864. uni.navigateTo({
  865. url:'stationAndPile/chargingPileDetails'
  866. })
  867. }, */
  868. moveEnd(e){
  869. //('moveEnd')
  870. this.close_all();
  871. let posCenter = this.$refs.amap.logMapInfo();
  872. ////('posCenter'+JSON.stringify(posCenter))
  873. let data = {latitude:e.center.lat,longtitude:e.center.lng};
  874. this.getChargingStationData(data);
  875. },
  876. moveStart(e){
  877. this.close_all();
  878. },
  879. clickTabItem (index) {
  880. //('clickTabaItem'+JSON.stringify(index));
  881. this.currentIndex = index
  882. },
  883. swiperChange (e) {
  884. //('swiperChange currentIndex'+JSON.stringify(this.currentIndex))
  885. //('swiperChange'+JSON.stringify(e))
  886. this.currentIndex = e.detail.current
  887. let station = this.stationsmap[this.currentIndex];
  888. let posCenter= {longitude: station.longitude,latitude: station.latitude};
  889. // //('currentIndex'+JSON.stringify(this.currentIndex))
  890. // //('currentIndex'+JSON.stringify(posCenter))
  891. // //('station'+JSON.stringify(station))
  892. let bounds = this.$refs.amap.logMapInfo();
  893. /*if( (posCenter.latitude<bounds.bounds.northeast.lat && posCenter.latitude>bounds.bounds.sourthwest.lat)
  894. && (posCenter.longitude<bounds.bounds.northeast.lng && posCenter.longitude>bounds.bounds.sourthwest.lng)
  895. ){
  896. //('bounds'+JSON.stringify(bounds));
  897. }else{
  898. this.$refs.amap.setCenter(posCenter);
  899. }*/
  900. this.$refs.amap.updateCharger(station);
  901. this.$refs.amap.setCenter(posCenter);
  902. },
  903. swiperTransitionEnd(e){
  904. //('swiperTransitionEnd'+JSON.stringify(e))
  905. },
  906. swiperTransition (e) {
  907. // //('swiperTransition'+JSON.stringify(e))
  908. },
  909. listMode() {
  910. this.close_all();
  911. this.viewMode = false
  912. },
  913. mapMode() {
  914. this.close_all();
  915. this.viewMode = true
  916. },
  917. radioChange(e) {
  918. // //('e'+JSON.stringify(e))
  919. this.preference.save_preference = e.value;
  920. // //('save_preference '+this.preference.save_preference);
  921. },
  922. handlerDoubleSlider(e) {
  923. // //('e'+JSON.stringify(e))
  924. this.preference.obc_power = e;
  925. //this.preference.obc_power.minValue = e.minValue;
  926. //this.preference.obc_power.maxValue = e.maxValue;
  927. },
  928. selectOBSType(index) {
  929. this.preference.obc_type_index = index;
  930. },
  931. selectOBSStatus(index) {
  932. this.preference.obc_status_index = index;
  933. },
  934. selectOBCVoltage(index) {
  935. this.preference.obc_voltage_index = index;
  936. },
  937. selectMiles(index) {
  938. this.preference.miles_index = index;
  939. },
  940. reset() {
  941. this.preference.obc_status_index = 0;
  942. this.preference.obc_voltage_index = 0;
  943. this.preference.obc_type_index = 0;
  944. this.preference.miles_index = 3;
  945. this.preference.save_preference = false;
  946. // this.$refs.obc_voltage.currentValue = [0,100];
  947. this.preference.obc_power.minValue = 0;
  948. this.preference.obc_power.maxValue = 500;
  949. this.preference.obc_power.minP = Math.floor((this.preference.obc_power.minValue / (this.info.obc_power.maxValue - this.info.obc_power.minValue)) * 100);
  950. this.preference.obc_power.maxP = Math.floor((this.preference.obc_power.maxValue / (this.info.obc_power.maxValue - this.info.obc_power.minValue)) * 100);
  951. // //('minP'+this.preference.obc_power.minP)
  952. // //('maxP'+this.preference.obc_power.maxP)
  953. this.$refs.obc_voltage.reset(this.preference.obc_power);
  954. // this.$refs.obc_voltage.currentMaxValue = this.preference.obc_power[1];
  955. // //('reset')
  956. },
  957. close_all(){
  958. this.$refs.type.closeSelector();
  959. this.$refs.radius.closeSelector();
  960. this.$refs.city.closeSelector();
  961. this.show = false;
  962. },
  963. open() {
  964. this.$refs.type.closeSelector();
  965. this.$refs.radius.closeSelector();
  966. this.$refs.city.closeSelector();
  967. this.show = !this.show;
  968. //this.$refs.obc_voltage.currentMinValue = this.preference.obc_power[0];
  969. //this.$refs.obc_voltage.currentMaxValue = this.preference.obc_power[1];
  970. //('open');
  971. },
  972. close() {
  973. //('偏好设置' + JSON.stringify(this.preference));
  974. this.close_all();
  975. // this.show = false;
  976. let data = {latitude:this.latitude,longtitude:this.longitude};
  977. this.type = this.info.obc_type[this.preference.obc_type_index].text;
  978. this.radius = this.info.miles_type[this.preference.miles_index].text;
  979. if(this.preference.save_preference)
  980. this.carhelp.set('preference',this.preference)
  981. this.getChargingStationData(data);
  982. this.stationslist = this.stationsmap;
  983. // //('close');
  984. },
  985. onClicked(e){
  986. this.close_all();
  987. ////('onClicked e'+JSON.stringify(e))
  988. },
  989. // 获取当前位置
  990. clickMap(obj) {
  991. this.show=false;
  992. //this.currentIndex = 5;
  993. // //('longitude1 ' + _self.longitude);
  994. // //('latitude1 ' + _self.latitude);
  995. if (obj == null || obj.type == null) return;
  996. if (obj.type == 'charger') {
  997. if (obj.obj != null) {
  998. //_self.$refs.amap.updateCharger(obj.obj);
  999. let index = _self.stationsmap.findIndex(item => item.id == obj.obj.id);
  1000. _self.currentIndex = index;
  1001. //('find Index'+index);
  1002. }
  1003. /*api.getChargerInfoById(obj).then(
  1004. function(data) {
  1005. if (obj.obj != null) {
  1006. //obj.obj.price = 2.25;
  1007. //obj.obj.idleNum = 12;
  1008. _self.$refs.amap.updateCharger(obj.obj);
  1009. let index = _self.stationsmap.findIndex(item => item.id == obj.obj.id);
  1010. _self.currentIndex = index;
  1011. //('find Index'+index);
  1012. }
  1013. // //('点击1'+JSON.stringify(obj));
  1014. },
  1015. function(err) {
  1016. //('点击2' + JSON.stringify(obj));
  1017. }
  1018. );*/
  1019. }
  1020. },
  1021. mapdown() {
  1022. ////('this'+JSON.stringify(this))
  1023. // //('longitude1 ' + this.longitude);
  1024. // //('latitude1 ' + this.latitude);
  1025. //this.start();
  1026. //this.$refs.amap.getLocation1();
  1027. this.getNearbyStationInfo();
  1028. this.isReady = true;
  1029. //this.$refs.amap.getLocation ();
  1030. //let state = {};
  1031. uni.getSystemInfo({
  1032. success: (res) => {
  1033. // #ifndef MP
  1034. let navbarH = 0
  1035. // #endif
  1036. // #ifdef MP
  1037. let navbarH = uni.upx2px(90)
  1038. // #endif
  1039. /*state.status_width = res.windowWidth;
  1040. //('window width'+state.status_width);*/
  1041. let scrollH = res.windowHeight;// - uni.upx2px(88) - navbarH
  1042. let scrollW = res.windowWidth;
  1043. // //('布局结果'+ JSON.stringify(res));
  1044. // //('scrollW'+scrollW)
  1045. //#ifdef MP-WEIXIN
  1046. const {
  1047. statusBarHeight,
  1048. windowWidth,
  1049. } = uni.getSystemInfoSync();
  1050. scrollW = windowWidth;
  1051. // //('height ' + statusBarHeight);
  1052. //this.status_height = uni.getStatusbarHeight();
  1053. let res1 = uni.getMenuButtonBoundingClientRect()
  1054. // //('layout selectHeight '+JSON.stringify(res1))
  1055. //state.selectHeight = (res1.top-res.statusBarHeight)*2+ res1.height;
  1056. //#endif
  1057. ////('status height'+state.status_height)
  1058. _self.$refs.amap.setMyStyle("height:"+(scrollH-88-50)+ "px;width:"+scrollW+"px;");
  1059. }
  1060. })
  1061. this.getPoint();
  1062. },
  1063. gotoLine(item, downid) {
  1064. uni.navigateTo({
  1065. url: '/pages/route/index?id=' + item.routeId + '&upid=' + item.startStationId + '&downid=' + downid
  1066. });
  1067. },
  1068. mapopenBtn() {
  1069. this.mapopen = !this.mapopen;
  1070. if (this.mapopen) {
  1071. this.$refs.amap.setMyStyle('width: 100%; height: 340px;');
  1072. } else {
  1073. this.$refs.amap.setMyStyle('width: 100%; height: 140px;');
  1074. }
  1075. },
  1076. getNearbyStationInfo() {
  1077. let data1 = {latitude:this.latitude,longtitude:this.longitude,findType:"1"};
  1078. this.getChargingStationData(data1);
  1079. let data2 = {latitude:this.latitude,longtitude:this.longitude,findType:"0"};
  1080. this.getChargingStationData(data2);
  1081. },
  1082. theme(type) {
  1083. if(type == 'elder')
  1084. {
  1085. document.getElementsByTagName('body')[0].setAttribute('data-theme',type);
  1086. let data = {
  1087. backgroundColor: 'transparent',
  1088. "font-size":'36rpx',
  1089. "font-weight":"bold!important"
  1090. };
  1091. this.inputStyle = data;
  1092. }
  1093. else
  1094. {
  1095. document.getElementsByTagName('body')[0].setAttribute('data-theme',type);
  1096. let data ={
  1097. backgroundColor: 'transparent',
  1098. "font-size":'36rpx',
  1099. "font-weight":"normal"
  1100. };
  1101. this.inputStyle = data;
  1102. }
  1103. }
  1104. }
  1105. };
  1106. </script>
  1107. <style lang="scss" scoped>
  1108. @import "@/_theme.scss";
  1109. .uni-combox__no-border{
  1110. white-space: nowrap;
  1111. }
  1112. .u-mask {
  1113. position: fixed;
  1114. left: 0;
  1115. top: 576px;
  1116. }
  1117. .content-s{
  1118. height: 440px;
  1119. overflow-y:scroll;
  1120. }
  1121. .cj-slider {
  1122. width: 90%;
  1123. margin: auto;
  1124. }
  1125. .cj-slide__text {
  1126. text-align: center;
  1127. padding: 20rpx;
  1128. }
  1129. .preference_group_item {
  1130. padding: 15rpx;
  1131. }
  1132. .preference_group {
  1133. padding-bottom: 20rpx;
  1134. }
  1135. .preference {
  1136. background-color: #ffffff;
  1137. left: 0rpx;
  1138. position: absolute
  1139. }
  1140. .preference_item {
  1141. margin-bottom: 10rpx;
  1142. margin-left: 20rpx;
  1143. text-align: center;
  1144. border-style: none;
  1145. width: 20%;
  1146. height: 56rpx;
  1147. @include themeify{
  1148. font-size: themed('font-size1');
  1149. line-height: themed('font-size2');
  1150. }
  1151. /* line-height: 14px;*/
  1152. }
  1153. .preference_item_medium {
  1154. margin-bottom: 10rpx;
  1155. margin-left: 20rpx;
  1156. text-align: center;
  1157. border-style: none;
  1158. width: 22%;
  1159. height: 56rpx;
  1160. @include themeify{
  1161. font-size: themed('font-size1');
  1162. line-height: themed('font-size2');
  1163. }
  1164. /* line-height: 14px;*/
  1165. }
  1166. .preference_item_plus {
  1167. margin-bottom: 10rpx;
  1168. margin-left: 20rpx;
  1169. align-items: center;
  1170. justify-content: center;
  1171. text-align: center;
  1172. width: 28%;
  1173. border-style: none;
  1174. height: 56rpx;
  1175. @include themeify{
  1176. font-size: themed('font-size1');
  1177. line-height: themed('font-size2');
  1178. }
  1179. /* line-height: 14px;*/
  1180. }
  1181. .preference_label {
  1182. @include themeify{
  1183. color:themed('font_colorLabel');
  1184. font-size: themed('font-size1');
  1185. font-weight: themed('fontWeight');
  1186. }
  1187. margin-left: 20rpx;
  1188. margin-bottom: 100rpx;
  1189. }
  1190. .pre-btn{
  1191. width: 100%;
  1192. height: 96rpx;
  1193. z-index: 999;
  1194. }
  1195. .btn-1,.btn-2{
  1196. height: 96rpx;
  1197. line-height: 96rpx;
  1198. text-align: center;
  1199. border-top: 1px solid rgba(225, 228, 232, 100);
  1200. }
  1201. .map{
  1202. background-color: #ffffff;
  1203. left: 0rpx;
  1204. position: absolute;
  1205. }
  1206. .chargerCard{
  1207. /* background-color: #fff;
  1208. margin: 0 12px;
  1209. border-radius: 8px;
  1210. padding: 10px 12px 0px;
  1211. position: absolute;
  1212. bottom: 68px;
  1213. left: 0;
  1214. right: 0;
  1215. z-index:1021
  1216. */
  1217. background-color: #fff;
  1218. margin: 0 24rpx;
  1219. border-radius: 16rpx;
  1220. padding: 20rpx 24rpx 0rpx;
  1221. bottom: 68px;
  1222. left: 0;
  1223. right: 0;
  1224. position: fixed;
  1225. @include themeify{
  1226. height:themed('cardHeight');
  1227. }
  1228. /*
  1229. z-index: 1021;
  1230. width: 80%;
  1231. margin-left: 10%;
  1232. bottom: 50rpx;
  1233. */
  1234. }
  1235. .arrow{
  1236. margin-right: 15rpx;
  1237. }
  1238. .card_item{
  1239. display: flex;
  1240. flex-direction: row;
  1241. @include themeify{
  1242. font-size: themed('font-size2');
  1243. }
  1244. justify-content: space-between;
  1245. margin-left: 20rpx;
  1246. margin-right: 20rpx;
  1247. margin-bottom: 10rpx;
  1248. }
  1249. .card_item2{
  1250. display: flex;
  1251. flex-direction: row;
  1252. @include themeify{
  1253. font-size: themed('font-size2');
  1254. }
  1255. margin-left: 20rpx;
  1256. margin-right: 20rpx;
  1257. margin-bottom: 10rpx;
  1258. }
  1259. .round{
  1260. border-radius:50rpx;
  1261. background-color: #00B962;
  1262. color: #ffffff;
  1263. text-align: center;
  1264. justify-content: center;
  1265. align-items: center;
  1266. @include themeify{
  1267. font-size: themed('font-size2');
  1268. width:themed('buttonWidth')
  1269. }
  1270. /* width: 250rpx;*/
  1271. display: flex;
  1272. flex-direction: row;
  1273. }
  1274. .round2{
  1275. border-radius:50rpx;
  1276. background-color: #00B962;
  1277. color: #ffffff;
  1278. text-align: center;
  1279. justify-content: center;
  1280. align-items: center;
  1281. width:125rpx;
  1282. }
  1283. .swiper-item{
  1284. }
  1285. .list {
  1286. margin-left: 4rpx;
  1287. }
  1288. .charing-slow {
  1289. background-color: #fff;
  1290. margin: 40rpx;
  1291. border-radius: 16rpx;
  1292. padding: 20rpx 24rpx 0rpx;
  1293. position: relative;
  1294. left: 0;
  1295. right: 0;
  1296. }
  1297. .fast-charge {
  1298. display: inline-block;
  1299. /* width: 44px;
  1300. height: 20px;
  1301. line-height: 20px;*/
  1302. border-radius: 100rpx;
  1303. background-color: #9d9fff;
  1304. color: rgba(255, 255, 255, 100);
  1305. @include themeify{
  1306. width: themed('font-size17');
  1307. font-size: themed('font-size1');
  1308. line-height: themed('font-size5');
  1309. height: themed('font-size5');
  1310. }
  1311. text-align: center;
  1312. }
  1313. .fast-trickle-charge {
  1314. display: inline-block;
  1315. /* width: 66px;
  1316. height: 20px;
  1317. line-height: 20px;*/
  1318. border-radius: 100rpx;
  1319. background-color: #00BAC8;
  1320. color: rgba(255, 255, 255, 100);
  1321. @include themeify{
  1322. width: themed('font-size17');
  1323. font-size: themed('font-size1');
  1324. line-height: themed('font-size5');
  1325. height: themed('font-size5');
  1326. }
  1327. text-align: center;
  1328. }
  1329. .trickle-charge {
  1330. display: inline-block;
  1331. /* width: 44px;
  1332. height: 20px;
  1333. line-height: 20px;*/
  1334. border-radius: 100rpx;
  1335. background-color: rgba(0, 185, 98, 100);
  1336. color: rgba(255, 255, 255, 100);
  1337. @include themeify{
  1338. width: themed('font-size17');
  1339. font-size: themed('font-size1');
  1340. line-height: themed('font-size5');
  1341. height: themed('font-size5');
  1342. }
  1343. text-align: center;
  1344. }
  1345. .station-items {
  1346. display: inline-block;
  1347. /* height: 16px;
  1348. line-height: 16px;*/
  1349. @include themeify{
  1350. font-size: themed('font-size3');
  1351. font-weight: themed('fontWeight');
  1352. line-height: themed('font-size3');
  1353. height: themed('font-size3');
  1354. }
  1355. /* font-size: 16px;*/
  1356. margin-left: 8rpx;
  1357. color: #101010;
  1358. }
  1359. .fast-charge {
  1360. display: inline-block;
  1361. /* width: 44px;
  1362. height: 20px;
  1363. line-height: 20px;*/
  1364. border-radius: 50px;
  1365. background-color: #9d9fff;
  1366. color: rgba(255, 255, 255, 100);
  1367. /* font-size: 12px;*/
  1368. @include themeify{
  1369. width: themed('font-size17');
  1370. font-size: themed('font-size1');
  1371. line-height: themed('font-size5');
  1372. height: themed('font-size5');
  1373. }
  1374. text-align: center;
  1375. }
  1376. .address {
  1377. margin-top: 16rpx;
  1378. /* line-height: 16px;*/
  1379. @include themeify{
  1380. font-size: themed('font-size1');
  1381. line-height: themed('font-size3');
  1382. }
  1383. /* font-size: 11px;*/
  1384. color: rgba(119, 119, 119, 100);
  1385. }
  1386. .price {
  1387. display: flex;
  1388. height: 40rpx;
  1389. }
  1390. .num {
  1391. /* height: 20px;*/
  1392. color: rgba(255, 98, 0, 100);
  1393. /* font-size: 20px;*/
  1394. @include themeify{
  1395. font-size: themed('font-size5');
  1396. height: themed('font-size5');
  1397. }
  1398. text-align: left;
  1399. font-family: Roboto-medium;
  1400. }
  1401. .unit {
  1402. /* height: 14px;
  1403. line-height: 14px;*/
  1404. color: rgba(102, 102, 102, 100);
  1405. @include themeify{
  1406. font-size: themed('font-size2');
  1407. height: themed('font-size2');
  1408. line-height: themed('font-size2');
  1409. }
  1410. /* font-size: 14px;*/
  1411. text-align: left;
  1412. font-family: AlibabaPuHui-regular;
  1413. margin-top: 12rpx;
  1414. margin-left: 8rpx;
  1415. }
  1416. .park {
  1417. margin-top: 16rpx;
  1418. display: flex;
  1419. }
  1420. .park-p {
  1421. display: inline-block;
  1422. width: 20px;
  1423. /* height: 18px;
  1424. line-height: 12px;*/
  1425. @include themeify{
  1426. line-height: themed('font-size1');
  1427. height: themed('font-size4');
  1428. }
  1429. text-align: center;
  1430. background-color: rgba(125, 177, 255, 100);
  1431. color: #fff;
  1432. }
  1433. .park-text {
  1434. display: inline-block;
  1435. width: 300px;
  1436. /* height: 17px;*/
  1437. color: rgba(102, 102, 102, 100);
  1438. @include themeify{
  1439. font-size: themed('font-size1');
  1440. height:themed('font-size4');
  1441. }
  1442. /* font-size: 12px;*/
  1443. text-align: left;
  1444. margin-left: 4px;
  1445. margin-top: 2px;
  1446. }
  1447. .map {
  1448. width: 100%;
  1449. height: 100%;
  1450. position: relative;
  1451. }
  1452. #container {
  1453. width: 100%;
  1454. height: 100%;
  1455. }
  1456. .free {
  1457. display: flex;
  1458. justify-content: space-between;
  1459. height: 52px;
  1460. border-top: 1px solid rgba(238, 242, 240, 100);
  1461. margin-top: 10px;
  1462. }
  1463. .free-num {
  1464. line-height: 52px;
  1465. @include themeify{
  1466. font-size: themed('font-size3');
  1467. font-weight: themed('fontWeight');
  1468. }
  1469. /* font-size: 16px*/
  1470. }
  1471. .distance {
  1472. width: 130px;
  1473. /* height: 28px;
  1474. line-height: 28px;*/
  1475. color: rgba(255, 255, 255, 100);
  1476. @include themeify{
  1477. font-size: themed('font-size2');
  1478. line-height: themed('font-size9');
  1479. height: themed('font-size9');
  1480. }
  1481. /*
  1482. font-size: 14px;*/
  1483. background-color: #00b962;
  1484. border-radius: 50px;
  1485. margin: 12px;
  1486. text-align: center;
  1487. }
  1488. .distance-font {
  1489. @include themeify{
  1490. font-size: themed('font-size3');
  1491. }
  1492. /* font-size: 16px*/
  1493. }
  1494. .position{
  1495. color: #1677ff;
  1496. @include themeify{
  1497. font-size: themed('font-size2');
  1498. }
  1499. /* font-size: 14px*/
  1500. }
  1501. .position-box{
  1502. position:absolute;
  1503. top: 341px;
  1504. right: 118px;
  1505. width: 16px;
  1506. height: 16px;
  1507. /* line-height: 20px; */
  1508. background-color: rgba(22, 119, 255, 100);
  1509. text-align: center;
  1510. box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.4);
  1511. border: 2px solid rgba(255, 255, 255, 100);
  1512. border-radius: 999px;
  1513. }
  1514. </style>