searchPile.vue 49 KB

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