searchPile.vue 54 KB

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