index.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525
  1. <template>
  2. <view>
  3. <!-- 头部图片 -->
  4. <view class="banner">
  5. <u-swiper bg-color="#fff"
  6. :img-mode="'scaleToFill'" height="320"
  7. :list="bannerList" @click="clickBanner" :name="'picUrl'" >
  8. </u-swiper>
  9. <!-- <img :src="indexLogo?indexLogo:'static/img/banner1.jpg'" alt="">
  10. -->
  11. </view>
  12. <!-- 选项列表 -->
  13. <view class="option-list">
  14. <view class="list-item" @click="getScanCode">
  15. <view class="icon iconfont" style="background-color:#59d96e;">
  16. &#xe61a;
  17. </view>
  18. <view class="text oldTextjp2" oldstyle="font-size: 18px;">
  19. 扫码充电
  20. </view>
  21. </view>
  22. <view class="list-item" @click="fastRecharge">
  23. <view class="icon iconfont" style="background-color:#4BD2C0;">
  24. &#xe629;
  25. </view>
  26. <view class="text oldTextjp2" oldstyle="font-size: 18px;">
  27. 快速充值
  28. </view>
  29. </view>
  30. <view class="list-item" @click="chargingRecord">
  31. <view class="icon iconfont" style="background-color: #6FA5FF;">
  32. &#xe625;
  33. </view>
  34. <view class="text oldTextjp2" oldstyle="font-size: 18px;">
  35. 充电记录
  36. </view>
  37. </view>
  38. <view class="list-item" @click="toSearchPile">
  39. <view class="icon iconfont" style="background-color: #9D9FFF;">
  40. &#xe622;
  41. </view>
  42. <view class="text oldTextjp2" oldstyle="font-size: 18px;">
  43. 附近站点
  44. </view>
  45. </view>
  46. </view>
  47. <!-- 模式选择 -->
  48. <u-mask :show="show">
  49. <view class="wrap">
  50. <view class="shema" @tap.stop>
  51. <view class="title">
  52. 设置浏览模式
  53. </view>
  54. <view class="">
  55. <u-radio-group v-model="value">
  56. <u-radio v-for="(item, index) in list" :key="index" :name="item.name" :disabled="item.disabled" active-color="#00B962">
  57. {{item.name}}
  58. <p v-if="item.name == '长辈模式'">字体更大 看的清楚</p>
  59. <p v-if="item.name == '标准模式'">信息丰富 功能全面</p>
  60. </u-radio>
  61. </u-radio-group>
  62. </view>
  63. <view class="hint">可在 {{""}}我的-设置 {{""}}页面中切换</view>
  64. <view class="btn-box">
  65. <u-button class="choice-btn" type="success" shape="circle" @click="elderClick">我选好了</u-button>
  66. </view>
  67. </view>
  68. </view>
  69. </u-mask>
  70. <view style="height:50px"></view>
  71. <!-- 充值活动 -->
  72. <view class=" top-up" v-if="activityList.length > 0 && description == '0:0:0'">
  73. <view class="top-up-title oldTextjp" oldstyle="font-size:20px;"><text class="line"></text>最新活动</view>
  74. <view class="img-box">
  75. <view class="img-1" v-for="(item,index) in activityList" :key="item.id"
  76. @click="rechargeActivity(index)">
  77. <img :src="item.picUrl" alt="">
  78. </view>
  79. </view>
  80. </view>
  81. <!-- 最新活动 -->
  82. <view class=" top-up" v-if="description != '0:0:0'">
  83. <view class="top-up-title oldTextjp" oldstyle="font-size:20px;"><text class="line"></text>最新活动</view>
  84. <view class="img-box2">
  85. <view class="left-image" @click="gotoUrl('pages/monthlyCardActivity/monthlyCardBuy')">
  86. <p>充电免服务费包月卡</p>
  87. <view class="time-activities">
  88. 距活动结束仅剩 <text class="time">{{description}}</text>
  89. </view>
  90. </view>
  91. <view class="right-image">
  92. <!-- <img class="margin-bottom" v-for="(item,index) in activityList" :key="item.id"
  93. @click="rechargeActivity(index)" :src="item.picUrl" alt=""> -->
  94. <img class="margin-bottom" src="../../assets/img/topup2.png" alt="" @click="rechargeActivity(0)">
  95. <img class="margin-bottom" src="../../assets/img/topup3.png" alt="" @click="rechargeActivity(1)">
  96. </view>
  97. </view>
  98. </view>
  99. <template v-if="message == 'getLocation:ok' && stationList.length != 0 && chargeList.length == 0">
  100. <view class=" top-up" >
  101. <view class="top-up-title oldTextjp" oldstyle="font-size:20px;"><text class="line"></text>附近站点
  102. <view class="pack-up" v-show="!listShow" @click="listShow=true" >
  103. 收起<text class="iconfont">&#xe607;</text>
  104. </view>
  105. <view class="pack-up" v-if="listShow" @click="listShow=false" >
  106. 展开<text class="iconfont">&#xe62c;</text>
  107. </view>
  108. </view>
  109. </view>
  110. <!-- 附近站点 -->
  111. <view class="station" v-for="(stationData,i) in stationList" :key="i"
  112. v-show="!listShow||i==0"
  113. @click="gotoUrl('pages/searchPile/stationAndPile/stationDetails?id=' + stationData.id)">
  114. <view class="text">
  115. <view class="station-title">
  116. <text class="title-left oldTextjp2" oldstyle="font-size: 14px;background-color: #9D9FFF;" v-if="stationData.type == '1'" style="background-color: #9D9FFF;">快充</text>
  117. <text class="title-left oldTextjp2" oldstyle="font-size: 14px;background-color: #00B962;" v-if="stationData.type == '2'" style="background-color: #00B962;">慢充</text>
  118. <text class="title-left oldTextjp2" oldstyle="font-size: 14px;background-color: #00BAC8;" v-if="stationData.type == '1,2'" style="background-color: #00BAC8;">快/慢</text>
  119. <text class="title-right oldTextjp" oldstyle="font-size: 20px;">{{stationData.name}}</text>
  120. </view>
  121. <view class="station-price">
  122. <view class="flex">
  123. <view class="price-left">{{stationData.costPrice}}</view>
  124. <view class="price-right">
  125. 元/度 起
  126. </view>
  127. </view>
  128. <view class="count-left">
  129. <span class="oldTextjp2 free-conut" oldstyle="font-size: 16px;" >空闲{{stationData.availableNum}}/</span>
  130. <span class="oldTextjp" oldstyle="font-size: 16px;">总数{{stationData.totalNum}}</span>
  131. </view>
  132. </view>
  133. <view class="park">
  134. <view class="flex">
  135. <view class="park-p">p</view>
  136. <view class="park-text oldTextjp2" oldstyle="font-size: 14px;">2小时停车免费</view>
  137. </view>
  138. <view class="count-right oldTextjp" oldstyle="font-size: 16px;">
  139. <text class="iconfont" style="color: #00B962;">&#xe615;</text>
  140. {{stationData.distance!=null&&stationData.distance>0.1 ? stationData.distance.toFixed(1)+'公里':'小于100米'}}
  141. </view>
  142. </view>
  143. </view>
  144. </view>
  145. <!-- 站点 -->
  146. <!-- <view class="station" v-for="(stationData,i) in stationList" :key="i"
  147. @click="gotoUrl('pages/searchPile/stationAndPile/stationDetails?id=' + stationData.id)">
  148. <view class="img-box">
  149. <img src="static/img/Frame 198 (1).png" alt="">
  150. </view>
  151. <view class="text">
  152. <view class="station-title">
  153. <text class="title-left oldTextjp2" oldstyle="font-size: 14px;background-color: #9D9FFF;" v-if="stationData.type == '1'" style="background-color: #9D9FFF;">快充</text>
  154. <text class="title-left oldTextjp2" oldstyle="font-size: 14px;background-color: #00B962;" v-if="stationData.type == '2'" style="background-color: #00B962;">慢充</text>
  155. <text class="title-left oldTextjp2" oldstyle="font-size: 14px;background-color: #00BAC8;" v-if="stationData.type == '1,2'" style="background-color: #00BAC8;">快/慢</text>
  156. <text class="title-right oldTextjp" oldstyle="font-size: 20px;">{{stationData.name}}</text>
  157. </view>
  158. <view class="station-price">
  159. <view class="price-left">{{stationData.costPrice}}</view>
  160. <view class="price-right">
  161. 元/度 起
  162. </view>
  163. </view>
  164. <view class="park">
  165. <text class="park-p">p</text>
  166. <text class="park-text oldTextjp2" oldstyle="font-size: 14px;">2小时停车免费</text>
  167. </view>
  168. <view class="count">
  169. <view class="count-left">
  170. <span class="oldTextjp2" oldstyle="font-size: 16px;">空闲{{stationData.availableNum}}/</span>
  171. <span class="oldTextjp" oldstyle="font-size: 16px;">总数{{stationData.totalNum}}</span>
  172. </view>
  173. <view class="count-right oldTextjp" oldstyle="font-size: 16px;">
  174. <text class="iconfont">&#xe615;</text>
  175. {{stationData.distance!=null&&stationData.distance>0.1 ? stationData.distance.toFixed(1)+'公里':'小于100米'}}
  176. </view>
  177. </view>
  178. </view>
  179. </view> -->
  180. </template>
  181. <!-- 定位 -->
  182. <view class="location-box" v-if="message != 'getLocation:ok' && stationList.length == 0 && chargeList.length == 0">
  183. <view class="location">
  184. <view class="location-text">
  185. <view class="text-1 oldTextjp" oldstyle="font-size: 20px;">
  186. 定位中...
  187. </view>
  188. <view class="text-2 oldTextjp2" oldstyle="font-size: 16px;">
  189. 授权定位后可查询附近充电站
  190. </view>
  191. <view class="text-3 oldTextjp2" oldstyle="font-size: 16px;" @click="getPoint()">
  192. 重新定位
  193. </view>
  194. </view>
  195. <view class="img-box">
  196. <img src="static/img/暂无网络信号-缺省页 1.png">
  197. </view>
  198. </view>
  199. </view>
  200. <!-- 充电状态 -->
  201. <view class="state1 state" v-if="chargeList.length > 0" v-for="(item,index) in chargeList" :key="item.id"
  202. @click="gotoUrl('pages/searchPile/chargeProcess/dcCharging?id=' + item.id)">
  203. <view class="state-text">
  204. <view class="text-1 oldTextjp" oldstyle="font-size: 20px;">
  205. {{item.statusText}}
  206. </view>
  207. <view v-if="item.status == '0'" class="text-2 oldTextjp2" oldstyle="font-size: 16px;">
  208. 启动中
  209. </view>
  210. <view v-if="item.status == '1'" class="text-2 oldTextjp2" oldstyle="font-size: 16px;">
  211. 已充{{item.dueFee != null ? item.dueFee : '0.00'}}元
  212. </view>
  213. <!-- <view v-if="item.status == '2'" class="text-2" style="color: red;">
  214. 超出时间将收取占位费
  215. </view> -->
  216. <view v-if="item.status == '4'" class="text-2 oldTextjp2" oldstyle="font-size: 16px;">
  217. <span v-if="item.waitNum==1">请耐心等待</span>
  218. <span v-else >前方等待{{item.waitNum-1}}位</span>
  219. </view>
  220. <view class="text-3 oldTextjp2" oldstyle="font-size: 16px;">
  221. {{item.deviceName}}<!-- /<br />{{item.deviceNo}} -->
  222. </view>
  223. </view>
  224. <view class="img-box">
  225. <img v-if="item.status == '0'" src="static/img/等待中-缺省页.png">
  226. <img v-if="item.status == '1'" src="static/img/充电中-缺省页.png">
  227. <img v-if="item.status == '2'" src="static/img/已充满-缺省页.png">
  228. <img v-if="item.status == '4'" src="static/img/等待中-缺省页.png">
  229. </view>
  230. </view>
  231. <!-- 新闻 -->
  232. <view class="news-title" v-if="newsList.length > 0">
  233. <view class="news-title-left oldTextjp" oldstyle="font-size:20px;">
  234. <view class="line" style="margin-top:4px;"></view>新闻公告
  235. </view>
  236. <view class="more oldTextjp2" oldstyle="font-size:16px;" @click="toNewsNotice">更多<view class="more-icon iconfont"> &#xe600;</view>
  237. </view>
  238. </view>
  239. <view class="news">
  240. <view class="news-content" v-for="(item,index) in newsList" :key="item.id"
  241. @click="gotoUrl('pages/article/articleDetails?id=' + item.id)">
  242. <view class="content-text">
  243. <view class="content-title oldTextjp2" oldstyle="font-size: 18px;">{{item.title}}</view>
  244. <view class="news-time">{{item.createTime?item.createTime.slice(5,10):''}}</view>
  245. </view>
  246. <view class="content-img">
  247. <img :src="item.pic ? item.pic : 'static/img/image_default.png'" alt="">
  248. </view>
  249. </view>
  250. </view>
  251. <view class="bottom" v-if="newsList.length == recordsTotal && newsList.length != 0">
  252. <view class="bot">
  253. <view class="bot-line"></view>
  254. <view class="bot-text oldTextjp2" oldstyle="font-size: 14px;">已经到底了</view>
  255. <view class="bot-line"></view>
  256. </view>
  257. </view>
  258. <!-- 导航栏 -->
  259. <view class="navigation">
  260. <view class="login-prompt" v-if="!userId">
  261. 登录显示更多会员服务
  262. <text class="button" @click="toLogin">登录/注册</text>
  263. </view>
  264. </view>
  265. <Tabbar :current="0" ref="tabbarMain" :elderStatus="elderStatus"></Tabbar>
  266. </view>
  267. </template>
  268. <script>
  269. import * as API from '@/apis/index.js'
  270. import * as newsApi from '@/apis/news.js'
  271. import * as WxJsApi from '@/utils/wxJsApi.js'
  272. import * as siteApi from '@/apis/site.js'
  273. import * as loginApi from '@/apis/login.js'
  274. import MapLoader from '@/utils/AMap'
  275. import Tabbar from '@/components/Tabbar.vue'
  276. import {
  277. newDate,
  278. secondsDistance,
  279. hourDistanceArr
  280. } from '@/utils'
  281. export default {
  282. components: {
  283. Tabbar
  284. },
  285. data() {
  286. return {
  287. listShow:false,
  288. stationList: [],
  289. bannerList:[],
  290. timeOut: false,
  291. pointTimeOut: true,
  292. chargeList: [],
  293. activityList: [],
  294. userId: '',
  295. newsList: [],
  296. pageIndex: 1,
  297. recordsTotal: 0,
  298. longitude: '',
  299. latitude: '',
  300. message: '',
  301. indexLogo: '',
  302. show: false,
  303. list: [{
  304. name: '长辈模式',
  305. disabled: false
  306. },
  307. {
  308. name: '标准模式',
  309. disabled: false
  310. },
  311. ],
  312. // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
  313. value: '长辈模式',
  314. elderStatus: false,
  315. fontMode: '',
  316. description: '0:0:0'
  317. }
  318. },
  319. onLoad(op) {
  320. if (op.jpcode) {
  321. var k = API.codeOperation(op.jpcode)
  322. if (k) {
  323. uni.navigateTo({
  324. url: k
  325. })
  326. }
  327. }
  328. },
  329. onUnload() {
  330. this.timeOut = false;
  331. this.pointTimeOut = false;
  332. },
  333. onHide() {
  334. this.timeOut = false;
  335. this.pointTimeOut = false;
  336. },
  337. onReachBottom() {
  338. if (this.newsList.length < this.recordsTotal) {
  339. this.myLoadmore();
  340. }
  341. },
  342. onShow() {
  343. if(this.$refs.tabbarMain){
  344. this.$refs.tabbarMain.setcount(0);
  345. }
  346. },
  347. onReady() {
  348. if (this.carhelp.get("getElderModeClass")) {
  349. if(this.carhelp.get("getElderModeClass") == "长辈模式") {
  350. this.fontMode = '1';
  351. } else {
  352. this.fontMode = '0';
  353. }
  354. API.changeFont({fontMode: this.fontMode}).then((res) => {
  355. }).catch(error => {
  356. uni.showToast({
  357. title: error,
  358. icon: "none"
  359. })
  360. })
  361. }
  362. this.getUserInfo();
  363. WxJsApi.getWxConfig(['getLocation', 'addEventListener', 'scanQRCode']).then((res) => {
  364. // //(res)
  365. }).catch(error => {
  366. //(res)
  367. })
  368. this.getBannerInfo("homepage")
  369. this.getPointTimeOut();
  370. this.getNewsList();
  371. this.getActivityInfoList();
  372. this.getDescriptionTime();
  373. },
  374. methods: {
  375. getDescriptionTime() {
  376. var date = '2022/08/08 00:00:00';
  377. var dateMonth1 = new Date().getMonth()+1;
  378. var dateDay1 = new Date().getDate();
  379. var dateMonth2 = parseInt(date.slice(5,7));
  380. var dateDay2 = parseInt(date.slice(8,10));
  381. if(dateMonth1 < dateMonth2) {
  382. var days = new Date(new Date().getFullYear(), dateMonth1, 0).getDate();
  383. dateDay2 = dateDay2 + days;
  384. console.log(dateDay2)
  385. }
  386. if(dateDay1 < dateDay2-2) {
  387. this.description = dateDay2 - dateDay1 + '天'
  388. } else {
  389. var dateTime2=new Date(date).getTime()
  390. var c=hourDistanceArr(new Date(),new Date(dateTime2))
  391. this.description = c[0]+':'+c[1]+':'+c[2];
  392. setTimeout(()=>{
  393. this.getDescriptionTime();
  394. },1000)
  395. }
  396. },
  397. getUserInfo() {
  398. uni.showLoading({
  399. title: "加载中",
  400. mask: true,
  401. })
  402. loginApi.findByOpenId({
  403. openId: this.carhelp.getOpenId(),
  404. noerror:true,
  405. }).then((res) => {
  406. uni.hideLoading();
  407. if (res.code == 200&&res.result) {
  408. var token = res ? res.data.token : '';
  409. this.carhelp.setPersonInfo(res.data.regUser );
  410. this.carhelp.setToken(token);
  411. this.carhelp.setPersonInfoPlus(res.data);
  412. }
  413. console.log("--------------")
  414. if (res.data.regUser) {
  415. if(res.data.regUser.fontMode == null) {
  416. this.show = true;
  417. } else {
  418. this.show = false;
  419. this.fontMode = res.data.regUser.fontMode;
  420. if(this.fontMode == '1') {
  421. this.carhelp.set("getElderModeClass", "长辈模式");
  422. } else {
  423. this.carhelp.set("getElderModeClass", "标准模式");
  424. }
  425. }
  426. this.userId = res.data.regUser.id;
  427. this.getFindChargeData();
  428. if (this.carhelp.get("getElderModeClass")) {
  429. if(this.carhelp.get("getElderModeClass") == "长辈模式") {
  430. this.elderStatus = true;
  431. } else {
  432. this.elderStatus = false;
  433. }
  434. }
  435. }else{
  436. this.carhelp.set("getElderModeClass", "长辈模式");
  437. this.elderStatus = true;
  438. var obj=this.carhelp.get("friends_invitation")
  439. // this.carhelp.set("friends_invitation",{
  440. // op:op,
  441. // date:new Date().getTime()
  442. // })
  443. if(obj){
  444. if(obj.date+1000*60*60*24 > new Date().getTime() ){
  445. this.friendsInvitation(obj)
  446. }
  447. }
  448. }
  449. }).catch(error => {
  450. uni.showToast({
  451. title: error,
  452. icon: "none"
  453. })
  454. })
  455. },
  456. friendsInvitation(obj){
  457. uni.showLoading({
  458. title: "加载中",
  459. mask: true,
  460. })
  461. API.findActivity({
  462. id:obj.op.id,
  463. code:obj.op.icode
  464. }).then((res) => {
  465. uni.hideLoading()
  466. obj.activityInfo=res.data.activityInfo;
  467. var name=res.data.activityInfo.name;
  468. var title="参与活动"
  469. var okbtn="前往注册"
  470. var endTime=res.data.activityInfo.endTime;
  471. if(endTime&&secondsDistance(newDate(endTime))>0){
  472. name="活动已结束"
  473. okbtn="继续注册"
  474. title="提示"
  475. obj=null
  476. }
  477. this.carhelp.set("friends_invitation",obj)
  478. uni.showModal({
  479. title:title,
  480. content:name,
  481. confirmText:okbtn,
  482. success: res1 => {
  483. if (res1.confirm) {
  484. uni.navigateTo({
  485. url: '/pages/login/login'
  486. })
  487. } else if (res1.cancel) {
  488. //('用户点击取消');
  489. }
  490. }
  491. })
  492. }).catch(error => {
  493. uni.showToast({
  494. title: error,icon: "none"
  495. })
  496. })
  497. },
  498. clickBanner(index){
  499. var uurl="";
  500. var mod = this.bannerList[index]
  501. mod.clickUrl=mod.linkUrl
  502. if (mod.clickUrl == null) {
  503. } else if (mod.clickUrl.slice(-5) == 'login' && this.userId) {
  504. } else if (mod.clickUrl.indexOf('http') == 0) {
  505. window.location = mod.clickUrl+uurl;
  506. } else if (mod.clickUrl.indexOf('#/') == 0) {
  507. if (mod.clickUrl.indexOf("?") == -1) {
  508. mod.clickUrl += '?';
  509. }
  510. var url=mod.clickUrl.split("#")[1]
  511. //window.location = mod.clickUrl;
  512. uni.navigateTo({
  513. url: url+uurl
  514. })
  515. } else if (mod.clickUrl == '#' || mod.clickUrl == '') {
  516. } else {
  517. uni.navigateTo({
  518. url: mod.clickUrl+uurl
  519. })
  520. }
  521. },
  522. getBannerInfo(code){
  523. uni.showLoading({
  524. title: "加载中",
  525. mask: true,
  526. })
  527. newsApi.getBannerInfo(code).then((res) => {
  528. this.bannerList =res.data;
  529. uni.hideLoading()
  530. document.getElementsByClassName("uni-swiper-wrapper")[0].parentNode.style="background-color: rgb(255, 255, 255); height: 160px;"
  531. }).catch(error => {
  532. uni.showToast({
  533. title: error,icon: "none"
  534. })
  535. })
  536. },
  537. elderClick() {
  538. if(this.value == "长辈模式") {
  539. this.elderStatus = true;
  540. this.carhelp.set("getElderModeClass", "长辈模式");
  541. this.fontMode = '1';
  542. } else {
  543. this.elderStatus = false;
  544. this.carhelp.set("getElderModeClass", "标准模式");
  545. this.fontMode = '0';
  546. }
  547. API.changeFont({fontMode: this.fontMode}).then((res) => {
  548. this.show = false;
  549. }).catch(error => {
  550. uni.showToast({
  551. title: error,
  552. icon: "none"
  553. })
  554. })
  555. },
  556. getPointTimeOut() {
  557. setTimeout(() => {
  558. if (this.pointTimeOut) {
  559. this.getPoint();
  560. }
  561. }, 1000)
  562. },
  563. getFindChargeData() {
  564. API.findChargeData().then((res) => {
  565. this.chargeList = res.data.chargingRecordList;
  566. var list = res.data.chargingRecordList;
  567. for (var i = 0; i < list.length; i++) {
  568. if (list[i].status == '1' || list[i].status == '4') {
  569. this.timeOut = true;
  570. }
  571. }
  572. if (this.timeOut) {
  573. setTimeout(() => {
  574. this.getFindChargeData();
  575. }, 5000)
  576. }
  577. }).catch(error => {
  578. uni.showToast({
  579. title: error,
  580. icon: "none"
  581. })
  582. })
  583. },
  584. toSearchPile() {
  585. uni.navigateTo({
  586. url: '/pages/searchPile/searchPile'
  587. })
  588. },
  589. toLogin() {
  590. uni.navigateTo({
  591. url: '/pages/login/login'
  592. })
  593. },
  594. toNewsNotice() {
  595. uni.navigateTo({
  596. url: '/pages/article/newsNotice'
  597. })
  598. },
  599. //微信扫二维码
  600. getScanCode() {
  601. if (this.userId) {
  602. WxJsApi.scanQRCode(1).then(res => {
  603. //("scanQRCode------" + res)
  604. if (res) {
  605. API.scanCode(res).then((response) => {
  606. }).catch(error => {
  607. uni.showToast({
  608. title: error,
  609. icon: "none"
  610. })
  611. })
  612. }
  613. }).catch(error => {
  614. })
  615. } else {
  616. uni.navigateTo({
  617. url: '/pages/login/login'
  618. })
  619. }
  620. },
  621. fastRecharge() {
  622. if (this.userId) {
  623. uni.navigateTo({
  624. url: '/pages/user/finance/recharge'
  625. })
  626. } else {
  627. uni.navigateTo({
  628. url: '/pages/login/login'
  629. })
  630. }
  631. },
  632. chargingRecord() {
  633. if (this.userId) {
  634. uni.navigateTo({
  635. url: '/pages/record/index'
  636. })
  637. } else {
  638. uni.navigateTo({
  639. url: '/pages/login/login'
  640. })
  641. }
  642. },
  643. rechargeActivity(index) {
  644. if (this.userId) {
  645. var uurl="&uid="+this.userId;
  646. var mod = this.activityList[index]
  647. if (mod.clickUrl == null) {
  648. } else if (mod.clickUrl.indexOf('http') == 0) {
  649. window.location = mod.clickUrl+uurl;
  650. } else if (mod.clickUrl.indexOf('#/') == 0) {
  651. if (mod.clickUrl.indexOf("?") == -1) {
  652. mod.clickUrl += '?';
  653. }
  654. var url=mod.clickUrl.split("#")[1]
  655. //window.location = mod.clickUrl;
  656. uni.navigateTo({
  657. url: url+uurl
  658. })
  659. } else if (mod.clickUrl == '#' || mod.clickUrl == '') {
  660. } else {
  661. uni.navigateTo({
  662. url: mod.clickUrl+uurl
  663. })
  664. }
  665. } else {
  666. uni.navigateTo({
  667. url: '/pages/login/login'
  668. })
  669. }
  670. },
  671. getActivityInfoList() {
  672. uni.showLoading({
  673. title: "加载中",
  674. mask: true,
  675. })
  676. API.activityInfoList({
  677. pageIndex: 1,
  678. pageSize: 10
  679. }).then((res) => {
  680. uni.hideLoading()
  681. this.activityList = res.data.data;
  682. }).catch(error => {
  683. uni.showToast({
  684. title: error,
  685. icon: "none"
  686. })
  687. })
  688. },
  689. getPoint() {
  690. WxJsApi.getLocation().then((res) => {
  691. this.latitude = parseFloat(res.latitude);
  692. this.longitude = parseFloat(res.longitude);
  693. this.message = res.errMsg;
  694. if (res.errMsg != 'getLocation:ok') {
  695. uni.showToast({
  696. title: res
  697. })
  698. } else {
  699. siteApi.searchStationData({
  700. longitude: this.longitude,
  701. latitude: this.latitude,
  702. pageSize:5
  703. }).then((response) => {
  704. this.stationList = response.data.data;
  705. if(response.data.data.length){
  706. var stationDataList = response.data.data;
  707. for(var i in stationDataList){
  708. var item=stationDataList[i]
  709. MapLoader().then(AMap1 => {
  710. var lnglat = new AMap.LngLat(this.longitude,this.latitude);
  711. var myDistance = lnglat.distance([item.longitude,item.latitude]);
  712. item.distance = myDistance/1000;
  713. })
  714. }
  715. //this.stationData = stationDataList;
  716. }
  717. }).catch(error => {
  718. uni.showToast({
  719. title: error,
  720. icon: "none"
  721. })
  722. })
  723. }
  724. }).catch(error => {
  725. uni.showToast({
  726. title: error,
  727. icon: "none"
  728. })
  729. })
  730. },
  731. getNewsList(bl) {
  732. uni.showLoading({
  733. title: "加载中",
  734. mask: true,
  735. })
  736. if (bl) {
  737. this.newsList = [];
  738. this.pageIndex = 1;
  739. }
  740. newsApi.newsInfoList({
  741. pageIndex: 1,
  742. pageSize: 10
  743. }).then((res) => {
  744. uni.hideLoading()
  745. this.newsList = [
  746. ...this.newsList,
  747. ...res.data.data
  748. ];
  749. this.recordsTotal = res.data.recordsTotal
  750. }).catch(error => {
  751. uni.showToast({
  752. title: error,
  753. icon: "none"
  754. })
  755. })
  756. },
  757. myLoadmore() {
  758. this.pageIndex += 1;
  759. this.getNewsList()
  760. },
  761. }
  762. }
  763. </script>
  764. <style lang="scss" scoped>
  765. // 头部图片
  766. img {
  767. width: 100%;
  768. height: 100%;
  769. }
  770. .banner {
  771. width: 100%;
  772. height: 160px;
  773. }
  774. // 选项列表
  775. .option-list {
  776. width: 91.4%;
  777. padding-top: 10px;
  778. height: 90px;
  779. line-height: 20px;
  780. border-radius: 8px;
  781. text-align: center;
  782. background-color: #fff;
  783. position: absolute;
  784. top: 120px;
  785. left: 0;
  786. right: 0;
  787. margin: auto;
  788. display: flex;
  789. justify-content: space-around;
  790. .list-item {
  791. // 图标
  792. .icon {
  793. width: 40px;
  794. height: 40px;
  795. border-radius: 99px;
  796. line-height: 40px;
  797. font-size: 24px;
  798. text-align: center;
  799. margin: auto;
  800. color: #ffffff;
  801. }
  802. }
  803. }
  804. .flex{
  805. display: flex;
  806. }
  807. // 站点
  808. .pack-up{
  809. float: right;
  810. font-size: 16px;
  811. color: rgba(119, 119, 119, 100);
  812. }
  813. .station {
  814. width: 91.4%;
  815. border-radius: 8px;
  816. padding: 12px 0px 12px 11px;
  817. background-color: #fff;
  818. margin: 8px auto 0;
  819. // position: relative;
  820. .img-box {
  821. width: 100%;
  822. height: 100%;
  823. border-radius: 8px;
  824. overflow: hidden;
  825. }
  826. img {
  827. width: 100%;
  828. height: 100%;
  829. }
  830. .text {
  831. width: 91.4%;
  832. // position: absolute;
  833. // top: 0;
  834. // left: 20px;
  835. // 头部
  836. .station-title {
  837. display: flex;
  838. .title-left {
  839. display: inline-block;
  840. height: 20px;
  841. width: 44px;
  842. // margin-left: 12px;
  843. line-height: 20px;
  844. border-radius: 50px;
  845. background-color: rgba(133, 140, 255, 100);
  846. color: rgba(255, 255, 255, 100);
  847. font-size: 12px;
  848. text-align: center;
  849. font-family: Arial;
  850. }
  851. .title-right {
  852. display: inline-block;
  853. margin-left: 4px;
  854. margin-top: 2px;
  855. width: 271px;
  856. height: 16px;
  857. line-height: 16px;
  858. color: rgba(16, 16, 16, 100);
  859. font-size: 16px;
  860. text-align: left;
  861. font-family: AlibabaPuHui-regular;
  862. }
  863. }
  864. // 价格
  865. .station-price {
  866. margin-top: 8px;
  867. display: flex;
  868. justify-content: space-between;
  869. .price-left {
  870. width: 40px;
  871. height: 20px;
  872. line-height: 20px;
  873. color: rgba(255, 98, 0, 100);
  874. font-size: 20px;
  875. text-align: left;
  876. font-family: Roboto-medium;
  877. }
  878. .price-right {
  879. height: 20px;
  880. margin-left: 4px;
  881. margin-top: 3px;
  882. color: rgba(102, 102, 102, 100);
  883. font-size: 14px;
  884. text-align: left;
  885. font-family: AlibabaPuHui-regular;
  886. }
  887. .free-conut{
  888. color: #009143;
  889. }
  890. }
  891. // park
  892. .park {
  893. margin-top: 8px;
  894. display: flex;
  895. justify-content: space-between;
  896. .park-p {
  897. width: 20px;
  898. height: 20px;
  899. line-height: 12px;
  900. text-align: center;
  901. background-color: #00b962;
  902. color: #fff;
  903. }
  904. .park-text {
  905. height: 20px;
  906. line-height: 20px;
  907. color: rgba(102, 102, 102, 100);
  908. font-size: 14px;
  909. text-align: left;
  910. margin-left: 4px;
  911. }
  912. }
  913. // 数量
  914. .count {
  915. margin-top: 14px !important;
  916. width: 91.4%;
  917. display: flex;
  918. justify-content: space-between;
  919. white-space: nowrap;
  920. overflow: hidden;
  921. }
  922. }
  923. }
  924. //定位
  925. .location {
  926. width: 91.4%;
  927. background-color: #ffffff;
  928. height: 120px;
  929. display: flex;
  930. justify-content: space-between;
  931. margin: 20px auto 0;
  932. border-radius: 8px;
  933. border: #F2F4F4 1px;
  934. .location-text {
  935. padding: 24px 0 0 28px;
  936. .text-1 {
  937. height: 16px;
  938. line-height: 16px;
  939. color: rgba(16, 16, 16, 100);
  940. font-size: 16px;
  941. text-align: left;
  942. }
  943. .text-2 {
  944. height: 17px;
  945. line-height: 17px;
  946. color: rgba(102, 102, 102, 100);
  947. font-size: 12px;
  948. text-align: left;
  949. margin-top: 4px;
  950. white-space: nowrap; //强制不换行
  951. text-overflow: ellipsis; //文本超出出现省略号
  952. overflow: hidden;
  953. }
  954. .text-3 {
  955. width: 80px;
  956. height: 24px;
  957. line-height: 22px;
  958. border-radius: 50px;
  959. color: rgba(0, 185, 98, 100);
  960. font-size: 12px;
  961. text-align: center;
  962. border: 1px solid rgba(0, 185, 98, 100);
  963. margin-top: 11px;
  964. }
  965. }
  966. .img-box {
  967. width: 120px;
  968. height: 120px;
  969. margin-right: 20px;
  970. }
  971. }
  972. .state {
  973. width: 91.4%;
  974. background-color: #ffffff;
  975. height: 120px;
  976. display: flex;
  977. margin: 20px auto 0;
  978. border-radius: 8px;
  979. border: #F2F4F4 1px;
  980. .state-text {
  981. width: 61.8%;
  982. padding: 24px 0 0 28px;
  983. .text-1 {
  984. height: 16px;
  985. line-height: 16px;
  986. color: blueviolet;
  987. font-size: 16px;
  988. text-align: left;
  989. }
  990. .text-2 {
  991. height: 17px;
  992. line-height: 17px;
  993. color: #101010;
  994. text-align: left;
  995. margin-top: 12px;
  996. }
  997. .text-3 {
  998. font-size: 12px;
  999. line-height: 20px;
  1000. margin-top: 6px;
  1001. color: #999999;
  1002. }
  1003. }
  1004. .img-box {
  1005. width: 120px;
  1006. height: 120px;
  1007. margin-right: 20px;
  1008. }
  1009. }
  1010. //充值
  1011. .top-up {
  1012. margin-left: 16px;
  1013. margin-top: 17px;
  1014. padding-right: 16px;
  1015. .top-up-title {
  1016. color: rgba(16, 16, 16, 100);
  1017. font-size: 16px;
  1018. }
  1019. .img-box {
  1020. margin-top: 12px;
  1021. width: 95%;
  1022. height: 146px;
  1023. display: flex;
  1024. justify-content: space-between;
  1025. .img-1 {
  1026. width: 166px;
  1027. height: 146px;
  1028. position: relative;
  1029. .img-text {
  1030. position: absolute;
  1031. top: 12px;
  1032. left: 12px;
  1033. height: 33px;
  1034. color: #ff4444;
  1035. font-size: 24px;
  1036. text-align: left;
  1037. margin-left: 12px;
  1038. .img-text2 {
  1039. font-size: 14px
  1040. }
  1041. }
  1042. }
  1043. img {
  1044. width: 100%;
  1045. height: 100%;
  1046. }
  1047. }
  1048. .img-box2{
  1049. margin-top: 12px;
  1050. display: flex;
  1051. justify-content: space-between;
  1052. img{
  1053. width: 100%;
  1054. height: 100%;
  1055. }
  1056. .left-image{
  1057. width: 48.3%;
  1058. height: 166px;
  1059. padding: 8px 0 0 12px;
  1060. background: url(@/assets/img/topup1.png);
  1061. background-repeat: no-repeat;
  1062. background-position: 30% 10%;
  1063. background-size: cover;
  1064. p{
  1065. color: rgba(56, 47, 33, 100);
  1066. font-size: 24px;
  1067. line-height: 28px;
  1068. font-weight: 600;
  1069. }
  1070. .time-activities{
  1071. color: rgba(56, 39, 14, 100);
  1072. font-size: 16px;
  1073. line-height: 22px;
  1074. margin-top: 4px;
  1075. .time{
  1076. margin-left: 4px;
  1077. color: #fa3534;
  1078. font-weight: bold;
  1079. }
  1080. }
  1081. }
  1082. .right-image{
  1083. width: 48.3%;
  1084. display: flex;
  1085. flex-direction: column;
  1086. justify-content: space-between;
  1087. .margin-top{
  1088. margin-top: 12px;
  1089. }
  1090. img{
  1091. height: 77px;
  1092. }
  1093. };
  1094. }
  1095. }
  1096. // 小竖线
  1097. .line {
  1098. display: inline-block;
  1099. width: 3px;
  1100. height: 12px;
  1101. margin-right: 7px;
  1102. background-color: rgba(0, 145, 67, 100);
  1103. }
  1104. // 新闻公告
  1105. .news-title {
  1106. padding: 0 16px;
  1107. margin-top: 12px;
  1108. color: rgba(16, 16, 16, 100);
  1109. font-size: 16px;
  1110. display: flex;
  1111. justify-content: space-between;
  1112. background-color: #F2F4F4;
  1113. .news-title-left {
  1114. display: flex;
  1115. }
  1116. .more {
  1117. font-size: 14px;
  1118. color: #777777;
  1119. display: flex;
  1120. line-height: 20px;
  1121. .more-icon {
  1122. font-size: 24px
  1123. }
  1124. }
  1125. }
  1126. .news {
  1127. background-color: #fff;
  1128. width: 91.4%;
  1129. margin: 12px auto 0;
  1130. border-radius: 8px;
  1131. .news-content {
  1132. display: flex;
  1133. justify-content: space-between;
  1134. padding: 12px;
  1135. .content-text {
  1136. width: 56.2%;
  1137. height: 100%;
  1138. line-height: 21px;
  1139. color: #101010;
  1140. text-align: left;
  1141. font-size: 14px;
  1142. }
  1143. .content-title {
  1144. width: 100%;
  1145. overflow: hidden;
  1146. text-overflow: ellipsis;
  1147. display: -webkit-box;
  1148. -webkit-box-orient: vertical;
  1149. -webkit-line-clamp: 3;
  1150. }
  1151. .content-img {
  1152. width: 40.57%;
  1153. height: 100%;
  1154. border-radius: 4px;
  1155. overflow: hidden;
  1156. img {
  1157. width: 100%;
  1158. height: 80%;
  1159. }
  1160. }
  1161. .news-time {
  1162. margin-top: 5%;
  1163. color: #999999;
  1164. width: 80px;
  1165. height: 20px;
  1166. font-size: 14px;
  1167. }
  1168. }
  1169. }
  1170. .bottom {
  1171. width: 100%;
  1172. height: 100px;
  1173. .bot {
  1174. width: 100%;
  1175. margin: 0 auto;
  1176. padding: 0 17.3%;
  1177. justify-content: space-between;
  1178. display: flex;
  1179. .bot-line {
  1180. margin-top: 20px;
  1181. width: 21.3%;
  1182. height: 0px;
  1183. border: 1px solid rgba(207, 210, 213, 100);
  1184. }
  1185. .bot-text {
  1186. white-space: nowrap;
  1187. height: 17px;
  1188. margin-top: 13px;
  1189. margin-left: 12px;
  1190. margin-right: 12px;
  1191. font-size: 12px;
  1192. text-align: center;
  1193. color: rgba(182, 189, 195, 100);
  1194. }
  1195. }
  1196. }
  1197. // 导航栏
  1198. .navigation {
  1199. width: 100%;
  1200. // height: 40px;
  1201. padding: 10px 0;
  1202. background-color: #fff;
  1203. position: fixed;
  1204. bottom: 0;
  1205. left: 0;
  1206. display: flex;
  1207. justify-content: space-around;
  1208. text-align: center;
  1209. color: #999999;
  1210. .nav-icon {
  1211. width: 54px;
  1212. font-size: 24px
  1213. }
  1214. .nav-text {
  1215. font-size: 14px;
  1216. }
  1217. }
  1218. .shema {
  1219. width: 70%;
  1220. padding-bottom: 20px;
  1221. border-radius: 16px;
  1222. background-color: #fff;
  1223. position: fixed;
  1224. top: 100px;
  1225. left: 0;
  1226. right: 0;
  1227. margin: 0 auto;
  1228. z-index: 9999;
  1229. .title {
  1230. height: 33px;
  1231. color: rgba(16, 16, 16, 100);
  1232. font-size: 24px;
  1233. text-align: center;
  1234. padding: 16px 0;
  1235. }
  1236. .u-radio-group {
  1237. margin: 16px 5vw;
  1238. }
  1239. /deep/.u-radio {
  1240. width: 60vw !important;
  1241. padding: 24px 24px 40px;
  1242. line-height: 20px;
  1243. border-radius: 16px;
  1244. text-align: center;
  1245. border: #101010 1px solid;
  1246. margin-top: 12px;
  1247. }
  1248. /deep/ .u-radio__label {
  1249. text-align: left;
  1250. height: 24px;
  1251. // color: rgba(0, 185, 98, 100);
  1252. font-size: 24px;
  1253. }
  1254. p {
  1255. height: 22px;
  1256. color: rgba(102, 102, 102, 100);
  1257. font-size: 14px;
  1258. margin-top: 12px;
  1259. white-space: nowrap
  1260. }
  1261. .hint {
  1262. text-align: center;
  1263. }
  1264. .btn-box {
  1265. margin-top: 20px;
  1266. .choice-btn {
  1267. width: 80%;
  1268. }
  1269. }
  1270. }
  1271. .wrap {
  1272. display: flex;
  1273. align-items: center;
  1274. justify-content: center;
  1275. height: 100%;
  1276. }
  1277. // 登录提示
  1278. .login-prompt {
  1279. width: 91.4%;
  1280. height: 40px;
  1281. line-height: 40px;
  1282. border-radius: 50px;
  1283. text-align: left;
  1284. padding-left: 16px;
  1285. padding-right: 4px;
  1286. background-color: rgba(0, 0, 0, 0.6);
  1287. position: fixed;
  1288. bottom: 75px;
  1289. color: #ffffff;
  1290. .button {
  1291. width: 88px;
  1292. height: 32px;
  1293. line-height: 32px;
  1294. border-radius: 50px;
  1295. background-color: rgba(0, 185, 98, 100);
  1296. text-align: center;
  1297. float: right;
  1298. margin-top: 4px;
  1299. }
  1300. }
  1301. </style>