searchPile.vue 37 KB

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