searchPile.vue 55 KB

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