searchPile.vue 55 KB

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