searchPile.vue 51 KB

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