searchPile.vue 37 KB

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