searchPile.vue 50 KB

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