index.vue 34 KB

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