index.vue 35 KB

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