searchPile.vue 50 KB

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