searchPile.vue 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403
  1. <template>
  2. <view>
  3. <ujp-navbar :is-back="false" height='88' style="background-color: bisque;">
  4. <view class="ujp-navbar-main">
  5. <view class="ujp-navbar-main1">
  6. <view style="margin-left:20rpx;width: 160rpx;">
  7. <uni-combox class='font2' ref="city" :border="false" v-model="area" :candidates="cities"
  8. @updateModel='updateCity' @updateSelector="updateTypeSelector(3)"></uni-combox>
  9. </view>
  10. <view style="margin-right: 20rpx; flex:1">
  11. <u-search height="60" :input-style='inputStyle' placeholder="查询站点地址或站名" :showAction="false"
  12. @focus="navigate"></u-search>
  13. </view>
  14. <view style="margin-right: 20rpx;" v-show="viewMode" @click="listMode">
  15. <text class="iconfont">&#xe613;</text> <text class="list font2">列表</text>
  16. </view>
  17. <view style="margin-right: 20rpx;" v-show="!viewMode" @click="mapMode">
  18. <text class="iconfont">&#xe622;</text> <text class="list font2">地图</text>
  19. </view>
  20. </view>
  21. <view class="ujp-navbar-main2">
  22. <view style=" max-width: 200rpx;margin-left:20rpx;margin-right:10rpx;flex:1; ">
  23. <uni-combox class='font2' ref="raidus" :border="false" v-model="raidus" :candidates="radiuses"
  24. @updateModel='updateRadius' @updateSelector="updateTypeSelector('0')"></uni-combox>
  25. </view>
  26. <view style=" max-width: 200rpx;flex:1; ">
  27. <uni-combox ref="type" class='font2' :border="false" v-model="type" :candidates="types"
  28. @updateModel='updateType' @updateSelector="updateTypeSelector(1)"></uni-combox>
  29. </view>
  30. <view style="flex:1;">
  31. <uni-combox ref="stationType" class='font2' :border="false" v-model="stationType"
  32. :candidates="stationTypes" @updateModel='updateType2'
  33. @updateSelector="updateTypeSelector(2)"></uni-combox>
  34. </view>
  35. <view style="margin-right: 20rpx;">
  36. <!-- -->
  37. <!-- <view v-show="dropdownShow" >
  38. <u-mask :show="dropdownShow" ></u-mask>
  39. </view> -->
  40. <jp-dropdown @open="dropdownShow=true" active-color="rgb(0, 185, 98)"
  41. @close="dropdownShow=false" ref="uDropdown"
  42. style=" display: contents;" :top="180">
  43. <u-dropdown-item title="筛选">
  44. <view class="slot-content">
  45. <view v-if="dropdownShow" class="u-text-center u-content-color ">
  46. <view class="preference" style="z-index:1024;width: 100%;">
  47. <view class="content-s">
  48. <view class="preference_group">
  49. <view class="preference_group_item"><label
  50. class="preference_label">距离我</label></view>
  51. <view>
  52. <u-tag class="preference_item"
  53. v-for="(item, index) in info.miles_type" :key="index"
  54. :style="index == preference.miles_index ? 'background-color:#00B962;color:#FFFFFF' : 'background-color:#EFF4F2;color:#926666'"
  55. shape="circle" :text="item.text"
  56. @click="selectMiles(index)"></u-tag>
  57. </view>
  58. </view>
  59. <view class="preference_group">
  60. <view class="preference_group_item"><label
  61. class="preference_label">充电站类型</label></view>
  62. <view>
  63. <u-tag class="preference_item_medium"
  64. v-for="(item, index) in info.obc_type" :key="index"
  65. :style="index == preference.obc_type_index ? 'background-color:#00B962;color:#FFFFFF' : 'background-color:#EFF4F2;color:#926666'"
  66. shape="circle" :text="item.text"
  67. @click="selectOBSType(index)"></u-tag>
  68. </view>
  69. </view>
  70. <view class="preference_group">
  71. <view class="preference_group_item"><label
  72. class="preference_label">充电站所属</label></view>
  73. <view>
  74. <u-tag class="preference_item_medium"
  75. v-for="(item, index) in info.obc_stationType" :key="index"
  76. :style="index == preference.obc_stationType_index ? 'background-color:#00B962;color:#FFFFFF' : 'background-color:#EFF4F2;color:#926666'"
  77. shape="circle" :text="item.text"
  78. @click="selectOBSType2(index)"></u-tag>
  79. </view>
  80. </view>
  81. <view class="preference_group" v-if="false">
  82. <view class="preference_group_item"><label
  83. class="preference_label">是否对外开放</label></view>
  84. <view>
  85. <u-tag class="preference_item_plus"
  86. v-for="(item, index) in info.obc_status" :key="index"
  87. :style="index == preference.obc_status_index ? 'background-color:#00B962;color:#FFFFFF' : 'background-color:#EFF4F2;color:#926666'"
  88. shape="circle" :text="item.text"
  89. @click="selectOBSStatus(index)"></u-tag>
  90. </view>
  91. </view>
  92. <view class="preference_group" v-if="false">
  93. <view style="margin-left: 30rpx;"><u-checkbox active-color="#00b962"
  94. shape="circle" v-model="preference.save_preference"
  95. @change="radioChange">保存偏好设置</u-checkbox></view>
  96. </view>
  97. </view>
  98. <view class="pre-btn" style="display: flex;flex-direction: row;">
  99. <view class="btn-1 font3" @click="reset" style="width: 30%;">重置</view>
  100. <view class="btn-2 font3" @click="close"
  101. style="width: 70%;background-color: #00B962;color: #fff;">确定</view>
  102. </view>
  103. </view>
  104. </view>
  105. <!-- <u-button type="primary" @click="closeDropdown">确定</u-button> -->
  106. </view>
  107. </u-dropdown-item>
  108. </jp-dropdown>
  109. </view>
  110. </view>
  111. </view>
  112. </ujp-navbar>
  113. <!-- 定位 -->
  114. <view v-show="!viewMode">
  115. <view class="location-box" v-if="message != 'getLocation:ok' && stationslist.length == 0 ">
  116. <view class="location">
  117. <view class="location-text">
  118. <view class="text-1 oldTextjp" oldstyle="font-size: 20px;">
  119. 定位中...
  120. </view>
  121. <view class="text-2 oldTextjp2" oldstyle="font-size: 16px;">
  122. 授权定位后可查询附近充电站
  123. </view>
  124. <view class="text-view">
  125. <view class="text-3 oldTextjp2" oldstyle="font-size: 16px;" @click="getPoint()">
  126. 重新定位
  127. </view>
  128. <view class="text-3 text-4 oldTextjp2" oldstyle="font-size: 16px;" @click="searchStationData()">
  129. 直接搜索
  130. </view>
  131. </view>
  132. </view>
  133. <view class="img-box">
  134. <img src="static/img/暂无网络信号-缺省页 1.png">
  135. </view>
  136. </view>
  137. </view>
  138. <view v-else-if="message == 'getLocation:ok'&&stationslist.length==0">
  139. <view class="carNone" v-if="stationslist.length == 0">
  140. <img src="static/img/暂无数据-缺省页.png" alt="">
  141. <p class="oldTextjp2" oldstyle="font-size: 18px;">{{loading?'暂无可用充电站':'正在为你加载可用的充电站...'}}</p>
  142. </view>
  143. </view>
  144. <view >
  145. <view >
  146. <view v-for="(item,index) in (stationslist.length?stationslist:defaultStation)" :key="item.id" class="charing-slow"
  147. @click="stationDetail(item)">
  148. <view class="address">
  149. <view class="name oldTextjp" oldstyle="font-size: 20px;">
  150. {{item.name}}
  151. </view>
  152. <template v-if="stationslist.length!=0">
  153. <view class="distance " v-if="item.distance != '99999999'">
  154. <text class="iconfont" style="color:#666666">&#xe615;</text>
  155. {{item.distance!=null && item.distance>0.1 ? item.distance.toFixed(1)+'公里' : '小于100米'}}
  156. </view>
  157. <view class="distance oldTextjp2" oldstyle="font-size: 16px;" v-else>
  158. <text class="iconfont" style="color:#666666">&#xe615;</text>
  159. 暂无定位
  160. </view>
  161. </template>
  162. </view>
  163. <view class="sign" >
  164. <view class="sign-tag sign-0" v-if="item.isRecommend||stationslist.length==0">推荐</view>
  165. <view class="sign-tag sign-5" v-if="item.isAlways" >常用</view>
  166. <view class="sign-1" v-if="item.giveDiscount&&item.discountRatio&&item.discountRatio!=100">
  167. 会员服务费{{discountRatio10(item.discountRatio)}}折</view>
  168. <view class="sign-4"
  169. v-if="item.nightLowPriceEnabled">
  170. 夜间超低价</view>
  171. <view class="sign-3" v-if="item.category=='超充'">160kW超充站</view>
  172. <view class="sign-2" v-if="item.tagList.length != 0"
  173. v-for="(tagName,tagIndex) in item.tagList" :key="tagIndex">{{tagName}}</view>
  174. <template v-if="item.stationType==50">
  175. {{item.address}}
  176. </template>
  177. </view>
  178. <view class="price-free price-freeList">
  179. <view class="price" v-if="personInfo&&personInfo.userType==2">
  180. <view class="price-1">
  181. <text class="num">{{!item.giveDiscount ? (item.electricityPrice+item.servicePrice).toFixed(2)
  182. : (item.electricityPrice+item.discountServicePrice).toFixed(2)}}</text>
  183. <text class="unit " oldstyle="font-size: 14px;">
  184. 元/度
  185. </text>
  186. </view>
  187. <view class="price-2 " oldstyle="font-size: 14px;" v-if="item.giveDiscount">
  188. <text class="num">{{(item.electricityPrice+item.servicePrice).toFixed(2)}}</text>
  189. <text class="unit">元/度</text>
  190. </view>
  191. </view>
  192. <!-- 游客价格-->
  193. <view class="price" v-else>
  194. <view class="price-1">
  195. <text class="num">
  196. {{(item.electricityPrice+item.servicePrice).toFixed(2)}}</text>
  197. <text class="unit " oldstyle="font-size: 48rpx;">元/度</text>
  198. </view>
  199. <view class="price-3 " oldstyle="font-size: 48rpx;" v-if="item.giveDiscount">
  200. <text class="num1">会员</text>
  201. <text class="num">{{ (item.electricityPrice+item.discountServicePrice).toFixed(2)}}</text>
  202. <text class="unit ">元/度</text>
  203. </view>
  204. </view>
  205. <view class="free">
  206. <view class="fast" v-if="item.fastNum">
  207. <view class="fast-font">
  208. </view>
  209. <view class="num">
  210. {{item.fastAvailableNum}}/{{item.fastNum}}
  211. </view>
  212. </view>
  213. <view class="slow" v-if="item.slowNum">
  214. <view class="slow-font">
  215. </view>
  216. <view class="num">
  217. {{item.slowAvailableNum}}/{{item.slowNum}}
  218. </view>
  219. </view>
  220. </view>
  221. </view>
  222. </view>
  223. <u-divider margin-top="20" bg-color="#F2F4F4"
  224. v-if="stationslist.length &&stationslist.length == recordsTotal">已经到底了</u-divider>
  225. </view>
  226. </view>
  227. </view>
  228. <view v-show="viewMode">
  229. <view>
  230. <Chargermap @onMoveStart="moveStart" @onMoveEnd="moveEnd" ref="amap" @onClicked="onClicked"
  231. @onload="mapdown" @clickMap="clickMap"></Chargermap>
  232. <!--@location="location"-->
  233. <u-image style='position:absolute;z-index:1023;right:40rpx;bottom:520rpx; '
  234. src="@/static/img/location.png" border-radius="8" bg-color="#ffffff" width="30px" height="30px"
  235. @click="setCenter"></u-image>
  236. </view>
  237. <!-- 新版卡片 -->
  238. <view class="chargerCard" v-if="stationsmap.length>0">
  239. <swiper v-if="stationsmap.length>0" :current="currentIndex" @change="swiperChange"
  240. slide-change-transition-end='swiperTransitionEnd' @transition="swiperTransition">
  241. <swiper-item v-for="(item,index) in stationsmap" :key="item.id" style="height: 100%;">
  242. <view class="swiper-item" style="height: 100%; background-color: #ffffff;"
  243. @click="stationDetail(item)">
  244. <view class="charing-slow charing-slow-2" @click="stationDetail(item)">
  245. <view class="address">
  246. <view class="name oldTextjp" oldstyle="font-size: 20px;">
  247. {{item.name}}
  248. </view>
  249. <view class="distance " v-if="item.distance != '99999999'">
  250. <text class="iconfont" style="color:#666666">&#xe615;</text>
  251. {{item.distance!=null && item.distance>0.1 ? item.distance.toFixed(1)+'公里' : '小于100米'}}
  252. </view>
  253. <view class="distance oldTextjp2" oldstyle="font-size: 16px;" v-else>
  254. <text class="iconfont" style="color:#666666">&#xe615;</text>
  255. 暂无定位
  256. </view>
  257. </view>
  258. <view class="sign min-h">
  259. <view class="sign-1"
  260. v-if="item.giveDiscount&&item.discountRatio&&item.discountRatio!=100">
  261. 会员服务费{{discountRatio10(item.discountRatio)}}折</view>
  262. <view class="sign-3" v-if="item.category=='超充'">160kW超充站</view>
  263. <view class="sign-4"
  264. v-if="item.nightLowPriceEnabled">
  265. 夜间超低价</view>
  266. <view class="sign-2" v-if="item.tagList.length != 0"
  267. v-for="(tagName,tagIndex) in item.tagList" :key="tagIndex">{{tagName}}
  268. </view>
  269. </view>
  270. <view class="price-free price-freeOne">
  271. <view class="price" v-if="personInfo&&personInfo.userType==2">
  272. <view class="price-1">
  273. <text class="num">{{!item.giveDiscount ? (item.electricityPrice+item.servicePrice).toFixed(2)
  274. : (item.electricityPrice+item.discountServicePrice).toFixed(2)}}</text>
  275. <text class="unit " oldstyle="font-size: 14px;">
  276. 元/度
  277. </text>
  278. </view>
  279. <view class="price-2 " oldstyle="font-size: 14px;" v-if="item.giveDiscount">
  280. <text class="num">{{(item.electricityPrice+item.servicePrice).toFixed(2)}}</text>
  281. <text class="unit">元/度</text>
  282. </view>
  283. </view>
  284. <!-- 游客价格-->
  285. <view class="price" v-else>
  286. <view class="price-1">
  287. <text class="num">
  288. {{(item.electricityPrice+item.servicePrice).toFixed(2)}}</text>
  289. <text class="unit " oldstyle="font-size: 48rpx;">元/度</text>
  290. </view>
  291. <view class="price-3 " oldstyle="font-size: 48rpx;" v-if="item.giveDiscount">
  292. <text class="num1">会员</text>
  293. <text class="num">{{ (item.electricityPrice+item.discountServicePrice).toFixed(2)}}</text>
  294. <text class="unit ">元/度</text>
  295. </view>
  296. </view>
  297. <view class="free">
  298. <view class="fast" v-if="item.fastNum">
  299. <view class="fast-font">
  300. </view>
  301. <view class="num">
  302. {{item.fastAvailableNum}}/{{item.fastNum}}
  303. </view>
  304. </view>
  305. <view class="slow" v-if="item.slowNum">
  306. <view class="slow-font">
  307. </view>
  308. <view class="num">
  309. {{item.slowAvailableNum}}/{{item.slowNum}}
  310. </view>
  311. </view>
  312. </view>
  313. </view>
  314. </view>
  315. </view>
  316. </swiper-item>
  317. </swiper>
  318. </view>
  319. </view>
  320. <Tabbar :current="2" ref="tabbarMain"></Tabbar>
  321. </view>
  322. </template>
  323. <script>
  324. import * as indexAPI from '@/apis/index.js'
  325. import * as api from '@/apis/site.js';
  326. import Tabbar from '@/components/Tabbar.vue';
  327. import Chargermap from '@/components/Chargermap2.vue';
  328. import jpDropdown from '@/components/Udropdown.vue';
  329. import uniCombox from '@/components/uni-combox/components/uni-combox/uni-combox.vue'
  330. import * as WxJsApi from '@/utils/wxJsApi.js'
  331. export default {
  332. components: {
  333. Chargermap,
  334. Tabbar,
  335. uniCombox,
  336. jpDropdown
  337. },
  338. data() {
  339. return {
  340. personInfo: {},
  341. loading: false,
  342. viewMode: false, //列表
  343. inputStyle: {
  344. backgroundColor: 'transparent',
  345. "font-size": '32rpx',
  346. },
  347. defaultStation:[],
  348. cities: ['荆州市'],
  349. radiuses: ['1公里', '2公里', '5公里', '10公里', '20公里', '50公里', '100公里', '200公里'],
  350. types: ['全部', '直流快充', '交流慢充'],
  351. stationTypes: ['全部', '公共充电桩', '个人充电桩'],
  352. info: {
  353. miles_type: [{
  354. distance: 1,
  355. text: '1公里'
  356. },
  357. {
  358. distance: 2,
  359. text: '2公里'
  360. },
  361. {
  362. distance: 5,
  363. text: '5公里'
  364. },
  365. {
  366. distance: 10,
  367. text: '10公里'
  368. },
  369. {
  370. distance: 20,
  371. text: '20公里'
  372. },
  373. {
  374. distance: 50,
  375. text: '50公里'
  376. },
  377. {
  378. distance: 100,
  379. text: '100公里'
  380. },
  381. {
  382. distance: 200,
  383. text: '200公里'
  384. }
  385. ],
  386. obc_type: [{
  387. value: '',
  388. text: '全部'
  389. }, {
  390. value: 1,
  391. text: '直流快充'
  392. }, {
  393. value: 2,
  394. text: '交流慢充'
  395. }],
  396. obc_status: [{
  397. value: 0,
  398. text: '对外开放'
  399. }, {
  400. value: 1,
  401. text: '不对外开放'
  402. }],
  403. obc_voltage: [{
  404. value: 0,
  405. text: '低于700V'
  406. }, {
  407. value: 1,
  408. text: '700V及以上'
  409. }],
  410. obc_power: {
  411. minValue: 0,
  412. maxValue: 1000
  413. },
  414. obc_stationType: [{
  415. value: '',
  416. text: '全部'
  417. }, {
  418. value: 1,
  419. text: '公共充电桩'
  420. }, {
  421. value: 50,
  422. text: '个人充电桩'
  423. }]
  424. },
  425. preference: {
  426. miles_index: 3,
  427. obc_stationType_index: 0,
  428. obc_type_index: 0,
  429. obc_status_index: 0,
  430. obc_voltage_index: 0,
  431. save_preference: false,
  432. obc_power: {
  433. minValue: 0,
  434. maxValue: 500
  435. }
  436. },
  437. area: '荆州市',
  438. raidus: '10公里',
  439. type: '全部',
  440. stationType: '全部',
  441. longitude: '',
  442. latitude: '',
  443. message: '',
  444. stationslist: [],
  445. stationsmap: [],
  446. pointTimeOut: true,
  447. dropdownShow: false,
  448. currentIndex: 0,
  449. }
  450. },
  451. onUnload() {
  452. //this.timeOut = false;
  453. this.pointTimeOut = false;
  454. },
  455. onHide() {
  456. //this.timeOut = false;
  457. this.pointTimeOut = false;
  458. },
  459. onShow() {
  460. if (this.$refs.tabbarMain) {
  461. this.$refs.tabbarMain.setcount(2);
  462. }
  463. if (!this.pointTimeOut) {
  464. this.pointTimeOut = true
  465. this.getPointTimeOut();
  466. }
  467. this.$nextTick(()=>{
  468. this.type = this.info.obc_type[this.preference.obc_type_index].text;
  469. this.raidus = this.info.miles_type[this.preference.miles_index].text;
  470. this.stationType= this.info.obc_stationType[this.preference.obc_stationType_index].text;
  471. if(this.viewMode){
  472. this.$refs.amap.init();
  473. this.searchStationData()
  474. }
  475. })
  476. },
  477. onReady() {
  478. WxJsApi.getWxConfig(['getLocation', 'addEventListener', 'scanQRCode']).then((res) => {
  479. // //(res)
  480. }).catch(error => {
  481. //(res)
  482. })
  483. if (this.carhelp.getPersonInfo()) {
  484. // this.userId = this.carhelp.getPersonInfo().id;
  485. this.personInfo = this.carhelp.getPersonInfo();
  486. }
  487. this.getPointTimeOut();
  488. },
  489. methods: {
  490. navigate(){
  491. //('naviage to ')
  492. uni.navigateTo({
  493. url:'/pages/search/search'
  494. })
  495. },
  496. isEnabled() {
  497. if (this.viewMode) {
  498. if (this.show)
  499. return false;
  500. }
  501. return true;
  502. },
  503. stationDetail(item) {
  504. if (!this.isEnabled()) {
  505. return;
  506. }
  507. uni.navigateTo({
  508. url: 'stationAndPile/stationDetails?id=' + item.id
  509. })
  510. },
  511. setCenter(){
  512. //('getPoint')
  513. WxJsApi.getLocation().then((res) => {
  514. this.latitude = parseFloat(res.latitude);
  515. this.longitude = parseFloat(res.longitude);
  516. //let data = {position:{latitude:latitude,longitude:longitude}};
  517. let posCenter= {longitude: this.longitude,latitude: this.latitude};
  518. this.$refs.amap.setCenter(posCenter);
  519. this.searchStationData();
  520. }).catch(error => {
  521. uni.showToast({
  522. title:JSON.stringify(error)
  523. })
  524. })
  525. // //('setCenter')
  526. },
  527. updateType2(e) {
  528. this.preference.obc_stationType_index = e.value;
  529. this.close();
  530. },
  531. swiperTransitionEnd(e){
  532. },
  533. swiperTransition (e) {
  534. //
  535. },
  536. updateType(e) {
  537. this.preference.obc_type_index = e.value;
  538. this.close();
  539. },
  540. updateRadius(e) {
  541. this.preference.miles_index = e.value;
  542. this.close();
  543. },
  544. selectOBSType(index) {
  545. this.preference.obc_type_index = index;
  546. },
  547. selectOBSType2(index) {
  548. this.preference.obc_stationType_index = index;
  549. },
  550. selectOBSStatus(index) {
  551. this.preference.obc_status_index = index;
  552. },
  553. selectOBCVoltage(index) {
  554. this.preference.obc_voltage_index = index;
  555. },
  556. selectMiles(index) {
  557. this.preference.miles_index = index;
  558. },
  559. swiperChange (e) {
  560. if(!this.viewMode){
  561. return
  562. }
  563. this.currentIndex = e.detail.current
  564. let station = this.stationsmap[this.currentIndex];
  565. let posCenter= {longitude: station.longitude,latitude: station.latitude};
  566. // //('currentIndex'+JSON.stringify(this.currentIndex))
  567. // //('currentIndex'+JSON.stringify(posCenter))
  568. // //('station'+JSON.stringify(station))
  569. let bounds = this.$refs.amap.logMapInfo();
  570. /*if( (posCenter.latitude<bounds.bounds.northeast.lat && posCenter.latitude>bounds.bounds.sourthwest.lat)
  571. && (posCenter.longitude<bounds.bounds.northeast.lng && posCenter.longitude>bounds.bounds.sourthwest.lng)
  572. ){
  573. //('bounds'+JSON.stringify(bounds));
  574. }else{
  575. this.$refs.amap.setCenter(posCenter);
  576. }*/
  577. this.$refs.amap.updateCharger(station);
  578. this.$refs.amap.setCenter(posCenter);
  579. },
  580. listMode() {
  581. this.close_all();
  582. this.viewMode = false
  583. },
  584. mapMode() {
  585. //this.$refs.amap.setChargerList(this.stationslist);
  586. this.$refs.amap.init();
  587. //this.currentIndex = 0;
  588. this.close_all();
  589. this.searchStationData()
  590. this.viewMode = true
  591. },
  592. reset() {
  593. this.preference.obc_status_index = 0;
  594. this.preference.obc_voltage_index = 0;
  595. this.preference.obc_stationType_index = 0;
  596. this.preference.obc_type_index = 0;
  597. this.preference.miles_index = 3;
  598. this.preference.save_preference = false;
  599. // this.$refs.obc_voltage.currentValue = [0,100];
  600. this.preference.obc_power.minValue = 0;
  601. this.preference.obc_power.maxValue = 500;
  602. this.preference.obc_power.minP = Math.floor((this.preference.obc_power.minValue / (this.info.obc_power
  603. .maxValue - this.info.obc_power.minValue)) * 100);
  604. this.preference.obc_power.maxP = Math.floor((this.preference.obc_power.maxValue / (this.info.obc_power
  605. .maxValue - this.info.obc_power.minValue)) * 100);
  606. // //('minP'+this.preference.obc_power.minP)
  607. // //('maxP'+this.preference.obc_power.maxP)
  608. //this.$refs.obc_voltage.reset(this.preference.obc_power);
  609. // this.$refs.obc_voltage.currentMaxValue = this.preference.obc_power[1];
  610. // //('reset')
  611. },
  612. close() {
  613. this.updateTypeSelector('')
  614. this.type = this.info.obc_type[this.preference.obc_type_index].text;
  615. this.raidus = this.info.miles_type[this.preference.miles_index].text;
  616. this.stationType = this.info.obc_stationType[this.preference.obc_stationType_index].text;
  617. if (this.preference.save_preference) {
  618. this.carhelp.set('preference', this.preference)
  619. }
  620. this.$refs.uDropdown.close();
  621. this.searchStationData();
  622. },
  623. clickMap(obj) {
  624. //this.show = false;
  625. if (obj == null || obj.type == null) return;
  626. if (obj.type == 'charger') {
  627. if (obj.obj != null) {
  628. let index = this.stationsmap.findIndex(item => item.id == obj.obj.id);
  629. this.currentIndex = index;
  630. //('find Index'+index);
  631. }
  632. }
  633. },
  634. getPoint() {
  635. if (this.stationslist.length != 0) {
  636. return
  637. }
  638. WxJsApi.getLocation().then((res) => {
  639. this.latitude = parseFloat(res.latitude);
  640. this.longitude = parseFloat(res.longitude);
  641. this.message = res.errMsg;
  642. if (res.errMsg != 'getLocation:ok') {
  643. uni.showToast({
  644. title: res
  645. })
  646. } else {
  647. uni.showToast({
  648. title: "定位中..."
  649. })
  650. this.searchStationData()
  651. }
  652. }).catch(error => {
  653. uni.showToast({
  654. title: error,
  655. icon: "none"
  656. })
  657. })
  658. },
  659. searchStationData(obj) {
  660. let data1 = {
  661. latitude: this.latitude,
  662. longitude: this.longitude,
  663. findType: "1",
  664. pageIndex: 1,
  665. pageSize: 999
  666. };
  667. if(obj){
  668. data1={
  669. ...data1,
  670. ...obj
  671. }
  672. }
  673. data1.type = this.info.obc_type[this.preference.obc_type_index].value;
  674. if (this.info.miles_type[this.preference.miles_index].distance != null)
  675. data1.raidus = this.info.miles_type[this.preference.miles_index].distance.toString();
  676. if (this.preference.obc_stationType_index != null) {
  677. data1.stationType = this.info.obc_stationType[this.preference.obc_stationType_index].value
  678. }
  679. //this.currentIndex = -1;
  680. //data1.findType = this.viewMode?"0":"1";
  681. uni.showLoading({})
  682. if (this.carhelp.getPersonInfo()) {
  683. data1.openId = this.carhelp.getOpenId()
  684. }
  685. this.loading = false
  686. api.getChargingStationData(data1).then(res => {
  687. uni.hideLoading()
  688. this.loading = true
  689. this.recordsTotal = res.data.recordsTotal;
  690. var stationslist=res.data.data
  691. if(this.viewMode){
  692. this.stationsmap = stationslist;
  693. this.$refs.amap.setChargerList(stationslist);
  694. // this.$refs.amap.init();
  695. if(this.currentIndex==-1||this.currentIndex>stationslist.length){
  696. this.currentIndex=0
  697. }
  698. if (stationslist.length) {
  699. this.$refs.amap.updateCharger(stationslist[this.currentIndex]);
  700. }
  701. let posCenter= {longitude: this.longitude,latitude: this.latitude};
  702. this.$refs.amap.setCenter(posCenter);
  703. this.$refs.amap.calcDistances([this.longitude, this.latitude], this.stationslist)
  704. // this.$refs.amap.calcDistances([this.longitude, this.latitude], this.stationslist)
  705. }else{
  706. this.stationslist = stationslist;
  707. }
  708. if(this.stationslist.length==0){
  709. this.getChargingStationDetail()
  710. }
  711. }).catch(error => {
  712. uni.showToast({
  713. title: error,
  714. icon: "none"
  715. })
  716. })
  717. },
  718. getChargingStationDetail(){
  719. var defaultStation=process.car.defaultStation
  720. for(var item in defaultStation){
  721. api.getChargingStationDetail({
  722. stationId:defaultStation[item]
  723. }).then((res) => {
  724. var station=res.data.station
  725. //this.MapLoaderthen(station)
  726. this.defaultStation.push(station)
  727. }).catch(error => {
  728. uni.showToast({
  729. title: error,
  730. icon: "none"
  731. })
  732. })
  733. }
  734. },
  735. getPointTimeOut() {
  736. setTimeout(() => {
  737. if (this.pointTimeOut) {
  738. this.getPoint();
  739. }
  740. }, 1000)
  741. },
  742. closeDropdown() {
  743. this.$refs.uDropdown.close();
  744. },
  745. close_all() {
  746. this.updateTypeSelector('')
  747. },
  748. updateTypeSelector(val) {
  749. var sz = ["raidus", "type", "stationType", 'city']
  750. for (var i in sz) {
  751. if (i == val && val != '') {
  752. } else {
  753. this.$refs[sz[i]].closeSelector();
  754. }
  755. }
  756. //this.show = false;
  757. },
  758. mapdown() {
  759. //this.isReady = true;
  760. //this.$refs.amap.getLocation ();
  761. //let state = {};
  762. uni.getSystemInfo({
  763. success: (res) => {
  764. let scrollH = res.windowHeight; // - uni.upx2px(88) - navbarH
  765. let scrollW = res.windowWidth;
  766. this.$refs.amap.setMyStyle("height:" + (scrollH - 88 - 50) + "px;width:" + scrollW +
  767. "px;");
  768. }
  769. })
  770. },
  771. moveEnd(e) {
  772. //('moveEnd')
  773. this.close_all();
  774. let posCenter = this.$refs.amap.logMapInfo();
  775. ////('posCenter'+JSON.stringify(posCenter))
  776. if(this.latitude==e.center.lat&&this.longitude== e.center.lng){
  777. return
  778. }
  779. this.latitude= e.center.lat
  780. this.longitude= e.center.lng
  781. this.searchStationData();
  782. },
  783. moveStart(e) {
  784. //this.close_all();
  785. },
  786. onClicked(e) {
  787. this.close_all();
  788. ////('onClicked e'+JSON.stringify(e))
  789. },
  790. }
  791. }
  792. </script>
  793. <style lang="scss" scoped>
  794. @import "@/_theme.scss";
  795. .ujp-navbar-main {
  796. display: flex;
  797. flex-direction: column;
  798. width: 100%;
  799. height: 100%;
  800. .ujp-navbar-main1 {
  801. display: flex;
  802. flex-direction: row;
  803. height: 100%;
  804. align-items: center;
  805. margin-top: 0rpx;
  806. padding-top: 0rpx;
  807. padding-bottom: 20rpx;
  808. }
  809. .ujp-navbar-main2 {
  810. display: flex;
  811. flex-direction: row;
  812. width: 100%;
  813. justify-content: space-between;
  814. align-items: center;
  815. }
  816. }
  817. .preference_group_item {
  818. padding: 15rpx;
  819. }
  820. .preference_group {
  821. padding-bottom: 20rpx;
  822. }
  823. .preference {
  824. background-color: #ffffff;
  825. left: 0rpx;
  826. // position: absolute
  827. }
  828. .preference_item {
  829. margin-bottom: 10rpx;
  830. margin-left: 20rpx;
  831. text-align: center;
  832. border-style: none;
  833. width: 20%;
  834. //height: 56rpx;
  835. /* line-height: 14px;*/
  836. }
  837. .content-s {
  838. height: 640rpx;
  839. overflow-y: scroll;
  840. text-align: left;
  841. }
  842. .preference_item_medium {
  843. margin-bottom: 10rpx;
  844. margin-left: 20rpx;
  845. text-align: center;
  846. border-style: none;
  847. min-width: 22%;
  848. //height: 56rpx;
  849. @include themeify {
  850. font-size: themed('font-size2');
  851. line-height: themed('font-size2');
  852. }
  853. /* line-height: 14px;*/
  854. }
  855. .preference_item_plus {
  856. margin-bottom: 10rpx;
  857. margin-left: 20rpx;
  858. align-items: center;
  859. justify-content: center;
  860. text-align: center;
  861. width: 28%;
  862. border-style: none;
  863. height: 56rpx;
  864. @include themeify {
  865. font-size: themed('font-size2');
  866. line-height: themed('font-size2');
  867. }
  868. /* line-height: 14px;*/
  869. }
  870. .preference_label {
  871. @include themeify {
  872. color: themed('font_colorLabel');
  873. font-size: themed('font-size1');
  874. font-weight: themed('fontWeight');
  875. }
  876. margin-left: 20rpx;
  877. margin-bottom: 100rpx;
  878. }
  879. .pre-btn {
  880. width: 100%;
  881. height: 96rpx;
  882. z-index: 999;
  883. }
  884. .btn-1,
  885. .btn-2 {
  886. height: 96rpx;
  887. line-height: 96rpx;
  888. text-align: center;
  889. border-top: 1px solid rgba(225, 228, 232, 100);
  890. }
  891. .station,
  892. .location,
  893. .state1 {
  894. box-shadow: 0px 4rpx 12rpx 0px #008c4a33;
  895. }
  896. //定位
  897. .location {
  898. width: 91.4%;
  899. background-color: #ffffff;
  900. height: 120px;
  901. display: flex;
  902. justify-content: space-between;
  903. margin: 20px auto 0;
  904. border-radius: 8px;
  905. border: #F2F4F4 1px;
  906. .location-text {
  907. padding: 24px 0 0 28px;
  908. .text-1 {
  909. height: 16px;
  910. line-height: 16px;
  911. color: rgba(16, 16, 16, 100);
  912. font-size: 16px;
  913. text-align: left;
  914. }
  915. .text-2 {
  916. height: 17px;
  917. line-height: 17px;
  918. color: rgba(102, 102, 102, 100);
  919. font-size: 12px;
  920. text-align: left;
  921. margin-top: 4px;
  922. white-space: nowrap; //强制不换行
  923. text-overflow: ellipsis; //文本超出出现省略号
  924. overflow: hidden;
  925. }
  926. .text-view{
  927. display: flex;
  928. }
  929. .text-3 {
  930. width: 80px;
  931. height: 24px;
  932. line-height: 22px;
  933. border-radius: 50px;
  934. color: rgba(0, 185, 98, 100);
  935. font-size: 12px;
  936. text-align: center;
  937. border: 1px solid rgba(0, 185, 98, 100);
  938. margin-top: 11px;
  939. }
  940. .text-4{
  941. margin-left: 10px;
  942. color: #ff9900;
  943. border: 1px solid #ff9900;
  944. }
  945. }
  946. .img-box {
  947. width: 120px;
  948. height: 120px;
  949. margin-right: 20px;
  950. img {
  951. width: 100%;
  952. height: 100%;
  953. }
  954. }
  955. }
  956. .carNone {
  957. display: flex;
  958. flex-direction: column;
  959. justify-content: center;
  960. align-items: center;
  961. img {
  962. width: 100%;
  963. height: 100%;
  964. }
  965. p {
  966. margin-top: -60px;
  967. }
  968. }
  969. .charing-slow-2{
  970. margin: 0 0 20rpx 0 !important;
  971. // border-bottom: 1px solid rgba(238, 242, 240, 100);
  972. }
  973. .charing-slow {
  974. box-shadow: 0px 4rpx 12rpx 0px #008c4a33;
  975. background-color: #fff;
  976. margin: 26rpx;
  977. border-radius: 16rpx;
  978. padding: 40rpx 24rpx 24rpx;
  979. position: relative;
  980. left: 0;
  981. right: 0;
  982. }
  983. .min-h{
  984. min-height: 65px;
  985. }
  986. .sign {
  987. display: flex;
  988. flex-wrap: wrap;
  989. margin-top: 10px;
  990. .sign-tag {
  991. height: 20px;
  992. line-height: 20px;
  993. border-radius: 8rpx;
  994. //background-color: rgba(255, 255, 255, 100);
  995. //color: rgba(255, 139, 0, 100);
  996. font-size: 24rpx;
  997. text-align: center;
  998. //border: 1px solid rgba(255, 139, 0, 100);
  999. padding: 0 8rpx;
  1000. margin-right: 16rpx;
  1001. margin-bottom: 8rpx;
  1002. }
  1003. .sign-0 {
  1004. background: linear-gradient(89.4deg, rgba(129,97,255,1) 2.8%,rgba(169,147,255,1) 98.02%);
  1005. color: rgba(255, 255, 255, 1);
  1006. padding: 0 10rpx;
  1007. //border: 1px solid rgba(255, 139, 0, 100);
  1008. }
  1009. .sign-5 {
  1010. background: linear-gradient(89.4deg, rgba(255,61,0,1) 2.8%,rgba(255,134,0,1) 98.02%);
  1011. color: rgba(255, 255, 255, 1);
  1012. padding: 0 10rpx;
  1013. }
  1014. .sign-1 {
  1015. height: 20px;
  1016. line-height: 20px;
  1017. border-radius: 4px;
  1018. background-color: rgba(255, 255, 255, 100);
  1019. color: rgba(255, 139, 0, 100);
  1020. font-size: 12px;
  1021. text-align: center;
  1022. border: 1px solid rgba(255, 139, 0, 100);
  1023. padding: 0 4px;
  1024. margin-right: 8px;
  1025. margin-bottom: 4px;
  1026. }
  1027. .sign-2 {
  1028. height: 20px;
  1029. line-height: 20px;
  1030. border-radius: 4px;
  1031. background-color: rgba(255, 255, 255, 100);
  1032. color: rgba(153, 153, 153, 100);
  1033. font-size: 12px;
  1034. text-align: center;
  1035. border: 1px solid rgba(204, 204, 204, 100);
  1036. padding: 0 4px;
  1037. margin-right: 8px;
  1038. margin-bottom: 4px;
  1039. }
  1040. .sign-3 {
  1041. height: 20px;
  1042. line-height: 20px;
  1043. border-radius: 8rpx;
  1044. background-color: rgba(255, 255, 255, 100);
  1045. color: #8161FF;
  1046. font-size: 24rpx;
  1047. text-align: center;
  1048. border: 1px solid #8161FF;
  1049. padding: 0 8rpx;
  1050. margin-right: 16rpx;
  1051. margin-bottom: 8rpx;
  1052. }
  1053. .sign-4 {
  1054. height: 20px;
  1055. line-height: 20px;
  1056. border-radius: 8rpx;
  1057. background-color: rgba(255, 255, 255, 100);
  1058. color: #00B962;
  1059. font-size: 24rpx;
  1060. text-align: center;
  1061. border: 1px solid #00B962;
  1062. padding: 0 8rpx;
  1063. margin-right: 16rpx;
  1064. margin-bottom: 8rpx;
  1065. }
  1066. }
  1067. .address {
  1068. width: 100%;
  1069. line-height: 20px;
  1070. display: flex;
  1071. justify-content: space-between;
  1072. .name {
  1073. font-size: 16px;
  1074. white-space: nowrap;
  1075. overflow: hidden;
  1076. text-overflow: ellipsis;
  1077. }
  1078. .distance {
  1079. color: rgba(102, 102, 102, 100);
  1080. text-align: end;
  1081. font-size: 30rpx;
  1082. width: 180rpx;
  1083. min-width: 180rpx;
  1084. .iconfont {
  1085. font-size: 12px;
  1086. margin-right: 2px;
  1087. }
  1088. }
  1089. @include themeify {
  1090. font-size: themed('font-size5');
  1091. line-height: themed('font-size7');
  1092. }
  1093. /* font-size: 11px;*/
  1094. font-weight: 600;
  1095. color: #101010;
  1096. }
  1097. .price-free {
  1098. width: 100%;
  1099. display: flex;
  1100. align-items: center;
  1101. justify-content: space-between;
  1102. }
  1103. .price {
  1104. display: flex;
  1105. align-items: baseline;
  1106. .price-1 {
  1107. line-height: 40rpx;
  1108. .num {
  1109. color: rgba(255, 98, 0, 100);
  1110. font-size: 44rpx;
  1111. height: 44rpx;
  1112. text-align: left;
  1113. font-family: Roboto-medium;
  1114. }
  1115. .unit {
  1116. // font-size: 12px;
  1117. color: rgba(102, 102, 102, 100);
  1118. @include themeify {
  1119. // font-size: themed('font-size2');
  1120. font-size: 24rpx;
  1121. height: themed('font-size2');
  1122. }
  1123. text-align: left;
  1124. font-family: AlibabaPuHui-regular;
  1125. margin-left: 8rpx;
  1126. }
  1127. }
  1128. .price-2 {
  1129. color: rgba(153, 153, 153, 100);
  1130. margin-left: 6rpx;
  1131. text-decoration: line-through;
  1132. font-size: 24rpx
  1133. }
  1134. .price-3 {
  1135. font-size: 24rpx;
  1136. color: #fff;
  1137. margin-left: 8rpx;
  1138. padding-right: 9rpx;
  1139. background:#00B962 ;
  1140. border-radius: 8rpx;
  1141. .num1{
  1142. padding-left: 12rpx;
  1143. border-radius: 8rpx 0 8rpx 8rpx;
  1144. padding-right: 18rpx;
  1145. background: #121212;
  1146. -webkit-clip-path: polygon(0 0, 93% 0, 84% 100%, 0% 100%);
  1147. clip-path: polygon(0 0, 93% 0, 84% 100%, 0% 100%);
  1148. }
  1149. }
  1150. }
  1151. .free {
  1152. display: flex;
  1153. align-items: center;
  1154. .slow,
  1155. .fast {
  1156. display: flex;
  1157. .sp-font {
  1158. width: 40rpx;
  1159. height: 40rpx;
  1160. line-height: 40rpx;
  1161. border-radius: 4px;
  1162. background-color: #7a68f6;
  1163. color: #fff;
  1164. font-size: 28rpx;
  1165. text-align: center;
  1166. margin-right: 2rpx;
  1167. }
  1168. .fast-font {
  1169. width: 40rpx;
  1170. height: 40rpx;
  1171. line-height: 40rpx;
  1172. border-radius: 4px;
  1173. background-color: rgba(186, 240, 215, 100);
  1174. color: rgba(0, 130, 69, 100);
  1175. font-size: 28rpx;
  1176. text-align: center;
  1177. margin-right: 2rpx;
  1178. }
  1179. .slow-font {
  1180. width: 40rpx;
  1181. height: 40rpx;
  1182. line-height: 40rpx;
  1183. border-radius: 4px;
  1184. background-color: rgba(226, 226, 226, 100);
  1185. color: rgba(128, 128, 128, 100);
  1186. font-size: 28rpx;
  1187. text-align: center;
  1188. margin-right: 2rpx;
  1189. }
  1190. .num {
  1191. font-size: 32rpx;
  1192. color: rgba(0, 145, 67, 100);
  1193. line-height: 40rpx;
  1194. }
  1195. }
  1196. .slow {
  1197. margin-left: 16rpx;
  1198. }
  1199. }
  1200. .chargerCard{
  1201. z-index: 999;
  1202. background-color: #fff;
  1203. margin: 0 24rpx;
  1204. border-radius: 16rpx;
  1205. // overflow: hidden;
  1206. bottom: 68px;
  1207. left: 0;
  1208. right: 0;
  1209. position: fixed;
  1210. // height: 380rpx;
  1211. // @include themeify{
  1212. // height:themed('cardHeight');
  1213. // }
  1214. }
  1215. </style>