index.vue 33 KB

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