index.vue 31 KB

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