index.vue 34 KB

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