index.vue 30 KB

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